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

Having trouble assigning signals of interfaces to regs within for loop

Added by Junyi Xie 3 months ago. Updated 3 months ago.

Status:
WillNotFix
Priority:
Normal
Assignee:
-
Category:
-
% Done:

0%


Description

Hi Wilson,

I experienced errors when I tried to assign signals of an interfaces array to 2-d regs. Attached are example files which can generate the errors below:

%Error: interface_for_loop_tb.sv:32: Expecting expression to be constant, but variable isn't const: i %Error: interface_for_loop_tb.sv:32: Could not expand constant selection inside dotted reference: i %Error: interface_for_loop_tb.sv:33: Expecting expression to be constant, but variable isn't const: i %Error: interface_for_loop_tb.sv:33: Could not expand constant selection inside dotted reference: i

Appreciate your help.

Regards, Junyi Xie

interface_for_loop_tb.sv (714 Bytes) Junyi Xie, 04/12/2019 06:49 PM

build_and_run.sh View (301 Bytes) Junyi Xie, 04/12/2019 06:49 PM

sample_intf.sv (205 Bytes) Junyi Xie, 04/12/2019 06:49 PM

InterfaceForLoopTest.cpp View (530 Bytes) Junyi Xie, 04/12/2019 06:49 PM

History

#1 Updated by Wilson Snyder 3 months ago

  • Status changed from New to WillNotFix

Verilator currently requires interface (or cell) references must be statically unrolled. This is currently a fairly fundamental assumption that is unlikely to be improved in the near term (so not leaving this bug open).

To work around it move your for loop to become a generate loop outside the always.

And thanks for your good bug report, that makes it a lot easier to help.

    for (genvar i = 0; i < 2; i++)
    begin
        always_comb
        begin
            buffer_a[i] = in_intfs[i].a;
            buffer_b[i] = in_intfs[i].b;
        end
    end

#2 Updated by Junyi Xie 3 months ago

This is reasonable. Thanks for the quick reply by the way!

#3 Updated by Junyi Xie 3 months ago

Hi Wilson, We come across a Xilinx page that suggests having for loop inside always_comb helps to save runtime.

https://www.xilinx.com/support/answers/55302.html

This might be interesting for your investigation.

We will for now use the style you recommended though.

Thanks!

Also available in: Atom