aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/arch.h
diff options
context:
space:
mode:
authorD. Shah <dave@ds0.me>2021-02-03 19:51:39 +0000
committerD. Shah <dave@ds0.me>2021-02-05 19:19:17 +0000
commitd4363b7ee593ee84957dbe60969cf694903d70ad (patch)
tree3febd3477d0d1a2e800144d75109aef7071a95f0 /ecp5/arch.h
parentb866601b6398f90967c8ab120f9b9806869f94c4 (diff)
downloadnextpnr-d4363b7ee593ee84957dbe60969cf694903d70ad.tar.gz
nextpnr-d4363b7ee593ee84957dbe60969cf694903d70ad.tar.bz2
nextpnr-d4363b7ee593ee84957dbe60969cf694903d70ad.zip
ecp5: Use common wire/pip binding
Signed-off-by: D. Shah <dave@ds0.me>
Diffstat (limited to 'ecp5/arch.h')
-rw-r--r--ecp5/arch.h88
1 files changed, 6 insertions, 82 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h
index 1fb05620..80374e0d 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -472,8 +472,6 @@ struct Arch : ArchBase<ArchRanges>
mutable std::unordered_map<IdStringList, PipId> pip_by_name;
std::vector<CellInfo *> bel_to_cell;
- std::unordered_map<WireId, NetInfo *> wire_to_net;
- std::unordered_map<PipId, NetInfo *> pip_to_net;
std::unordered_map<WireId, int> wire_fanout;
// fast access to X and Y IdStrings for building object names
@@ -648,49 +646,20 @@ struct Arch : ArchBase<ArchRanges>
uint32_t getWireChecksum(WireId wire) const override { return wire.index; }
- void bindWire(WireId wire, NetInfo *net, PlaceStrength strength) override
- {
- NPNR_ASSERT(wire != WireId());
- NPNR_ASSERT(wire_to_net[wire] == nullptr);
- wire_to_net[wire] = net;
- net->wires[wire].pip = PipId();
- net->wires[wire].strength = strength;
- refreshUiWire(wire);
- }
-
void unbindWire(WireId wire) override
{
NPNR_ASSERT(wire != WireId());
- NPNR_ASSERT(wire_to_net[wire] != nullptr);
+ NPNR_ASSERT(base_wire2net[wire] != nullptr);
- auto &net_wires = wire_to_net[wire]->wires;
+ auto &net_wires = base_wire2net[wire]->wires;
auto it = net_wires.find(wire);
NPNR_ASSERT(it != net_wires.end());
-
auto pip = it->second.pip;
+ // As well as the default rules; need to handle fanout counting
if (pip != PipId()) {
wire_fanout[getPipSrcWire(pip)]--;
- pip_to_net[pip] = nullptr;
}
-
- net_wires.erase(it);
- wire_to_net[wire] = nullptr;
- refreshUiWire(wire);
- }
-
- bool checkWireAvail(WireId wire) const override
- {
- NPNR_ASSERT(wire != WireId());
- return wire_to_net.find(wire) == wire_to_net.end() || wire_to_net.at(wire) == nullptr;
- }
-
- NetInfo *getBoundWireNet(WireId wire) const override
- {
- NPNR_ASSERT(wire != WireId());
- if (wire_to_net.find(wire) == wire_to_net.end())
- return nullptr;
- else
- return wire_to_net.at(wire);
+ ArchBase::unbindWire(wire);
}
DelayInfo getWireDelay(WireId wire) const override
@@ -744,59 +713,14 @@ struct Arch : ArchBase<ArchRanges>
void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) override
{
- NPNR_ASSERT(pip != PipId());
- NPNR_ASSERT(pip_to_net[pip] == nullptr);
-
- pip_to_net[pip] = net;
wire_fanout[getPipSrcWire(pip)]++;
-
- WireId dst;
- dst.index = loc_info(pip)->pip_data[pip.index].dst_idx;
- dst.location = pip.location + loc_info(pip)->pip_data[pip.index].rel_dst_loc;
- NPNR_ASSERT(wire_to_net[dst] == nullptr);
- wire_to_net[dst] = net;
- net->wires[dst].pip = pip;
- net->wires[dst].strength = strength;
+ ArchBase::bindPip(pip, net, strength);
}
void unbindPip(PipId pip) override
{
- NPNR_ASSERT(pip != PipId());
- NPNR_ASSERT(pip_to_net[pip] != nullptr);
wire_fanout[getPipSrcWire(pip)]--;
-
- WireId dst;
- dst.index = loc_info(pip)->pip_data[pip.index].dst_idx;
- dst.location = pip.location + loc_info(pip)->pip_data[pip.index].rel_dst_loc;
- NPNR_ASSERT(wire_to_net[dst] != nullptr);
- wire_to_net[dst] = nullptr;
- pip_to_net[pip]->wires.erase(dst);
-
- pip_to_net[pip] = nullptr;
- }
-
- bool checkPipAvail(PipId pip) const override
- {
- NPNR_ASSERT(pip != PipId());
- return pip_to_net.find(pip) == pip_to_net.end() || pip_to_net.at(pip) == nullptr;
- }
-
- NetInfo *getBoundPipNet(PipId pip) const override
- {
- NPNR_ASSERT(pip != PipId());
- if (pip_to_net.find(pip) == pip_to_net.end())
- return nullptr;
- else
- return pip_to_net.at(pip);
- }
-
- NetInfo *getConflictingPipNet(PipId pip) const override
- {
- NPNR_ASSERT(pip != PipId());
- if (pip_to_net.find(pip) == pip_to_net.end())
- return nullptr;
- else
- return pip_to_net.at(pip);
+ ArchBase::unbindPip(pip);
}
AllPipRange getPips() const override