Skip to content

Commit

Permalink
Support recursive function calls (verilator#3267).
Browse files Browse the repository at this point in the history
  • Loading branch information
wsnyder committed Sep 16, 2023
1 parent 26ed2a0 commit aa60847
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 39 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down
8 changes: 1 addition & 7 deletions src/V3Width.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions test_regress/t/t_func_recurse.out

This file was deleted.

4 changes: 1 addition & 3 deletions test_regress/t/t_func_recurse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 0 additions & 6 deletions test_regress/t/t_func_recurse2.out

This file was deleted.

4 changes: 1 addition & 3 deletions test_regress/t/t_func_recurse2.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
5 changes: 0 additions & 5 deletions test_regress/t/t_func_recurse_param.out
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 0 additions & 5 deletions test_regress/t/t_func_recurse_param_bad.out
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 2 additions & 4 deletions test_regress/t/t_uvm_pkg_todo.vh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit aa60847

Please sign in to comment.