Skip to content

Commit 3ea54ec

Browse files
eddiehungcliffordwolf
authored andcommitted
Fix verific_parameters construction, use attribute to mark top netlists
1 parent a27b42e commit 3ea54ec

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

frontends/verific/verific.cc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,9 @@ void VerificImporter::merge_past_ffs(pool<RTLIL::Cell*> &candidates)
775775
merge_past_ffs_clock(it.second, it.first.first, it.first.second);
776776
}
777777

778-
void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::set<Netlist*> &nl_todo, bool top)
778+
void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::set<Netlist*> &nl_todo)
779779
{
780-
std::string netlist_name = top ? nl->CellBaseName() : nl->Owner()->Name();
780+
std::string netlist_name = nl->GetAtt(" \\top") ? nl->CellBaseName() : nl->Owner()->Name();
781781
std::string module_name = nl->IsOperator() ? "$verific$" + netlist_name : RTLIL::escape_id(netlist_name);
782782

783783
netlist = nl;
@@ -1768,7 +1768,7 @@ void verific_import(Design *design, const std::map<std::string,std::string> &par
17681768
if (veri_lib) veri_libs.InsertLast(veri_lib);
17691769

17701770
Map verific_params(STRING_HASH);
1771-
for (auto i : parameters)
1771+
for (const auto &i : parameters)
17721772
verific_params.Insert(i.first.c_str(), i.second.c_str());
17731773

17741774
if (top.empty()) {
@@ -1800,8 +1800,10 @@ void verific_import(Design *design, const std::map<std::string,std::string> &par
18001800
int i;
18011801

18021802
FOREACH_ARRAY_ITEM(netlists, i, nl) {
1803-
if (top.empty() || nl->CellBaseName() == top)
1804-
nl_todo.insert(nl);
1803+
if (top.empty() && nl->CellBaseName() != top)
1804+
continue;
1805+
nl->AddAtt(new Att(" \\top", NULL));
1806+
nl_todo.insert(nl);
18051807
}
18061808

18071809
delete netlists;
@@ -1817,7 +1819,7 @@ void verific_import(Design *design, const std::map<std::string,std::string> &par
18171819
Netlist *nl = *nl_todo.begin();
18181820
if (nl_done.count(nl) == 0) {
18191821
VerificImporter importer(false, false, false, false, false, false);
1820-
importer.import_netlist(design, nl, nl_todo, nl->CellBaseName() == top);
1822+
importer.import_netlist(design, nl, nl_todo);
18211823
}
18221824
nl_todo.erase(nl);
18231825
nl_done.insert(nl);
@@ -2322,8 +2324,10 @@ struct VerificPass : public Pass {
23222324
Netlist *nl;
23232325
int i;
23242326

2325-
FOREACH_ARRAY_ITEM(netlists, i, nl)
2327+
FOREACH_ARRAY_ITEM(netlists, i, nl) {
2328+
nl->AddAtt(new Att(" \\top", NULL));
23262329
nl_todo.insert(nl);
2330+
}
23272331
delete netlists;
23282332
}
23292333

frontends/verific/verific.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct VerificImporter
9393
void merge_past_ffs_clock(pool<RTLIL::Cell*> &candidates, SigBit clock, bool clock_pol);
9494
void merge_past_ffs(pool<RTLIL::Cell*> &candidates);
9595

96-
void import_netlist(RTLIL::Design *design, Verific::Netlist *nl, std::set<Verific::Netlist*> &nl_todo, bool top=false);
96+
void import_netlist(RTLIL::Design *design, Verific::Netlist *nl, std::set<Verific::Netlist*> &nl_todo);
9797
};
9898

9999
void verific_import_sva_assert(VerificImporter *importer, Verific::Instance *inst);

0 commit comments

Comments
 (0)