mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03: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:
parent
c1665ab416
commit
4883c503a8
1 changed files with 9 additions and 0 deletions
|
@ -331,6 +331,15 @@ struct CellTypes
|
||||||
cell_types.clear();
|
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
|
bool cell_known(RTLIL::IdString type) const
|
||||||
{
|
{
|
||||||
return cell_types.count(type) != 0;
|
return cell_types.count(type) != 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue