%Error: ...: Expecting expression to be constant, but can't determine constant for FUNCREF
|Assignee:||Wilson Snyder||% Done:||
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
%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.
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.
Also available in: Atom