diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index dd6b788d0..2dd8aa095 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -58,6 +58,7 @@ USING_YOSYS_NAMESPACE #ifdef VERIFIC_VHDL_SUPPORT #include "vhdl_file.h" +#include "VhdlIdDef.h" #include "VhdlUnits.h" #include "NameSpace.h" #endif @@ -2759,7 +2760,7 @@ void import_all(const char* work, std::map *nl_todo, Map * #endif } -std::set import_tops(const char* work, std::map *nl_todo, Map *parameters, bool show_message, std::string ppfile YS_MAYBE_UNUSED, std::vector &tops) +std::set import_tops(const char* work, std::map *nl_todo, Map *parameters, bool show_message, std::string ppfile YS_MAYBE_UNUSED, std::vector &tops, std::string *top = nullptr) { std::set top_mod_names; Array *netlists = nullptr; @@ -2817,6 +2818,12 @@ std::set import_tops(const char* work, std::mapId()->OrigName()) != 0) { + top_mod_names.erase(name); + top_mod_names.insert(vhdl_unit->Id()->OrigName()); + if (top && *top == name) + *top = vhdl_unit->Id()->OrigName(); + } continue; } #endif @@ -2957,7 +2964,7 @@ std::string verific_import(Design *design, const std::map