Skip to content

Commit 7d4aff6

Browse files
committed
verific: Disable module existence check during static elaboration
1 parent 2ca611b commit 7d4aff6

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

frontends/verific/verific.cc

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,11 +2688,51 @@ struct VerificExtNets
26882688
}
26892689
};
26902690

2691+
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
2692+
static msg_type_t prev_1063;
2693+
#endif
2694+
#ifdef VERIFIC_VHDL_SUPPORT
2695+
static msg_type_t prev_1240 ;
2696+
static msg_type_t prev_1241 ;
2697+
#endif
2698+
void save_blackbox_msg_state()
2699+
{
2700+
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
2701+
prev_1063 = Message::GetMessageType("VERI-1063") ;
2702+
Message::SetMessageType("VERI-1063", VERIFIC_INFO);
2703+
#endif
2704+
#ifdef VERIFIC_VHDL_SUPPORT
2705+
prev_1240 = Message::GetMessageType("VHDL-1240") ;
2706+
prev_1241 = Message::GetMessageType("VHDL-1241") ;
2707+
Message::SetMessageType("VHDL-1240", VERIFIC_INFO);
2708+
Message::SetMessageType("VHDL-1241", VERIFIC_INFO);
2709+
#endif
2710+
}
2711+
2712+
void restore_blackbox_msg_state()
2713+
{
2714+
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
2715+
Message::ClearMessageType("VERI-1063") ;
2716+
if (Message::GetMessageType("VERI-1063")!=prev_1063)
2717+
Message::SetMessageType("VERI-1063", prev_1063);
2718+
#endif
2719+
#ifdef VERIFIC_VHDL_SUPPORT
2720+
Message::ClearMessageType("VHDL-1240") ;
2721+
Message::ClearMessageType("VHDL-1241") ;
2722+
if (Message::GetMessageType("VHDL-1240")!=prev_1240)
2723+
Message::SetMessageType("VHDL-1240", prev_1240);
2724+
if (Message::GetMessageType("VHDL-1241")!=prev_1241)
2725+
Message::SetMessageType("VHDL-1241", prev_1241);
2726+
#endif
2727+
}
2728+
26912729
void import_all(const char* work, std::map<std::string,Netlist*> *nl_todo, Map *parameters, bool show_message, std::string ppfile YS_MAYBE_UNUSED)
26922730
{
26932731
#ifdef YOSYSHQ_VERIFIC_EXTENSIONS
2732+
save_blackbox_msg_state();
26942733
VerificExtensions::ElaborateAndRewrite(work, parameters);
26952734
verific_error_msg.clear();
2735+
restore_blackbox_msg_state();
26962736
#endif
26972737
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
26982738
if (!ppfile.empty())
@@ -2823,8 +2863,10 @@ std::set<std::string> import_tops(const char* work, std::map<std::string,Netlist
28232863

28242864
#ifdef YOSYSHQ_VERIFIC_EXTENSIONS
28252865
if (static_elaborate) {
2866+
save_blackbox_msg_state();
28262867
VerificExtensions::ElaborateAndRewrite(work, &veri_modules, &vhdl_units, parameters);
28272868
verific_error_msg.clear();
2869+
restore_blackbox_msg_state();
28282870
#endif
28292871
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
28302872
if (!ppfile.empty())
@@ -3290,10 +3332,8 @@ struct VerificPass : public Pass {
32903332
return filename;
32913333
}
32923334

3293-
#ifdef VERIFIC_VHDL_SUPPORT
3294-
msg_type_t prev_1240 ;
3295-
msg_type_t prev_1241 ;
32963335

3336+
#ifdef VERIFIC_VHDL_SUPPORT
32973337
void add_units_to_map(Map &map, std::string work, bool flag_lib)
32983338
{
32993339
MapIter mi ;
@@ -3306,11 +3346,7 @@ struct VerificPass : public Pass {
33063346
map.Insert(unit,unit);
33073347
}
33083348
}
3309-
3310-
prev_1240 = Message::GetMessageType("VHDL-1240") ;
3311-
prev_1241 = Message::GetMessageType("VHDL-1241") ;
3312-
Message::SetMessageType("VHDL-1240", VERIFIC_INFO);
3313-
Message::SetMessageType("VHDL-1241", VERIFIC_INFO);
3349+
save_blackbox_msg_state();
33143350
}
33153351

33163352
void set_units_to_blackbox(Map &map, std::string work, bool flag_lib)
@@ -3325,17 +3361,10 @@ struct VerificPass : public Pass {
33253361
unit->SetCompileAsBlackbox();
33263362
}
33273363
}
3328-
Message::ClearMessageType("VHDL-1240") ;
3329-
Message::ClearMessageType("VHDL-1241") ;
3330-
if (Message::GetMessageType("VHDL-1240")!=prev_1240)
3331-
Message::SetMessageType("VHDL-1240", prev_1240);
3332-
if (Message::GetMessageType("VHDL-1241")!=prev_1241)
3333-
Message::SetMessageType("VHDL-1241", prev_1241);
3334-
3364+
restore_blackbox_msg_state();
33353365
}
33363366
#endif
33373367

3338-
msg_type_t prev_1063;
33393368
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
33403369
void add_modules_to_map(Map &map, std::string work, bool flag_lib)
33413370
{
@@ -3349,9 +3378,7 @@ struct VerificPass : public Pass {
33493378
map.Insert(veri_module,veri_module);
33503379
}
33513380
}
3352-
3353-
prev_1063 = Message::GetMessageType("VERI-1063") ;
3354-
Message::SetMessageType("VERI-1063", VERIFIC_INFO);
3381+
save_blackbox_msg_state();
33553382
}
33563383

33573384
void set_modules_to_blackbox(Map &map, std::string work, bool flag_lib)
@@ -3366,9 +3393,6 @@ struct VerificPass : public Pass {
33663393
veri_module->SetCompileAsBlackbox();
33673394
}
33683395
}
3369-
Message::ClearMessageType("VERI-1063") ;
3370-
if (Message::GetMessageType("VERI-1063")!=prev_1063)
3371-
Message::SetMessageType("VERI-1063", prev_1063);
33723396
}
33733397
#endif
33743398

@@ -3424,7 +3448,6 @@ struct VerificPass : public Pass {
34243448
RuntimeFlags::SetVar("veri_preserve_assignments", 1);
34253449
RuntimeFlags::SetVar("veri_preserve_comments", 1);
34263450
RuntimeFlags::SetVar("veri_preserve_drivers", 1);
3427-
RuntimeFlags::SetVar("veri_create_empty_box", 1);
34283451

34293452
// Workaround for VIPER #13851
34303453
RuntimeFlags::SetVar("veri_create_name_for_unnamed_gen_block", 1);

0 commit comments

Comments
 (0)