Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Issue #1593

Parameter-resolved constants from interface components

Added by Ahmed Qureshi 12 days ago. Updated 12 days ago.

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

0%


Description

When doing something like this: localparam MY_WIDTH = $bits({my_intf.signal1, my_intf.signal2});

We get the following error: Parameter-resolved constants must not use dotted references

I imagine this checking is to avoid cross-module referencing, but for interfaces is this something that can be supported in a future release?

Thanks!

History

#1 Updated by Todd Strader 12 days ago

Yeah, I keep bumping into this one too. Verilator should be able to take $bits() of that signal in the same way that it can resolve parameters inside interfaces as constants. In the mean time, I'd suggest this instead:
localparam MY_WIDTH = my_intf.SIGNAL1_SIZE + my_intf.SIGNAL2_SIZE;

Presuming that those are the parameters inside the interface used to size your signals.

#2 Updated by Wilson Snyder 12 days ago

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

I think it's also a bug that the workaround works, any reference into a child (which an interface is) should have had a similar message. However obviously not going to fix something that is helping people out ;)

Verilator does top down module resolution, and at present the interface must be done after the parent. Imagine if the interface itself was parameterized - we must therefore do the parent first. I suspect if you try this with a parameterized interface that changes SIGNAL1_SIZE you'll find a bug (untested).

Perhaps some hack-around can be found for this, if someone wants to take a look I'd welcome it. The bigger issue is bug1540, while strictly reading IEEE parameters must be top-down, the reality that bug needs to address is they must be done in a parameter-by-parameter basis across all modules to solve cases like this.

For now added a placeholder test as t_interface_param_acc_bits.v.

Also added a case to t_interface_parameter_access.v which curiously also works ok.

Also available in: Atom