Navigation Menu

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

Constant function referencing a non-trivial localparam in another package fails to be constified #1004

Closed
veripoolbot opened this issue Nov 21, 2015 · 3 comments
Labels
resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Johan Bjork
Original Redmine Issue: 1004 from https://www.veripool.org
Original Date: 2015-11-21
Original Assignee: Johan Bjork


// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Johan Bjork.
package foo;
    localparam FOO = 256 >> 2;
endpackage

import foo::*;
module t;
    localparam BAZ = f('0);
    function integer f();
       return FOO;
    endfunction
endmodule

Fails with

%Error: t/t_func_const_bad.v:11: Expecting expression to be constant, but can't determine constant for FUNCREF 'f'
%Error: t/t_func_const_bad.v:13: ... Location of non-constant VARREF 'FOO': Language violation: reference to non-function-local variable
-node: FUNCREF 0x7fdea041f100 <e92#> {e11} @dt=0x7fdea041f3e0@(sw32)  f -> FUNC 0x7fdea041f4d0 <e91#> {e12} @dt=0x7fdea041f3e0@(sw32)  f

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Johan Bjork
Original Date: 2015-11-21T21:41:23Z


Fix+Test available here: https://github.com/phb/verilator-dev/tree/#�

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-11-23T01:47:08Z


Thanks again for a good patch. Fixed in git towards 3.880.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-12-19T15:33:33Z


In 3.880.

@veripoolbot veripoolbot added the resolution: fixed Closed; fixed label 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
Projects
None yet
Development

No branches or pull requests

1 participant