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

Localparam array can't be passed into parameter-called function #1052

Closed
veripoolbot opened this issue Apr 6, 2016 · 3 comments
Closed

Localparam array can't be passed into parameter-called function #1052

veripoolbot opened this issue Apr 6, 2016 · 3 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Apr 6, 2016


Author Name: Andrew Bardsley
Original Redmine Issue: 1052 from https://www.veripool.org


A localparam of unpacked array type isn't considered const in this example and also fails to be handled in the SimulateVisitor:

module top;
  function integer get_element;
     input integer index;
     input integer array_arg[7:0];
     get_element = array_arg[index];
  endfunction

  localparam integer array[7:0] = '{12, 12, 12, 12, 12, 12, 12, 12}; // line 8
  localparam element = get_element(0, array);                        // line 9
endmodule

Produces:

%Error: a.v:9: Expecting expression to be constant, but variable isn't const: array
%Error: a.v:9: Expecting expression to be constant, but can't determine constant for FUNCREF 'get_element'
%Error: a.v:8: ... Location of non-constant INITARRAY: Unknown node type, perhaps missing visitor in SimulateVisitor

With Verilator (verilator --version) on Ubuntu 14.04:

Verilator 3.882 2016-03-01 rev verilator_3_882-1-gacff683

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Apr 6, 2016


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2016-04-06T23:23:06Z


Note this works ok already

localparam element = array[index];

Looked at the function example (thanks), the code that computes functions etc doesn't have the concept of passing any data type other than numbers, so passing an array isn't a simple fix that I can work on immediately. If you'd like to do the work yourself I can suggest how to go about it.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Apr 7, 2016


Original Redmine Comment
Author Name: Andrew Bardsley
Original Date: 2016-04-07T09:20:09Z


Right. Thought this one might need more work than was trivially possible.
I'll pass on doing the change myself (for the moment).

Thanks

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Jun 29, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-06-29T10:39:51Z


#� is the same issue, so tracking there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.