Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Error when localparam is assigned by constant function returning a nested struct #1149

Closed
veripoolbot opened this issue Mar 29, 2017 · 4 comments
Labels
resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Matt Myers
Original Redmine Issue: 1149 from https://www.veripool.org


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

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Matt Myers
Original Date: 2017-03-29T13:04:34Z


This file does not include my description above

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Matt Myers
Original Date: 2017-03-29T13:23:31Z


Here is sim_main.cpp

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-03-30T23:07:12Z


Thanks for the test, in general nested structures and parameters were messed up, as you guessed.

Fixed in git towards 3.902.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-04-02T12:53:25Z


In 3.902.

@veripoolbot veripoolbot added the resolution: fixed Closed; fixed label Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

1 participant