diff options
author | David Shah <dave@ds0.me> | 2018-12-14 12:16:29 +0000 |
---|---|---|
committer | David Shah <dave@ds0.me> | 2019-03-22 10:31:54 +0000 |
commit | 493d6c3fb93fb7ffe96609ded9e392b327b2c86c (patch) | |
tree | 4313450f58034da4dca68ebcb2ac8fe956fda025 /common/nextpnr.cc | |
parent | ae33ff397f5bc97d047639a7fb76d5d888050cb2 (diff) | |
download | nextpnr-493d6c3fb93fb7ffe96609ded9e392b327b2c86c.tar.gz nextpnr-493d6c3fb93fb7ffe96609ded9e392b327b2c86c.tar.bz2 nextpnr-493d6c3fb93fb7ffe96609ded9e392b327b2c86c.zip |
Add Python helper functions for floorplanning
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r-- | common/nextpnr.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc index bb941d3d..b0cbbbeb 100644 --- a/common/nextpnr.cc +++ b/common/nextpnr.cc @@ -421,4 +421,25 @@ void BaseCtx::addClock(IdString net, float freq) } } +void BaseCtx::createRectangularRegion(IdString name, int x0, int y0, int x1, int y1) +{ + std::unique_ptr<Region> new_region(new Region()); + new_region->name = name; + new_region->constr_bels = true; + new_region->constr_pips = false; + new_region->constr_wires = false; + for (int x = x0; x <= x1; x++) { + for (int y = y0; y <= y1; y++) { + for (auto bel : getCtx()->getBelsByTile(x, y)) + new_region->bels.insert(bel); + } + } + region[name] = std::move(new_region); +} +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(); +} + NEXTPNR_NAMESPACE_END |