Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
veripoolbot opened this issue May 4, 2012 · 2 comments
Assignees
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@veripoolbot
Copy link
Contributor


Author Name: Alex Solomatnikov
Original Redmine Issue: 505 from https://www.veripool.org
Original Date: 2012-05-04
Original Assignee: Wilson Snyder (@wsnyder)


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.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2012-05-04T02:00:00Z


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.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2012-07-31T22:58:18Z


In 3.840.

@veripoolbot veripoolbot added resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800 labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800
Projects
None yet
Development

No branches or pull requests

2 participants