Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1149

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

Added by Matt Myers over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
TranslationError
% Done:

0%


Description

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

struct_param.sv (2.47 KB) Matt Myers, 03/29/2017 12:57 PM

struct_param.sv - Test file without comments (1.45 KB) Matt Myers, 03/29/2017 01:04 PM

sim_main.cpp View (261 Bytes) Matt Myers, 03/29/2017 01:23 PM

History

#1 Updated by Matt Myers over 2 years ago

#2 Updated by Matt Myers over 2 years ago

This file does not include my description above

#3 Updated by Matt Myers over 2 years ago

Here is sim_main.cpp

#4 Updated by Wilson Snyder over 2 years ago

  • Category changed from Configure/Make/Compiling to TranslationError
  • Status changed from New to Resolved

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

Fixed in git towards 3.902.

#5 Updated by Wilson Snyder over 2 years ago

  • Status changed from Resolved to Closed

In 3.902.

Also available in: Atom