aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/rtlil.cc5
-rw-r--r--kernel/rtlil.h10
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_); }