3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-22 13:41:27 +00:00

celltypes: get_cell() helper

Add `CellTypes::get_cell()` which takes a 'type' `IdString` and returns the corresponding `CellType` if it is in the `cell_types` dict, otherwise returns `nullptr`.
Useful for getting a cell type by name and then checking its attributes.
This commit is contained in:
Krystine Sherwin 2025-11-22 15:57:34 +13:00
parent 04092ea93d
commit 542a547c78
No known key found for this signature in database

View file

@ -334,6 +334,15 @@ struct CellTypes
cell_types.clear();
}
const CellType* get_cell(const RTLIL::IdString &type) const
{
auto it = cell_types.find(type);
if (it == cell_types.end())
return nullptr;
else
return &(it->second);
}
bool cell_known(const RTLIL::IdString &type) const
{
return cell_types.count(type) != 0;