diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-03-13 00:02:04 +0000 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-05-03 20:53:25 +0200 |
commit | 0f1a4cc03ca7cd8970c0c9124c4644103505960e (patch) | |
tree | adff761b842c08c0d4798c48852cfc0fd944b5e3 /frontends | |
parent | f170fb6383477af453ca90ce4f67102e98b03f6e (diff) | |
download | yosys-0f1a4cc03ca7cd8970c0c9124c4644103505960e.tar.gz yosys-0f1a4cc03ca7cd8970c0c9124c4644103505960e.tar.bz2 yosys-0f1a4cc03ca7cd8970c0c9124c4644103505960e.zip |
verific_import() changes to avoid ElaborateAll()
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/verific/verific.cc | 53 |
1 files changed, 38 insertions, 15 deletions
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<Netlist*> 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<HierTreeNode*>(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()); |