aboutsummaryrefslogtreecommitdiffstats
path: root/common/place/detail_place_core.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-06-23 18:48:31 +0100
committergatecat <gatecat@ds0.me>2022-07-08 14:30:57 +0200
commit09e388f453d9cf998391495349c88e5478b62e34 (patch)
tree004f2b14ed5a3b0584c4998d9f0a5598cc52ab28 /common/place/detail_place_core.cc
parent86396c41d64d2583ec1dffca4298e83d927f0762 (diff)
downloadnextpnr-09e388f453d9cf998391495349c88e5478b62e34.tar.gz
nextpnr-09e388f453d9cf998391495349c88e5478b62e34.tar.bz2
nextpnr-09e388f453d9cf998391495349c88e5478b62e34.zip
netlist: Add PseudoCell API
When implementing concepts such as partition pins or deliberately split nets, there's a need for something that looks like a cell (starts/ends routing with pins on nets, has timing data) but isn't mapped to a fixed bel in the architecture, but instead can have pin mappings defined at runtime. The PseudoCell allows this by providing an alternate, virtual-function based API for such cells. When a cell has `pseudo_cell` used, instead of calling functions such as getBelPinWire, getBelLocation or getCellDelay in the Arch API; such data is provided by the cell itself, fully flexible at runtime regardless of arch, via methods on the PseudoCell implementation.
Diffstat (limited to 'common/place/detail_place_core.cc')
-rw-r--r--common/place/detail_place_core.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/common/place/detail_place_core.cc b/common/place/detail_place_core.cc
index 7e629f24..18118fc8 100644
--- a/common/place/detail_place_core.cc
+++ b/common/place/detail_place_core.cc
@@ -37,6 +37,8 @@ PlacePartition::PlacePartition(Context *ctx)
x1 = 0;
y1 = 0;
for (auto &cell : ctx->cells) {
+ if (cell.second->isPseudo())
+ continue;
Loc l = ctx->getBelLocation(cell.second->bel);
x0 = std::min(x0, l.x);
x1 = std::max(x1, l.x);
@@ -110,6 +112,8 @@ NetBB NetBB::compute(const Context *ctx, const NetInfo *net, const dict<IdString
if (!net->driver.cell)
return result;
auto bel_loc = [&](const CellInfo *cell) {
+ if (cell->isPseudo())
+ return cell->getLocation();
BelId bel = cell2bel ? cell2bel->at(cell->name) : cell->bel;
return ctx->getBelLocation(bel);
};
@@ -176,10 +180,12 @@ void DetailPlacerThreadState::set_partition(const PlacePartition &part)
// Set up the original cell-bel map for all nets inside the thread
local_cell2bel.clear();
for (NetInfo *net : thread_nets) {
- if (net->driver.cell)
+ if (net->driver.cell && !net->driver.cell->isPseudo())
local_cell2bel[net->driver.cell->name] = net->driver.cell->bel;
- for (auto &usr : net->users)
- local_cell2bel[usr.cell->name] = usr.cell->bel;
+ for (auto &usr : net->users) {
+ if (!usr.cell->isPseudo())
+ local_cell2bel[usr.cell->name] = usr.cell->bel;
+ }
}
}