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 #821

Is an indexed element into a parameter array a constant?

Added by Iztok Jeras over 4 years ago. Updated over 4 years ago.

Status:
Feature
Priority:
Normal
Assignee:
-
Category:
Unsupported
% Done:

0%


Description

I wrote an RISC-V disassembler in SystemVerilog.

https://github.com/jeras/riscv_asm_sv

Verilator is actually not the primary target, but it would be useful to have it supported. The API component is a function accepting as input a 32bit instruction and providing as output a disassembled string. Instructions are listed in a parameter, which is an array of structures. The given binary code is compared (wildcard equivalence) against elements of the parameter in a for loop. Verilator complains that an indexed element of the array is not a constant. This is kind of synthesizable code, but the purpose is obviously for it to be part of a bench. Since this is probably not trivial to fix, I do not expect a solution soon.

Interestingly the ? operator does not work correctly in ncsim, while it works well in ModelSim. I was surprised to see it properly implemented in Verilator.

Related to the same example is the support for the $sformatf and related system tasks/functions.

$ verilator --lint-only riscv_asm.sv %Error: riscv_asm.sv:46: Unsupported tristate construct: INITARRAY %Error: riscv_asm.sv:240: Unsupported: RHS of ? or !=? must be constant to be synthesizable %Error: Exiting due to 2 error(s) %Error: See the manual and http://www.veripool.org/verilator for more assistance. %Error: Command Failed /usr/local/bin/verilator_bin --lint-only riscv_asm.sv

Regards, Iztok Jeras

History

#1 Updated by Wilson Snyder over 4 years ago

  • Category set to Unsupported
  • Status changed from New to Feature

Looked at this a bit and it is not easy because Verilator removes all tristates (wildcards in this case) at compile time.

Also available in: Atom