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

assign bit from bus to a scalar instance port in AUTOINST #1010

Closed
veripoolbot opened this issue Dec 7, 2015 · 1 comment
Closed

assign bit from bus to a scalar instance port in AUTOINST #1010

veripoolbot opened this issue Dec 7, 2015 · 1 comment
Assignees
Labels

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Eitan Golan
Original Redmine Issue: 1010 from https://www.veripool.org
Original Date: 2015-12-07
Original Assignee: Wilson Snyder (@wsnyder)


I have a module:

module my_module (
input [2:0] x1 ,
input x2 ,
input [7:0] x3 ,
input [5:0] y1 ,
input y2 ,
output [3:0] o1 ,
output o2
);

At the the instance of my_module I want to tie low all the x* inputs, so my_top.v looks like this:

wire [32:0] tie_low = 32'd0;

/* my_module AUTO_TEMPLATE(
.x. (tie_low[]),
);*/

I get the following instance:

my_module my_inst
(/AUTOINST/
// Outputs
.o1 (o1[3:0]),
.o2 (o2),
// Inputs
.x1 (tie_low[2:0]), // Templated
.x2 (tie_low), // Templated
.x3 (tie_low[7:0]), // Templated
.y1 (y1[5:0]),
.y2 (y2));

There is a problem with x2 input, since it is a single bit (not a bus) it is assigned the wire "tie_low" without any dimensions.
The correct verilog assignment should be:

.x2         (tie_low[0]),       // Templated

Is there a way to assign it correctly with bit[0] ?

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-12-08T02:32:25Z


[] means add the array if any, which is almost always what you want, but not in this case.

Anyhow this works

/* my_module AUTO_TEMPLATE(
 .x.*   (tie_low[@"(- (string-to-int vl-width) 1)":0]),
 );*/

Of course for your particular example it's silly to use tie_low, use instead

/* my_module AUTO_TEMPLATE(
 .x.*   ({1'b0{@"vl-width"}}),
 );*/

Or if using system verilog, much nicer

/* my_module AUTO_TEMPLATE(
 .x.*   ('0),
 );*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants