From cc829031ffabf2a8d16d968c701e44db992d643f Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 28 Dec 2023 15:06:20 -0800 Subject: [PATCH] Elaborate system elab tasks in gen blocks --- elaborate.cc | 39 ++++++++++++++++++--------------- ivtest/ivltests/br_gh1029.v | 8 +++++++ ivtest/regress-vvp.list | 1 + ivtest/vvp_tests/br_gh1029.json | 5 +++++ 4 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 ivtest/ivltests/br_gh1029.v create mode 100644 ivtest/vvp_tests/br_gh1029.json diff --git a/elaborate.cc b/elaborate.cc index 1467fa7f1..57ad0c5bb 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -6821,26 +6821,29 @@ bool PGenerate::elaborate_direct_(Design*des, NetScope*container) const bool PGenerate::elaborate_(Design*des, NetScope*scope) const { - elaborate_functions(des, scope, funcs); - elaborate_tasks(des, scope, tasks); - - typedef list::const_iterator gates_it_t; - for (gates_it_t cur = gates.begin() ; cur != gates.end() ; ++ cur ) - (*cur)->elaborate(des, scope); - - elaborate_var_inits_(des, scope); - - typedef list::const_iterator proc_it_t; - for (proc_it_t cur = behaviors.begin(); cur != behaviors.end(); ++ cur ) - (*cur)->elaborate(des, scope); - - typedef list::const_iterator generate_it_t; - for (generate_it_t cur = generate_schemes.begin() - ; cur != generate_schemes.end() ; ++ cur ) { - (*cur)->elaborate(des, scope); + // Elaborate the elaboration tasks. + bool result_flag = true; + for (const auto et : elab_tasks) { + result_flag &= et->elaborate_elab(des, scope); + // Only elaborate until a fatal elab task. + if (!result_flag) break; } - return true; + // If there are no fatal elab tasks then elaborate the rest. + if (result_flag) { + elaborate_functions(des, scope, funcs); + elaborate_tasks(des, scope, tasks); + + for (const auto gt : gates) gt->elaborate(des, scope); + + elaborate_var_inits_(des, scope); + + for (const auto bh : behaviors) bh->elaborate(des, scope); + + for (const auto gs : generate_schemes) gs->elaborate(des, scope); + } + + return result_flag; } bool PScope::elaborate_behaviors_(Design*des, NetScope*scope) const diff --git a/ivtest/ivltests/br_gh1029.v b/ivtest/ivltests/br_gh1029.v new file mode 100644 index 000000000..fc3fd8c15 --- /dev/null +++ b/ivtest/ivltests/br_gh1029.v @@ -0,0 +1,8 @@ +module test; + if (1) begin + $error("This is before the fatal so it should display."); + $fatal(0, "This should be a fatal elaboration error."); + $error("This should not display since is after the fatal."); + end + initial $fatal(0, "FAILED elaboration assertion."); +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index 009eb69c0..81a6d9fec 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -24,6 +24,7 @@ br_gh383d vvp_tests/br_gh383d.json br_gh440 vvp_tests/br_gh440.json br_gh939 vvp_tests/br_gh939.json br_gh1018 vvp_tests/br_gh1018.json +br_gh1029 vvp_tests/br_gh1029.json ca_time_real` vvp_tests/ca_time_real.json case1 vvp_tests/case1.json case2 vvp_tests/case2.json diff --git a/ivtest/vvp_tests/br_gh1029.json b/ivtest/vvp_tests/br_gh1029.json new file mode 100644 index 000000000..4c9f6cf01 --- /dev/null +++ b/ivtest/vvp_tests/br_gh1029.json @@ -0,0 +1,5 @@ +{ + "type" : "CE", + "source" : "br_gh1029.v", + "iverilog-args" : [ "-g2009" ] +}