Internal Error when localparam is assigned by constant function returning a nested struct
The attached example shows a localparam assigned by a constant function which returns a nested struct.
The code results in the following Verilator error:
%Error: Internal Error: ../V3Number.cpp:641: toUQuad with 4-state 32'bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
There are two tweaks that cause the code to work: 1) Get rid of the nested struct (`define USE_FLAT), or 2) Keep the nested struct but leave only 1 element in the nested struct (`define ONE_FIELD)
In a larger system, this incompatibility is not actually causing a compile error, but it is causing a problem where a generate statement that uses this nested struct field as an upper bound on a for loop is not iterating properly. I got this Internal Error when trying to create a small test case.
Run the test with: verilator +1800-2012ext+sv -Wall --cc struct_param.sv --exe sim_main.cpp --top-module struct_test; make -j -C obj_dir -f Vstruct_test.mk Vstruct_test; obj_dir/Vstruct_test
Also available in: Atom