mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 01:54:10 +00:00
Merge pull request #2088 from rswarbrick/count-at
Minor optimisation in Module::wire() and Module::cell()
This commit is contained in:
commit
02bb52eef1
|
@ -1134,8 +1134,14 @@ public:
|
||||||
return design->selected_member(name, member->name);
|
return design->selected_member(name, member->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLIL::Wire* wire(RTLIL::IdString id) { return wires_.count(id) ? wires_.at(id) : nullptr; }
|
RTLIL::Wire* wire(RTLIL::IdString id) {
|
||||||
RTLIL::Cell* cell(RTLIL::IdString id) { return cells_.count(id) ? cells_.at(id) : nullptr; }
|
auto it = wires_.find(id);
|
||||||
|
return it == wires_.end() ? nullptr : it->second;
|
||||||
|
}
|
||||||
|
RTLIL::Cell* cell(RTLIL::IdString id) {
|
||||||
|
auto it = cells_.find(id);
|
||||||
|
return it == cells_.end() ? nullptr : it->second;
|
||||||
|
}
|
||||||
|
|
||||||
RTLIL::ObjRange<RTLIL::Wire*> wires() { return RTLIL::ObjRange<RTLIL::Wire*>(&wires_, &refcount_wires_); }
|
RTLIL::ObjRange<RTLIL::Wire*> wires() { return RTLIL::ObjRange<RTLIL::Wire*>(&wires_, &refcount_wires_); }
|
||||||
RTLIL::ObjRange<RTLIL::Cell*> cells() { return RTLIL::ObjRange<RTLIL::Cell*>(&cells_, &refcount_cells_); }
|
RTLIL::ObjRange<RTLIL::Cell*> cells() { return RTLIL::ObjRange<RTLIL::Cell*>(&cells_, &refcount_cells_); }
|
||||||
|
|
Loading…
Reference in a new issue