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

Verilator does not support assertions in constant functions #973

Closed
veripoolbot opened this issue Oct 1, 2015 · 8 comments
Closed

Verilator does not support assertions in constant functions #973

veripoolbot opened this issue Oct 1, 2015 · 8 comments
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@veripoolbot
Copy link
Contributor


Author Name: Johan Bjork
Original Redmine Issue: 973 from https://www.veripool.org
Original Date: 2015-10-01
Original Assignee: Johan Bjork


Specifically, Verilator does not support statements like this

    function logic checkParameter(input logic [31:0] N);
       if (N == 1)
         return 0;
       $fatal(1, "Parameter is invalid...");
    endfunction

which should be valid SV-2009.

My first attempt on a patch to verilator is available here phb/verilator-asserts@1908f3b. I've left a FIXME in there -- specifically asking for feedback whether we should use different V3ErrorCode's for elaboration errors triggered by user assertions. Let me know what you think and I'll change the patch as needed.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Johan Bjork
Original Date: 2015-10-01T05:59:31Z


Should have linked to the repository.
https://github.com/phb/verilator-asserts

I realized after posting this patch that I'm failing to do proper formatting of the format string. I suspect I can extract some code from V3EmitC to be able to do this at elaboration time as well.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Johan Bjork
Original Date: 2015-10-02T03:59:29Z


Updated github repository to expand format strings and updated bundled test.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-10-02T10:45:42Z


Good stuff, thanks!

Yes, please add new error codes, maybe something like USER_WARN, USER_ERROR,USER_FATAL, USER_INFO. Add documentation on them to bin/verilator.

In t_assert_elab/assert_elab_fail.pl, use please use file_grep to check that the messages print properly.

Please rename _fail.pl to _bad.pl - the bad suffix indicates it's expected to fail.

Then should be good to get merged.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-10-02T10:46:41Z


Make that USERERROR, USERFATAL, USERINFO, USERWARN. Error codes don't have underscores otherwise.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Johan Bjork
Original Date: 2015-10-02T21:52:56Z


Thanks! Updated with requested changes.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Johan Bjork
Original Date: 2015-10-23T17:45:54Z


Anything else I can change in this patch to get it merged? Let me know. Code is available at https://github.com/phb/verilator-asserts

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-10-23T22:14:07Z


Thanks for the ping, I had missed that there was a new version.

Pushed to git towards 3.878.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-11-01T13:22:10Z


In 3.878.

@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

1 participant