[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
  SystemPerl
  Voneline
  WFH
General Info
  Papers

Issue #505

%Error: ...: Expecting expression to be constant, but can't determine constant for FUNCREF

Added by Alex Solomatnikov about 1 year ago. Updated 10 months ago.

Status:Closed Start date:05/04/2012
Priority:Normal Due date:
Assignee:Wilson Snyder % Done:

0%

Category:Unsupported
Target version:-

Description

Source code:

localparam MAX_LFSR_WIDTH       = 36;

// Number of LFSR modules required
localparam NUM_LFSR                     = num_lfsr(DATA_WIDTH);
...
// Calculate the number of LFSR modules needed for the specified width
function integer num_lfsr;
        input integer data_width;
        begin
                num_lfsr = 1;
                while ((data_width + num_lfsr - 1) / num_lfsr > MAX_LFSR_WIDTH)
                        num_lfsr = num_lfsr * 2;
        end
endfunction

errors:

%Error: lfsr_wrapper.sv:44: Expecting expression to be constant, but can't determine constant for FUNCREF 'num_lfsr'
%Error: lfsr_wrapper.sv:95: ... Location of non-constant VARREF 'MAX_LFSR_WIDTH': Language violation: reference to non-function-local variable

vcs compiles this without problem, it is also synthesizable by Altera.

Workaround: replace MAX_LFSR_WIDTH with 36.

History

Updated by Wilson Snyder about 1 year ago

  • Category set to Unsupported
  • Status changed from New to Resolved
  • Assignee set to Wilson Snyder

Localparams weren't allowed in constant functions.

Fixed in git towards 3.840+.

P.S. if you could please create test Verilog files in regression format as described under BUGS in the manual it would help speed up fixing them.

Updated by Wilson Snyder 10 months ago

  • Status changed from Resolved to Closed

In 3.840.

Also available in: Atom