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

Hierarchical parameter binding #619

Closed
veripoolbot opened this issue Feb 15, 2013 · 6 comments
Closed

Hierarchical parameter binding #619

veripoolbot opened this issue Feb 15, 2013 · 6 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Feb 15, 2013


Author Name: Ed Lander
Original Redmine Issue: 619 from https://www.veripool.org
Original Date: 2013-02-15


Hi Wilson,

Following on from ticket #602, here is our request for an enhancement to the recently implemented bind feature.

We've been seeing the following types of messages when trying to build our full design (inc. binds):

%Error: :: Expecting expression to be constant, but can't convert a VARXREF '' to constant.

%Error: :: Can't convert defparam value to constant: Param of <bound_instance>

We've driven your t_bind2.v test-case through the flow, and noticed that the parameters don't include hierarchical references:

bind targetmod mycheck
  #(
    .param2(param2),
    .param3(param3)
    )
i_mycheck (.p2(p2), .p3(p3), .*);

Our original example was like this, eg:

bind i_targetmod mycheck #(
.param2(param2),
.param3(top.param3)
) i_mycheck(.p2(p2), .p3(top.p3), .*);

Once correcting the bind to module (not instance), we see the same Errors:

%Error: bind_example.sv:32: Expecting expression to be constant, but can't convert a VARXREF 'param3' to constant.

%Error: bind_example.sv:32: Can't convert defparam value to constant: Param param3 of i_mycheck

Simplifying the bind to this is OK:

bind targetmod mycheck #(
.param2(param2)
) i_mycheck(.p2(p2), .p3(top.p3), .*);

So the hierarchical references for the port binding is fine, but it seems like the hierarchical references for the parameters is not. Is this in line with your intention?

I've attached a test-case that Verilator is happy with, without hierarchical parameter references. To produce the Errors, simply switch in the commented bind statement.

Cheers, Ed

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 15, 2013


Original Redmine Comment
Author Name: Ed Lander
Original Date: 2013-02-15T14:43:58Z


P.S. Trial conducted with Verilator 3.845 (first release supporting bind statements)

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 16, 2013


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-02-16T00:03:25Z


I didn't think it was legal to have dotted parameters. Actually VCS agrees and says "targetmod, "top.param3" The use of a non-constant expression to override a parameter value is illegal."

Am I missing something?

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 18, 2013


Original Redmine Comment
Author Name: Ed Lander
Original Date: 2013-02-18T11:37:08Z


Hi Wilson,

We're using the parameter as an elaboration-time constant, and not sure of how else to express it.

Can we be so bold as to suggest that VCS is wrong?

Cheers,
Ed

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 18, 2013


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-02-18T12:18:08Z


Of course VCS could be wrong. I can't find exact wording either way in IEEE, but no-dots is my understanding and VCS usually has the best SystemVerilog adherence out there. And, it will be a major change to fix this as Verilator resolves all parameters before doing any dotted variables so either way it's not going to happen soon, sorry.

So if you want to be sure, and leave this open, please ask the IEEE committee if this is legal.

To work around perhaps use a $unit parameter than reference that?

parameter param3 = 1;
bind ...
module a;
...
endmodule

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 18, 2013


Original Redmine Comment
Author Name: Ed Lander
Original Date: 2013-02-18T15:06:26Z


Ok, thanks Wilson, yes the IEEE SV doc isn't massively explicit on such detail with bind. We're reworking our code to align with your implementation.

Cheers,
Ed

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 18, 2013


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-02-18T15:12:19Z


Thanks for adapting.

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.