mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-22 16:45:32 +00:00
Use ordered set for src attrs when flattening
This commit is contained in:
parent
1b1855353d
commit
3a67468860
3 changed files with 11 additions and 9 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <strstream>
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -688,7 +689,7 @@ string RTLIL::AttrObject::get_string_attribute(const RTLIL::IdString &id) const
|
|||
return value;
|
||||
}
|
||||
|
||||
void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
|
||||
void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data)
|
||||
{
|
||||
string attrval;
|
||||
for (const auto &s : data) {
|
||||
|
@ -699,17 +700,17 @@ void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const p
|
|||
set_string_attribute(id, attrval);
|
||||
}
|
||||
|
||||
void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
|
||||
void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data)
|
||||
{
|
||||
pool<string> union_data = get_strpool_attribute(id);
|
||||
std::set<string> union_data = get_strpool_attribute(id);
|
||||
union_data.insert(data.begin(), data.end());
|
||||
if (!union_data.empty())
|
||||
set_strpool_attribute(id, union_data);
|
||||
}
|
||||
|
||||
pool<string> RTLIL::AttrObject::get_strpool_attribute(const RTLIL::IdString &id) const
|
||||
std::set<string> RTLIL::AttrObject::get_strpool_attribute(const RTLIL::IdString &id) const
|
||||
{
|
||||
pool<string> data;
|
||||
std::set<string> data;
|
||||
if (attributes.count(id) != 0)
|
||||
for (auto s : split_tokens(get_string_attribute(id), "|"))
|
||||
data.insert(s);
|
||||
|
|
|
@ -855,9 +855,9 @@ struct RTLIL::AttrObject
|
|||
void set_string_attribute(const RTLIL::IdString& id, string value);
|
||||
string get_string_attribute(const RTLIL::IdString &id) const;
|
||||
|
||||
void set_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data);
|
||||
void add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data);
|
||||
pool<string> get_strpool_attribute(const RTLIL::IdString &id) const;
|
||||
void set_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data);
|
||||
void add_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data);
|
||||
std::set<string> get_strpool_attribute(const RTLIL::IdString &id) const;
|
||||
|
||||
void set_src_attribute(const std::string &src) {
|
||||
set_string_attribute(ID::src, src);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <set>
|
||||
|
||||
#include "simplemap.h"
|
||||
|
||||
|
@ -156,7 +157,7 @@ struct TechmapWorker
|
|||
}
|
||||
|
||||
std::string orig_cell_name;
|
||||
pool<string> extra_src_attrs = cell->get_strpool_attribute(ID::src);
|
||||
std::set<string> extra_src_attrs = cell->get_strpool_attribute(ID::src);
|
||||
|
||||
orig_cell_name = cell->name.str();
|
||||
for (auto tpl_cell : tpl->cells())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue