aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-12-01 14:18:33 +0000
committerDavid Shah <dave@ds0.me>2019-12-27 10:44:30 +0000
commit0ea7f153a1f14ac6af079b5660afe1981e5f8b51 (patch)
tree4f0e5e94de22e6d65bcfb47655692ca16b016635
parentfe40094216d0007797c51ff8894127b37a4ff045 (diff)
downloadnextpnr-0ea7f153a1f14ac6af079b5660afe1981e5f8b51.tar.gz
nextpnr-0ea7f153a1f14ac6af079b5660afe1981e5f8b51.tar.bz2
nextpnr-0ea7f153a1f14ac6af079b5660afe1981e5f8b51.zip
Allow constraining non-leaf cells to regions
Signed-off-by: David Shah <dave@ds0.me>
-rw-r--r--common/nextpnr.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc
index a6345b42..1156490c 100644
--- a/common/nextpnr.cc
+++ b/common/nextpnr.cc
@@ -523,7 +523,16 @@ void BaseCtx::createRectangularRegion(IdString name, int x0, int y0, int x1, int
void BaseCtx::addBelToRegion(IdString name, BelId bel) { region[name]->bels.insert(bel); }
void BaseCtx::constrainCellToRegion(IdString cell, IdString region_name)
{
- cells[cell]->region = region[region_name].get();
+ // Support hierarchical cells as well as leaf ones
+ if (hierarchy.count(cell)) {
+ auto &hc = hierarchy.at(cell);
+ for (auto &lc : hc.leaf_cells)
+ constrainCellToRegion(lc.second, region_name);
+ for (auto &hsc : hc.hier_cells)
+ constrainCellToRegion(hsc.second, region_name);
+ }
+ if (cells.count(cell))
+ cells.at(cell)->region = region[region_name].get();
}
DecalXY BaseCtx::constructDecalXY(DecalId decal, float x, float y)
{