You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue Description:
Verilator throws a compilation error when calling a function with a cross-module reference that includes a $fatal statement. The error only occurs when $fatal is present; otherwise, the code compiles without issues.
Example Code:
moduleDUT;
function automatic intfind_elem(int elem, int array[]);
int index;
index = array.find_first_index(x) with (x == elem);
if (index ==-1) begin$fatal(1, "Element not found in array");
endreturn index;
endfunctionendmodulemoduleTestbench;
DUTdut();
initialbegin int array[] ='{5, 4, 3, 2, 1};
int index = dut.find_elem(2, array);
endendmodule
Verilator Command:
verilator test.sv --cc --exe --binary --main
Error Message:
In file included from Vtest__ALL.cpp:8:
Vtest___024root__DepSet_h9b2d61ff__0__Slow.cpp: In function ‘void Vtest___024root___eval_initial__TOP(Vtest___024root*)’:
Vtest___024root__DepSet_h9b2d61ff__0__Slow.cpp:31:81: error: cannot convert ‘VlQueue<unsigned int>’ to ‘IData’ {aka ‘unsigned int’} in assignment
31 | = __Vfunc_Testbench__DOT__dut__DOT__find_elem__0__array.find_first_index(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
| |
| VlQueue<unsigned int>
32 | [&](
| ~~~~
33 | IData/*31:0*/ x__DOT__index,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 | IData/*31:0*/ x) {
| ~~~~~~~~~~~~~~~~~~
35 | return ((2U == x));
| ~~~~~~~~~~~~~~~~~~~
36 | }
| ~
37 | );
| ~
wsnyder
added
area: lint
Issue involves SystemVerilog lint checking
status: ready
Issue is ready for someone to fix; then goes to 'status: assigned'
and removed
new
New issue not seen by maintainers
labels
Oct 29, 2024
wsnyder
changed the title
Compile error with with clause in cross-module function call
Fix to lint error on queue compared to int
Oct 29, 2024
Issue Description:
Verilator throws a compilation error when calling a function with a cross-module reference that includes a
$fatal
statement. The error only occurs when$fatal
is present; otherwise, the code compiles without issues.Example Code:
Verilator Command:
Error Message:
Verilator Version:
Verilator 5.031 (devel) rev v5.030-1-g68e0cf552 (git master)
OS and Distribution:
WSL Ubuntu 22.04.4
Additional Notes:
$fatal
eliminates the issue.The text was updated successfully, but these errors were encountered: