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 bind statements within generate blocks #1501

Open
veripoolbot opened this issue Sep 6, 2019 · 3 comments
Open

Support bind statements within generate blocks #1501

veripoolbot opened this issue Sep 6, 2019 · 3 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Sep 6, 2019


Author Name: Dan Petrisko (@dpetrisko)
Original Redmine Issue: 1501 from https://www.veripool.org


A bind statement within a generate if, if the generate if evaluates to false, should not bind.

// Should not bind
localparam do_bind  = 0;
if (do_bind)
  bind ....

// Should bind
localparam do_bind  = 1;
if (do_bind)
  bind ....

I've attached a complete testcase. If you set do_bind to 1, the module is bound. If you set do_bind to 0, the module is still bound! The code works as expected in Synopsys VCS.

Tested on Verilator 4.017 devel rev UNKNOWN_REV on CENTOS 7

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Sep 6, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-09-06T11:10:43Z


Thanks for the test.

This is a bug due to Bind being expanded up front before parameters are resolved.

Note to self/fixer: there's a minor complication in fixing this in that Verilator currently computes the possible hierarchy before parameter resolution, probably the bind needs to be considered then backed out if parameters rip it out; similar to AstNotFoundModule's.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Oct 2, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-10-02T01:59:58Z


Haven't forgotten about this. Got the exact case provided working, but based on where in the tree the bind is there's other problems, and unfortunately can't yet detect when it goes wrong to throw an unsupported error.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Oct 2, 2019


Original Redmine Comment
Author Name: Dan Petrisko (@dpetrisko)
Original Date: 2019-10-02T02:04:07Z


Thanks!! It's not a show-stopper for us. Our workaround for anyone watching is to clock-gate based on the bind parameter.

localparam do_bind  = 0;
if (do_bind)
  foo (.clk_i(clk_i & do_bind));

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.