diff options
author | Zachary Snow <zach@zachjs.com> | 2021-03-24 11:23:23 -0400 |
---|---|---|
committer | Zachary Snow <zachary.j.snow@gmail.com> | 2021-03-25 10:44:08 -0400 |
commit | d6d5c2ef342240bd8adb925055667d140cb8dd29 (patch) | |
tree | 069932d678d17ea40892c14786ef8faa1f15701c /kernel | |
parent | 4762ed90ff6d3f1e9342fd306f97cae91960e2bd (diff) | |
download | yosys-d6d5c2ef342240bd8adb925055667d140cb8dd29.tar.gz yosys-d6d5c2ef342240bd8adb925055667d140cb8dd29.tar.bz2 yosys-d6d5c2ef342240bd8adb925055667d140cb8dd29.zip |
rtlil: add const accessors for modules, wires, and cells
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtlil.cc | 5 | ||||
-rw-r--r-- | kernel/rtlil.h | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 87cbaa0d5..770405720 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -580,6 +580,11 @@ RTLIL::Module *RTLIL::Design::module(RTLIL::IdString name) return modules_.count(name) ? modules_.at(name) : NULL; } +const RTLIL::Module *RTLIL::Design::module(RTLIL::IdString name) const +{ + return modules_.count(name) ? modules_.at(name) : NULL; +} + RTLIL::Module *RTLIL::Design::top_module() { RTLIL::Module *module = nullptr; diff --git a/kernel/rtlil.h b/kernel/rtlil.h index bbdf355fa..3137deb00 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -1043,6 +1043,7 @@ struct RTLIL::Design RTLIL::ObjRange<RTLIL::Module*> modules(); RTLIL::Module *module(RTLIL::IdString name); + const RTLIL::Module *module(RTLIL::IdString name) const; RTLIL::Module *top_module(); bool has(RTLIL::IdString id) const { @@ -1191,6 +1192,15 @@ public: return it == cells_.end() ? nullptr : it->second; } + const RTLIL::Wire* wire(RTLIL::IdString id) const{ + auto it = wires_.find(id); + return it == wires_.end() ? nullptr : it->second; + } + const RTLIL::Cell* cell(RTLIL::IdString id) const { + 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::Cell*> cells() { return RTLIL::ObjRange<RTLIL::Cell*>(&cells_, &refcount_cells_); } |