diff --git a/Changes b/Changes index 5f835040bf..dbdee17e6c 100644 --- a/Changes +++ b/Changes @@ -14,6 +14,7 @@ Verilator 5.015 devel **Minor:** * Add --no-trace-top to not trace top signals (#4412) (#4422). [Frans Skarman] +* Support recursive function calls (#3267). * Support assignments of packed values to stream expressions on queues (#4401). [Ryszard Rozak, Antmicro Ltd] * Support no-parentheses calls to static methods (#4432). [Krzysztof BoroĊski] * Support 'let'. diff --git a/src/V3Width.cpp b/src/V3Width.cpp index a24f573452..b6a58fceaa 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -5322,13 +5322,7 @@ class WidthVisitor final : public VNVisitor { // Grab width from the output variable (if it's a function) if (nodep->didWidth()) return; if (nodep->doingWidth()) { - if (nodep->classMethod()) { - UINFO(5, "Recursive method call: " << nodep); - } else { - UINFO(5, "Recursive function or task call: " << nodep); - nodep->v3warn(E_UNSUPPORTED, "Unsupported: Recursive function or task call: " - << nodep->prettyNameQ()); - } + UINFO(5, "Recursive function or task call: " << nodep); nodep->recursive(true); nodep->didWidth(true); return; diff --git a/test_regress/t/t_func_recurse.out b/test_regress/t/t_func_recurse.out deleted file mode 100644 index 81f9b9dde2..0000000000 --- a/test_regress/t/t_func_recurse.out +++ /dev/null @@ -1,6 +0,0 @@ -%Error-UNSUPPORTED: t/t_func_recurse.v:9:27: Unsupported: Recursive function or task call: 'recurse_self' - : ... In instance t - 9 | function automatic int recurse_self; - | ^~~~~~~~~~~~ - ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error: Exiting due to diff --git a/test_regress/t/t_func_recurse.pl b/test_regress/t/t_func_recurse.pl index be66c40e69..b46d46042d 100755 --- a/test_regress/t/t_func_recurse.pl +++ b/test_regress/t/t_func_recurse.pl @@ -11,13 +11,11 @@ scenarios(simulator => 1); compile( - fails => $Self->{vlt_all}, - expect_filename => $Self->{golden_filename}, ); execute( check_finished => 1, - ) if !$Self->{vlt_all}; + ); ok(1); 1; diff --git a/test_regress/t/t_func_recurse2.out b/test_regress/t/t_func_recurse2.out deleted file mode 100644 index b93b57e476..0000000000 --- a/test_regress/t/t_func_recurse2.out +++ /dev/null @@ -1,6 +0,0 @@ -%Error-UNSUPPORTED: t/t_func_recurse2.v:9:27: Unsupported: Recursive function or task call: 'recurse_1' - : ... In instance t - 9 | function automatic int recurse_1; - | ^~~~~~~~~ - ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error: Exiting due to diff --git a/test_regress/t/t_func_recurse2.pl b/test_regress/t/t_func_recurse2.pl index be66c40e69..b46d46042d 100755 --- a/test_regress/t/t_func_recurse2.pl +++ b/test_regress/t/t_func_recurse2.pl @@ -11,13 +11,11 @@ scenarios(simulator => 1); compile( - fails => $Self->{vlt_all}, - expect_filename => $Self->{golden_filename}, ); execute( check_finished => 1, - ) if !$Self->{vlt_all}; + ); ok(1); 1; diff --git a/test_regress/t/t_func_recurse_param.out b/test_regress/t/t_func_recurse_param.out index 102d49d6f0..ba95348dcd 100644 --- a/test_regress/t/t_func_recurse_param.out +++ b/test_regress/t/t_func_recurse_param.out @@ -1,8 +1,3 @@ -%Error-UNSUPPORTED: t/t_func_recurse_param.v:9:27: Unsupported: Recursive function or task call: 'recurse_self' - : ... In instance t - 9 | function automatic int recurse_self; - | ^~~~~~~~~~~~ - ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: t/t_func_recurse_param.v:15:26: Expecting expression to be constant, but can't determine constant for FUNCREF 'recurse_self' : ... In instance t t/t_func_recurse_param.v:9:27: ... Location of non-constant FUNC 'recurse_self': Unsupported: Recursive constant functions diff --git a/test_regress/t/t_func_recurse_param_bad.out b/test_regress/t/t_func_recurse_param_bad.out index 121ee90f9f..7ec6868420 100644 --- a/test_regress/t/t_func_recurse_param_bad.out +++ b/test_regress/t/t_func_recurse_param_bad.out @@ -1,8 +1,3 @@ -%Error-UNSUPPORTED: t/t_func_recurse_param_bad.v:9:27: Unsupported: Recursive function or task call: 'recurse_self' - : ... In instance t - 9 | function automatic int recurse_self; - | ^~~~~~~~~~~~ - ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: t/t_func_recurse_param_bad.v:15:26: Expecting expression to be constant, but can't determine constant for FUNCREF 'recurse_self' : ... In instance t t/t_func_recurse_param_bad.v:9:27: ... Location of non-constant FUNC 'recurse_self': Unsupported: Recursive constant functions diff --git a/test_regress/t/t_uvm_pkg_todo.vh b/test_regress/t/t_uvm_pkg_todo.vh index be8852449f..7f7c8b0755 100644 --- a/test_regress/t/t_uvm_pkg_todo.vh +++ b/test_regress/t/t_uvm_pkg_todo.vh @@ -765,10 +765,8 @@ function void uvm_report_fatal(string id, uvm_coreservice_t cs; cs = uvm_coreservice_t::get(); top = cs.get_root(); -//TODO issue #3267 - Support recursive functions -//TODO %Error-UNSUPPORTED: t/t_uvm_pkg_todo.vh:753:15: Unsupported: Recursive function or task call: 'uvm_report_fatal' -//TODO top.uvm_report_fatal(id, message, verbosity, filename, line, context_name, -//TODO report_enabled_checked); + top.uvm_report_fatal(id, message, verbosity, filename, line, context_name, + report_enabled_checked); endfunction function void uvm_process_report_message(uvm_report_message report_message); uvm_root top;