diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-04-20 20:51:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-20 20:51:54 +0200 |
commit | f84a84e3f1a27b361c21fcd30fcf50c1a6586629 (patch) | |
tree | 2d6b8acf72eead2e314295326d567e17e0c66871 /kernel/rtlil.cc | |
parent | e3687f6f4e10789223213949b8490bd83ec285f2 (diff) | |
parent | f3ad8d680a3195ab9525b0a8b3f8dbff9d5e6e24 (diff) | |
download | yosys-f84a84e3f1a27b361c21fcd30fcf50c1a6586629.tar.gz yosys-f84a84e3f1a27b361c21fcd30fcf50c1a6586629.tar.bz2 yosys-f84a84e3f1a27b361c21fcd30fcf50c1a6586629.zip |
Merge pull request #943 from YosysHQ/clifford/whitebox
[WIP] Add "whitebox" attribute, add "read_verilog -wb"
Diffstat (limited to 'kernel/rtlil.cc')
-rw-r--r-- | kernel/rtlil.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 9ae20a317..f6f08bb9e 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -207,9 +207,12 @@ bool RTLIL::Const::is_fully_undef() const return true; } -void RTLIL::AttrObject::set_bool_attribute(RTLIL::IdString id) +void RTLIL::AttrObject::set_bool_attribute(RTLIL::IdString id, bool value) { - attributes[id] = RTLIL::Const(1); + if (value) + attributes[id] = RTLIL::Const(1); + else if (attributes.count(id)) + attributes.erase(id); } bool RTLIL::AttrObject::get_bool_attribute(RTLIL::IdString id) const @@ -589,7 +592,7 @@ std::vector<RTLIL::Module*> RTLIL::Design::selected_modules() const std::vector<RTLIL::Module*> result; result.reserve(modules_.size()); for (auto &it : modules_) - if (selected_module(it.first) && !it.second->get_bool_attribute("\\blackbox")) + if (selected_module(it.first) && !it.second->get_blackbox_attribute()) result.push_back(it.second); return result; } @@ -599,7 +602,7 @@ std::vector<RTLIL::Module*> RTLIL::Design::selected_whole_modules() const std::vector<RTLIL::Module*> result; result.reserve(modules_.size()); for (auto &it : modules_) - if (selected_whole_module(it.first) && !it.second->get_bool_attribute("\\blackbox")) + if (selected_whole_module(it.first) && !it.second->get_blackbox_attribute()) result.push_back(it.second); return result; } @@ -609,7 +612,7 @@ std::vector<RTLIL::Module*> RTLIL::Design::selected_whole_modules_warn() const std::vector<RTLIL::Module*> result; result.reserve(modules_.size()); for (auto &it : modules_) - if (it.second->get_bool_attribute("\\blackbox")) + if (it.second->get_blackbox_attribute()) continue; else if (selected_whole_module(it.first)) result.push_back(it.second); |