diff options
author | YRabbit <rabbit@yrabbit.cyou> | 2022-07-10 08:05:25 +1000 |
---|---|---|
committer | YRabbit <rabbit@yrabbit.cyou> | 2022-07-10 08:05:25 +1000 |
commit | ecddac7b18526940db529389b7efdae299b7dd12 (patch) | |
tree | fb27cb7b7d8a3a79d7d1b14049396a9cf2596dd6 /common/kernel/basectx.cc | |
parent | 1ebfe67daf2ec3e1e64150f09ab4c194f41d1d9d (diff) | |
parent | 664cec54b92844745e21a4e86dcf8e3cca09d781 (diff) | |
download | nextpnr-ecddac7b18526940db529389b7efdae299b7dd12.tar.gz nextpnr-ecddac7b18526940db529389b7efdae299b7dd12.tar.bz2 nextpnr-ecddac7b18526940db529389b7efdae299b7dd12.zip |
Merge branch 'master' into clock-wip
Diffstat (limited to 'common/kernel/basectx.cc')
-rw-r--r-- | common/kernel/basectx.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/common/kernel/basectx.cc b/common/kernel/basectx.cc index 83a2deea..82cdd835 100644 --- a/common/kernel/basectx.cc +++ b/common/kernel/basectx.cc @@ -131,6 +131,30 @@ void BaseCtx::constrainCellToRegion(IdString cell, IdString region_name) if (!matched) log_warning("No cell matched '%s' when constraining to region '%s'\n", nameOf(cell), nameOf(region_name)); } + +void BaseCtx::createRegionPlug(IdString name, IdString type, Loc approx_loc) +{ + CellInfo *cell = nullptr; + if (cells.count(name)) + cell = cells.at(name).get(); + else + cell = createCell(name, type); + cell->pseudo_cell = std::make_unique<RegionPlug>(approx_loc); +} + +void BaseCtx::addPlugPin(IdString plug, IdString pin, PortType dir, WireId wire) +{ + if (!cells.count(plug)) + log_error("no cell named '%s' found\n", plug.c_str(this)); + CellInfo *ci = cells.at(plug).get(); + RegionPlug *rplug = dynamic_cast<RegionPlug *>(ci->pseudo_cell.get()); + if (!rplug) + log_error("cell '%s' is not a RegionPlug\n", plug.c_str(this)); + rplug->port_wires[pin] = wire; + ci->ports[pin].name = pin; + ci->ports[pin].type = dir; +} + DecalXY BaseCtx::constructDecalXY(DecalId decal, float x, float y) { DecalXY dxy; |