diff options
Diffstat (limited to 'nexus/pins.cc')
-rw-r--r-- | nexus/pins.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/nexus/pins.cc b/nexus/pins.cc index 6d449438..1f0ef363 100644 --- a/nexus/pins.cc +++ b/nexus/pins.cc @@ -74,9 +74,24 @@ static const std::unordered_map<IdString, Arch::CellPinsData> base_cell_pin_data }; } // namespace -void Arch::get_cell_pin_data(std::unordered_map<IdString, CellPinsData> &cell_pins) const +void Arch::init_cell_pin_data() { cell_pins_db = base_cell_pin_data; } + +CellPinStyle Arch::get_cell_pin_style(CellInfo *cell, IdString port) const { - cell_pins = base_cell_pin_data; + // Look up the pin style in the cell database + auto fnd_cell = cell_pins_db.find(cell->type); + if (fnd_cell == cell_pins_db.end()) + return PINSTYLE_NONE; + auto fnd_port = fnd_cell->second.find(port); + if (fnd_port != fnd_cell->second.end()) + return fnd_port->second; + // If there isn't an exact port match, then the empty IdString + // represents a wildcard default match + auto fnd_default = fnd_cell->second.find({}); + if (fnd_default != fnd_cell->second.end()) + return fnd_default->second; + + return PINSTYLE_NONE; } NEXTPNR_NAMESPACE_END |