From: Eddie Hung Date: Wed, 13 Mar 2019 00:02:04 +0000 (+0000) Subject: verific_import() changes to avoid ElaborateAll() X-Git-Tag: yosys-0.9~143^2~6 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f1a4cc03ca7cd8970c0c9124c4644103505960e;p=yosys.git verific_import() changes to avoid ElaborateAll() --- diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index ed9727b88..b191c910d 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -46,6 +46,7 @@ USING_YOSYS_NAMESPACE #include "VeriModule.h" #include "VeriWrite.h" #include "VhdlUnits.h" +#include "HierTreeNode.h" #include "Message.h" #ifdef __clang__ @@ -1758,26 +1759,48 @@ void verific_import(Design *design, std::string top) std::set nl_todo, nl_done; - { - VhdlLibrary *vhdl_lib = vhdl_file::GetLibrary("work", 1); - VeriLibrary *veri_lib = veri_file::GetLibrary("work", 1); - - Array veri_libs, vhdl_libs; - if (vhdl_lib) vhdl_libs.InsertLast(vhdl_lib); - if (veri_lib) veri_libs.InsertLast(veri_lib); - - Array *netlists = hier_tree::ElaborateAll(&veri_libs, &vhdl_libs); - Netlist *nl; - int i; + VhdlLibrary *vhdl_lib = vhdl_file::GetLibrary("work", 1); + VeriLibrary *veri_lib = veri_file::GetLibrary("work", 1); + Array *netlists = NULL; + Array veri_libs, vhdl_libs; + if (vhdl_lib) vhdl_libs.InsertLast(vhdl_lib); + if (veri_lib) veri_libs.InsertLast(veri_lib); + + if (top.empty()) { + netlists = hier_tree::ElaborateAll(&veri_libs, &vhdl_libs); + } + else { + const Map *tree_tops = hier_tree::CreateHierarchicalTreeAll(&veri_libs, &vhdl_libs); + HierTreeNode *node = tree_tops ? static_cast(tree_tops->GetValue(top.c_str())) : NULL; + if (node) { + Map specific_tops(STRING_HASH); + specific_tops.Insert(top.c_str(), node); + + if (node->HasBindChild()) { + MapIter mi; + const char *key; + FOREACH_MAP_ITEM(tree_tops, mi, &key, &node) { + if (!node->IsPackage()) continue; + specific_tops.Insert(key, node); + } + } - FOREACH_ARRAY_ITEM(netlists, i, nl) { - if (top.empty() || nl->Owner()->Name() == top) - nl_todo.insert(nl); + netlists = hier_tree::GenerateNetlists(&specific_tops); } + hier_tree::DeleteHierarchicalTree(); + veri_file::DeleteInstantiatedClassValues(); + } - delete netlists; + Netlist *nl; + int i; + + FOREACH_ARRAY_ITEM(netlists, i, nl) { + if (top.empty() || nl->Owner()->Name() == top) + nl_todo.insert(nl); } + delete netlists; + if (!verific_error_msg.empty()) log_error("%s\n", verific_error_msg.c_str());