Merge pull request #3979 from jix/verific-L-handling

This commit is contained in:
Jannis Harder 2023-10-03 16:43:52 +02:00 committed by GitHub
commit aeb742b8b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 10 deletions

View File

@ -3063,6 +3063,7 @@ struct VerificPass : public Pass {
int argidx = 1; int argidx = 1;
std::string work = "work"; std::string work = "work";
bool is_work_set = false; bool is_work_set = false;
(void)is_work_set;
veri_file::RegisterCallBackVerificStream(&verific_read_cb); veri_file::RegisterCallBackVerificStream(&verific_read_cb);
if (GetSize(args) > argidx && (args[argidx] == "-set-error" || args[argidx] == "-set-warning" || if (GetSize(args) > argidx && (args[argidx] == "-set-error" || args[argidx] == "-set-warning" ||
@ -3140,7 +3141,20 @@ struct VerificPass : public Pass {
} }
veri_file::RemoveAllLOptions(); veri_file::RemoveAllLOptions();
veri_file::AddLOption("work"); for (int i = argidx; i < GetSize(args); i++)
{
if (args[i] == "-work" && i+1 < GetSize(args)) {
work = args[++i];
is_work_set = true;
continue;
}
if (args[i] == "-L" && i+1 < GetSize(args)) {
++i;
continue;
}
break;
}
veri_file::AddLOption(work.c_str());
for (int i = argidx; i < GetSize(args); i++) for (int i = argidx; i < GetSize(args); i++)
{ {
if (args[i] == "-work" && i+1 < GetSize(args)) { if (args[i] == "-work" && i+1 < GetSize(args)) {
@ -3148,7 +3162,7 @@ struct VerificPass : public Pass {
continue; continue;
} }
if (args[i] == "-L" && i+1 < GetSize(args)) { if (args[i] == "-L" && i+1 < GetSize(args)) {
if (args[++i] == "work") if (args[++i] == work)
veri_file::RemoveAllLOptions(); veri_file::RemoveAllLOptions();
continue; continue;
} }
@ -3641,7 +3655,7 @@ struct VerificPass : public Pass {
if (module_name && module_name->IsHierName()) { if (module_name && module_name->IsHierName()) {
VeriName *prefix = module_name->GetPrefix() ; VeriName *prefix = module_name->GetPrefix() ;
const char *lib_name = (prefix) ? prefix->GetName() : 0 ; const char *lib_name = (prefix) ? prefix->GetName() : 0 ;
if (!Strings::compare("work", lib_name)) lib = veri_file::GetLibrary(lib_name, 1) ; if (work != lib_name) lib = veri_file::GetLibrary(lib_name, 1) ;
} }
if (lib && module_name) if (lib && module_name)
top_mod_names.insert(lib->GetModule(module_name->GetName(), 1)->GetName()); top_mod_names.insert(lib->GetModule(module_name->GetName(), 1)->GetName());
@ -3663,13 +3677,19 @@ struct VerificPass : public Pass {
log_error("Can't find module/unit '%s'.\n", name); log_error("Can't find module/unit '%s'.\n", name);
} }
if (veri_lib) {
// Also elaborate all root modules since they may contain bind statements const char *lib_name = nullptr;
MapIter mi; SetIter si;
VeriModule *veri_module; FOREACH_SET_ITEM(veri_file::GetAllLOptions(), si, &lib_name) {
FOREACH_VERILOG_MODULE_IN_LIBRARY(veri_lib, mi, veri_module) { VeriLibrary* veri_lib = veri_file::GetLibrary(lib_name, 0);
if (!veri_module->IsRootModule()) continue; if (veri_lib) {
veri_modules.InsertLast(veri_module); // Also elaborate all root modules since they may contain bind statements
MapIter mi;
VeriModule *veri_module;
FOREACH_VERILOG_MODULE_IN_LIBRARY(veri_lib, mi, veri_module) {
if (!veri_module->IsRootModule()) continue;
veri_modules.InsertLast(veri_module);
}
} }
} }