diff options
author | whitequark <whitequark@whitequark.org> | 2020-06-04 10:46:54 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2020-06-08 20:19:41 +0000 |
commit | fbb346ea91a04f2feaf6fa96770fe0cd57020e75 (patch) | |
tree | 9cf9e3b9020ae24cc9f8219f9b985c8e3589f7a1 /kernel | |
parent | 8d821dbbdb3ba68d4cd0fdb0d5857e77725275b9 (diff) | |
download | yosys-fbb346ea91a04f2feaf6fa96770fe0cd57020e75.tar.gz yosys-fbb346ea91a04f2feaf6fa96770fe0cd57020e75.tar.bz2 yosys-fbb346ea91a04f2feaf6fa96770fe0cd57020e75.zip |
flatten: preserve original object names via hdlname attribute.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtlil.cc | 16 | ||||
-rw-r--r-- | kernel/rtlil.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 335c48456..b876862c8 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -339,6 +339,22 @@ pool<string> RTLIL::AttrObject::get_strpool_attribute(RTLIL::IdString id) const return data; } +void RTLIL::AttrObject::set_hdlname_attribute(const vector<string> &hierarchy) +{ + string attrval; + for (const auto &ident : hierarchy) { + if (!attrval.empty()) + attrval += " "; + attrval += ident; + } + set_string_attribute(ID::hdlname, attrval); +} + +vector<string> RTLIL::AttrObject::get_hdlname_attribute() const +{ + return split_tokens(get_string_attribute(ID::hdlname), " "); +} + bool RTLIL::Selection::selected_module(RTLIL::IdString mod_name) const { if (full_selection) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 86b4e25b6..f751bdce4 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -682,6 +682,9 @@ struct RTLIL::AttrObject std::string get_src_attribute() const { return get_string_attribute(ID::src); } + + void set_hdlname_attribute(const vector<string> &hierarchy); + vector<string> get_hdlname_attribute() const; }; struct RTLIL::SigChunk |