From e558905598617c901607a93e902d57f9a88f6da0 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 8 Jun 2020 19:02:48 +0000 Subject: RTLIL: use {get,set}_string_attribute in {get,set}_strpool_attribute. The only difference in behavior is that this removes the attribute when the pool becomes empty. --- kernel/rtlil.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kernel/rtlil.cc') diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 109113370..335c48456 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -319,7 +319,7 @@ void RTLIL::AttrObject::set_strpool_attribute(RTLIL::IdString id, const pool &data) @@ -334,7 +334,7 @@ pool RTLIL::AttrObject::get_strpool_attribute(RTLIL::IdString id) const { pool data; if (attributes.count(id) != 0) - for (auto s : split_tokens(attributes.at(id).decode_string(), "|")) + for (auto s : split_tokens(get_string_attribute(id), "|")) data.insert(s); return data; } -- cgit v1.2.3 From fbb346ea91a04f2feaf6fa96770fe0cd57020e75 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 4 Jun 2020 10:46:54 +0000 Subject: flatten: preserve original object names via hdlname attribute. --- kernel/rtlil.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'kernel/rtlil.cc') 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 RTLIL::AttrObject::get_strpool_attribute(RTLIL::IdString id) const return data; } +void RTLIL::AttrObject::set_hdlname_attribute(const vector &hierarchy) +{ + string attrval; + for (const auto &ident : hierarchy) { + if (!attrval.empty()) + attrval += " "; + attrval += ident; + } + set_string_attribute(ID::hdlname, attrval); +} + +vector 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) -- cgit v1.2.3