Add {get,set}_src_attribute() methods on RTLIL::AttrObject
authorClifford Wolf <clifford@clifford.at>
Wed, 30 Aug 2017 09:39:11 +0000 (11:39 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 30 Aug 2017 09:39:11 +0000 (11:39 +0200)
kernel/rtlil.cc
kernel/rtlil.h

index 4427303cc74548066231ffb9b8731b146c88cf51..f3522e30b11c037f25887279554a65434cb5f318 100644 (file)
@@ -234,6 +234,22 @@ pool<string> RTLIL::AttrObject::get_strpool_attribute(RTLIL::IdString id) const
        return data;
 }
 
+void RTLIL::AttrObject::set_src_attribute(const std::string &src)
+{
+       if (src.empty())
+               attributes.erase("\\src");
+       else
+               attributes["\\src"] = src;
+}
+
+std::string RTLIL::AttrObject::get_src_attribute() const
+{
+       std::string src;
+       if (attributes.count("\\src"))
+               src = attributes.at("\\src").decode_string();
+       return src;
+}
+
 bool RTLIL::Selection::selected_module(RTLIL::IdString mod_name) const
 {
        if (full_selection)
index be558932fb3202ab6b143948bdd3b25cecded5b4..31f7f9d31761f061fb9d8c948ba0471efaf49e02 100644 (file)
@@ -505,9 +505,13 @@ struct RTLIL::AttrObject
 
        void set_bool_attribute(RTLIL::IdString id);
        bool get_bool_attribute(RTLIL::IdString id) const;
+
        void set_strpool_attribute(RTLIL::IdString id, const pool<string> &data);
        void add_strpool_attribute(RTLIL::IdString id, const pool<string> &data);
        pool<string> get_strpool_attribute(RTLIL::IdString id) const;
+
+       void set_src_attribute(const std::string &src);
+       std::string get_src_attribute() const;
 };
 
 struct RTLIL::SigChunk