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

Support unpacked array function constantization #1578

Closed
veripoolbot opened this issue Oct 31, 2019 · 2 comments
Closed

Support unpacked array function constantization #1578

veripoolbot opened this issue Oct 31, 2019 · 2 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Oct 31, 2019


Author Name: Graham Gobieski
Original Redmine Issue: 1578 from https://www.veripool.org


If I write something like:

module test
	#(parameter 	N=4)
	(input 	logic 	clk, rst_l);

	parameter MASK = mask_val();

	typedef logic mask_t[N];
	function mask_t mask_val();
		for(int i = 0; i < N; i++) begin
			mask_val[i] = i[0];
		end
	endfunction : mask_val

endmodule : test

Verilator complains with:

%Error: tmp/test.sv:5: Expecting expression to be constant, but can't determine constant for FUNCREF 'mask_val'
         tmp/test.sv:10: ... Location of non-constant ASSIGN: LHS isn't simple variable
         tmp/test.sv:5: ... Called from mask_val() with parameters:

I think the constantization is broken in this instance. Please see attached files.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 2, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-02T15:27:41Z


Thanks for your report. Using arrays in constifications is unsupported at present. There's been some recent work but we aren't there yet, if you'd like to contribute/watch it please see #�.

@veripoolbot veripoolbot closed this Nov 2, 2019
@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 9, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-09T23:37:30Z


#� has been fixed in git towards eventual 4.022 release.

This example passes when:

 parameter MASK = mask_val();

is changed to

 parameter mask_t MASK = mask_val();

The former is clearly legal according to IEEE 2017 6.20.2, but too nasty to get working correctly at the moment. FWIW a commercial simulator also chokes without the type specified.

Feel free to file a bug requesting the type be optional.

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.