aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-10-07 19:48:42 +0200
committerClifford Wolf <clifford@clifford.at>2018-10-07 19:48:55 +0200
commit9850de405a11fe93e4562c86be0a0830b83c2785 (patch)
treebc60a2625efccaaab3fd5e548e0701179be84fd9
parented1f0b25770ee7a1f475f9aa261145c984af29fb (diff)
downloadyosys-9850de405a11fe93e4562c86be0a0830b83c2785.tar.gz
yosys-9850de405a11fe93e4562c86be0a0830b83c2785.tar.bz2
yosys-9850de405a11fe93e4562c86be0a0830b83c2785.zip
Improve Verific importer blackbox handling
Signed-off-by: Clifford Wolf <clifford@clifford.at>
-rw-r--r--frontends/verific/verific.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc
index 06d98611a..dba3b0f0c 100644
--- a/frontends/verific/verific.cc
+++ b/frontends/verific/verific.cc
@@ -118,6 +118,18 @@ RTLIL::SigBit VerificImporter::net_map_at(Net *net)
return net_map.at(net);
}
+bool is_blackbox(Netlist *nl)
+{
+ if (nl->IsBlackBox())
+ return true;
+
+ const char *attr = nl->GetAttValue("blackbox");
+ if (attr != nullptr && strcmp(attr, "0"))
+ return true;
+
+ return false;
+}
+
void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &attributes, DesignObj *obj)
{
MapIter mi;
@@ -709,7 +721,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::se
netlist = nl;
if (design->has(module_name)) {
- if (!nl->IsOperator())
+ if (!nl->IsOperator() && !is_blackbox(nl))
log_cmd_error("Re-definition of module `%s'.\n", nl->Owner()->Name());
return;
}
@@ -718,7 +730,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::se
module->name = module_name;
design->add(module);
- if (nl->IsBlackBox()) {
+ if (is_blackbox(nl)) {
log("Importing blackbox module %s.\n", RTLIL::id2cstr(module->name));
module->set_bool_attribute("\\blackbox");
} else {