diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index 58a29ada4..a05fd29b5 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -775,9 +775,9 @@ void VerificImporter::merge_past_ffs(pool &candidates) merge_past_ffs_clock(it.second, it.first.first, it.first.second); } -void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::set &nl_todo, bool top) +void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::set &nl_todo) { - std::string netlist_name = top ? nl->CellBaseName() : nl->Owner()->Name(); + std::string netlist_name = nl->GetAtt(" \\top") ? nl->CellBaseName() : nl->Owner()->Name(); std::string module_name = nl->IsOperator() ? "$verific$" + netlist_name : RTLIL::escape_id(netlist_name); netlist = nl; @@ -1768,7 +1768,7 @@ void verific_import(Design *design, const std::map &par if (veri_lib) veri_libs.InsertLast(veri_lib); Map verific_params(STRING_HASH); - for (auto i : parameters) + for (const auto &i : parameters) verific_params.Insert(i.first.c_str(), i.second.c_str()); if (top.empty()) { @@ -1800,8 +1800,10 @@ void verific_import(Design *design, const std::map &par int i; FOREACH_ARRAY_ITEM(netlists, i, nl) { - if (top.empty() || nl->CellBaseName() == top) - nl_todo.insert(nl); + if (top.empty() && nl->CellBaseName() != top) + continue; + nl->AddAtt(new Att(" \\top", NULL)); + nl_todo.insert(nl); } delete netlists; @@ -1817,7 +1819,7 @@ void verific_import(Design *design, const std::map &par Netlist *nl = *nl_todo.begin(); if (nl_done.count(nl) == 0) { VerificImporter importer(false, false, false, false, false, false); - importer.import_netlist(design, nl, nl_todo, nl->CellBaseName() == top); + importer.import_netlist(design, nl, nl_todo); } nl_todo.erase(nl); nl_done.insert(nl); @@ -2322,8 +2324,10 @@ struct VerificPass : public Pass { Netlist *nl; int i; - FOREACH_ARRAY_ITEM(netlists, i, nl) + FOREACH_ARRAY_ITEM(netlists, i, nl) { + nl->AddAtt(new Att(" \\top", NULL)); nl_todo.insert(nl); + } delete netlists; } diff --git a/frontends/verific/verific.h b/frontends/verific/verific.h index fb44b1736..88a6cc0ba 100644 --- a/frontends/verific/verific.h +++ b/frontends/verific/verific.h @@ -93,7 +93,7 @@ struct VerificImporter void merge_past_ffs_clock(pool &candidates, SigBit clock, bool clock_pol); void merge_past_ffs(pool &candidates); - void import_netlist(RTLIL::Design *design, Verific::Netlist *nl, std::set &nl_todo, bool top=false); + void import_netlist(RTLIL::Design *design, Verific::Netlist *nl, std::set &nl_todo); }; void verific_import_sva_assert(VerificImporter *importer, Verific::Instance *inst);