aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/arch.h
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-08-08 10:48:05 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-08-08 10:48:05 +0200
commit5df90bc5a5a273f5c50764f4045012b282e7fa36 (patch)
tree5f91c9800f958a810441120794dd28572e401c6f /ecp5/arch.h
parentb0741e292c7ec7191f2c92fe7695e34018469b67 (diff)
parent8553573d2485ac2ec60d1c49949c254e02d35490 (diff)
downloadnextpnr-5df90bc5a5a273f5c50764f4045012b282e7fa36.tar.gz
nextpnr-5df90bc5a5a273f5c50764f4045012b282e7fa36.tar.bz2
nextpnr-5df90bc5a5a273f5c50764f4045012b282e7fa36.zip
Merge remote-tracking branch 'origin/master' into common_main
# Conflicts: # ecp5/main.cc # ice40/main.cc
Diffstat (limited to 'ecp5/arch.h')
-rw-r--r--ecp5/arch.h91
1 files changed, 45 insertions, 46 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h
index 223f1ec5..55c1caa1 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -404,10 +404,9 @@ struct Arch : BaseCtx
mutable std::unordered_map<IdString, WireId> wire_by_name;
mutable std::unordered_map<IdString, PipId> pip_by_name;
- std::unordered_map<BelId, IdString> bel_to_cell;
- std::unordered_map<WireId, IdString> wire_to_net;
- std::unordered_map<PipId, IdString> pip_to_net;
- std::unordered_map<PipId, IdString> switches_locked;
+ std::unordered_map<BelId, CellInfo *> bel_to_cell;
+ std::unordered_map<WireId, NetInfo *> wire_to_net;
+ std::unordered_map<PipId, NetInfo *> pip_to_net;
ArchArgs args;
Arch(ArchArgs args);
@@ -448,23 +447,23 @@ struct Arch : BaseCtx
uint32_t getBelChecksum(BelId bel) const { return bel.index; }
- void bindBel(BelId bel, IdString cell, PlaceStrength strength)
+ void bindBel(BelId bel, CellInfo *cell, PlaceStrength strength)
{
NPNR_ASSERT(bel != BelId());
- NPNR_ASSERT(bel_to_cell[bel] == IdString());
+ NPNR_ASSERT(bel_to_cell[bel] == nullptr);
bel_to_cell[bel] = cell;
- cells[cell]->bel = bel;
- cells[cell]->belStrength = strength;
+ cell->bel = bel;
+ cell->belStrength = strength;
refreshUiBel(bel);
}
void unbindBel(BelId bel)
{
NPNR_ASSERT(bel != BelId());
- NPNR_ASSERT(bel_to_cell[bel] != IdString());
- cells[bel_to_cell[bel]]->bel = BelId();
- cells[bel_to_cell[bel]]->belStrength = STRENGTH_NONE;
- bel_to_cell[bel] = IdString();
+ NPNR_ASSERT(bel_to_cell[bel] != nullptr);
+ bel_to_cell[bel]->bel = BelId();
+ bel_to_cell[bel]->belStrength = STRENGTH_NONE;
+ bel_to_cell[bel] = nullptr;
refreshUiBel(bel);
}
@@ -485,23 +484,23 @@ struct Arch : BaseCtx
bool checkBelAvail(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
- return bel_to_cell.find(bel) == bel_to_cell.end() || bel_to_cell.at(bel) == IdString();
+ return bel_to_cell.find(bel) == bel_to_cell.end() || bel_to_cell.at(bel) == nullptr;
}
- IdString getBoundBelCell(BelId bel) const
+ CellInfo *getBoundBelCell(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
if (bel_to_cell.find(bel) == bel_to_cell.end())
- return IdString();
+ return nullptr;
else
return bel_to_cell.at(bel);
}
- IdString getConflictingBelCell(BelId bel) const
+ CellInfo *getConflictingBelCell(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
if (bel_to_cell.find(bel) == bel_to_cell.end())
- return IdString();
+ return nullptr;
else
return bel_to_cell.at(bel);
}
@@ -558,53 +557,53 @@ struct Arch : BaseCtx
uint32_t getWireChecksum(WireId wire) const { return wire.index; }
- void bindWire(WireId wire, IdString net, PlaceStrength strength)
+ void bindWire(WireId wire, NetInfo *net, PlaceStrength strength)
{
NPNR_ASSERT(wire != WireId());
- NPNR_ASSERT(wire_to_net[wire] == IdString());
+ NPNR_ASSERT(wire_to_net[wire] == nullptr);
wire_to_net[wire] = net;
- nets[net]->wires[wire].pip = PipId();
- nets[net]->wires[wire].strength = strength;
+ net->wires[wire].pip = PipId();
+ net->wires[wire].strength = strength;
}
void unbindWire(WireId wire)
{
NPNR_ASSERT(wire != WireId());
- NPNR_ASSERT(wire_to_net[wire] != IdString());
+ NPNR_ASSERT(wire_to_net[wire] != nullptr);
- auto &net_wires = nets[wire_to_net[wire]]->wires;
+ auto &net_wires = wire_to_net[wire]->wires;
auto it = net_wires.find(wire);
NPNR_ASSERT(it != net_wires.end());
auto pip = it->second.pip;
if (pip != PipId()) {
- pip_to_net[pip] = IdString();
+ pip_to_net[pip] = nullptr;
}
net_wires.erase(it);
- wire_to_net[wire] = IdString();
+ wire_to_net[wire] = nullptr;
}
bool checkWireAvail(WireId wire) const
{
NPNR_ASSERT(wire != WireId());
- return wire_to_net.find(wire) == wire_to_net.end() || wire_to_net.at(wire) == IdString();
+ return wire_to_net.find(wire) == wire_to_net.end() || wire_to_net.at(wire) == nullptr;
}
- IdString getBoundWireNet(WireId wire) const
+ NetInfo *getBoundWireNet(WireId wire) const
{
NPNR_ASSERT(wire != WireId());
if (wire_to_net.find(wire) == wire_to_net.end())
- return IdString();
+ return nullptr;
else
return wire_to_net.at(wire);
}
- IdString getConflictingWireNet(WireId wire) const
+ NetInfo *getConflictingWireNet(WireId wire) const
{
NPNR_ASSERT(wire != WireId());
if (wire_to_net.find(wire) == wire_to_net.end())
- return IdString();
+ return nullptr;
else
return wire_to_net.at(wire);
}
@@ -638,57 +637,57 @@ struct Arch : BaseCtx
uint32_t getPipChecksum(PipId pip) const { return pip.index; }
- void bindPip(PipId pip, IdString net, PlaceStrength strength)
+ void bindPip(PipId pip, NetInfo *net, PlaceStrength strength)
{
NPNR_ASSERT(pip != PipId());
- NPNR_ASSERT(pip_to_net[pip] == IdString());
+ NPNR_ASSERT(pip_to_net[pip] == nullptr);
pip_to_net[pip] = net;
WireId dst;
dst.index = locInfo(pip)->pip_data[pip.index].dst_idx;
dst.location = pip.location + locInfo(pip)->pip_data[pip.index].rel_dst_loc;
- NPNR_ASSERT(wire_to_net[dst] == IdString());
+ NPNR_ASSERT(wire_to_net[dst] == nullptr);
wire_to_net[dst] = net;
- nets[net]->wires[dst].pip = pip;
- nets[net]->wires[dst].strength = strength;
+ net->wires[dst].pip = pip;
+ net->wires[dst].strength = strength;
}
void unbindPip(PipId pip)
{
NPNR_ASSERT(pip != PipId());
- NPNR_ASSERT(pip_to_net[pip] != IdString());
+ NPNR_ASSERT(pip_to_net[pip] != nullptr);
WireId dst;
dst.index = locInfo(pip)->pip_data[pip.index].dst_idx;
dst.location = pip.location + locInfo(pip)->pip_data[pip.index].rel_dst_loc;
- NPNR_ASSERT(wire_to_net[dst] != IdString());
- wire_to_net[dst] = IdString();
- nets[pip_to_net[pip]]->wires.erase(dst);
+ NPNR_ASSERT(wire_to_net[dst] != nullptr);
+ wire_to_net[dst] = nullptr;
+ pip_to_net[pip]->wires.erase(dst);
- pip_to_net[pip] = IdString();
+ pip_to_net[pip] = nullptr;
}
bool checkPipAvail(PipId pip) const
{
NPNR_ASSERT(pip != PipId());
- return pip_to_net.find(pip) == pip_to_net.end() || pip_to_net.at(pip) == IdString();
+ return pip_to_net.find(pip) == pip_to_net.end() || pip_to_net.at(pip) == nullptr;
}
- IdString getBoundPipNet(PipId pip) const
+ NetInfo *getBoundPipNet(PipId pip) const
{
NPNR_ASSERT(pip != PipId());
if (pip_to_net.find(pip) == pip_to_net.end())
- return IdString();
+ return nullptr;
else
return pip_to_net.at(pip);
}
- IdString getConflictingPipNet(PipId pip) const
+ NetInfo *getConflictingPipNet(PipId pip) const
{
NPNR_ASSERT(pip != PipId());
if (pip_to_net.find(pip) == pip_to_net.end())
- return IdString();
+ return nullptr;
else
return pip_to_net.at(pip);
}
@@ -807,7 +806,7 @@ struct Arch : BaseCtx
delay_t getRipupDelayPenalty() const { return 200; }
float getDelayNS(delay_t v) const { return v * 0.001; }
uint32_t getDelayChecksum(delay_t v) const { return v; }
- delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const;
+ bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const;
// -------------------------------------------------