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

Using an array in a function called from a parameter

Added by Marshal qiao 8 months ago. Updated 4 months ago.

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

0%


Description

Running verilator on the following code gives some errors.

module ex24
(
  input wire i_clk,
  input wire i_rst_n
);
parameter int SIZES [3:0] = '{1,2,3,4};
typedef int calc_sums_t [3:0];
function calc_sums_t calc_sums;
  begin
    int ii, sum = 0;
    for (ii=0; ii<4; ii++) begin
     sum = sum + SIZES[ii];
     calc_sums[ii][31:0] = sum;
    end
  end
endfunction
parameter int SUMS[3:0] = calc_sums();
endmodule

Error message: %Error: ex24.v:26: Expecting expression to be constant, but can't determine constant for FUNCREF 'calc_sums' %Error: ex24.v:19: .. Location of non-constant ARRAYSEL: Isn't predictable Called from: ex24.v:26: calc_sums() with parameters

History

#1 Updated by Wilson Snyder 5 months ago

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

Unpacked arrays (the parameter) are not currently supported in constant functions.

Added a test_regress/t/t_param_array3.pl test for this, will look into improving this.

#2 Updated by Wilson Snyder 5 months ago

  • Status changed from Confirmed to Feature

#3 Updated by Nathan Clarke 4 months ago

FWIW, I ran into this issue too just now.

#4 Updated by stefano cappello 4 months ago

Had the same issue too.

Also available in: Atom