3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-04 13:21:23 +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-02-21 16:10:51 +13:00
parent c1665ab416
commit 4883c503a8
No known key found for this signature in database

View file

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