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:
parent
04092ea93d
commit
542a547c78
1 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue