Forums » Using AUTOs »
parameters in signal width definitions question
Added by David Rogoff 8 months ago
Hi Wilson.
I'm using a bunch of library modules that are parameterized. I'm not sure how to use them with AUTOs when several of them (or multiple instances of the same one) can use the same parameter name (e.g. DATA_WIDTH) but need separate values in the instantiations. Here's my simple example with AUTOs expanded:
module mod_a
#(parameter DWIDTH = 4)
(input logic [DWIDTH-1:0] din,
output logic [DWIDTH-1:0] dout);
assign dout=din;
endmodule // mod_a
module top;
localparam mod_a1_DWIDTH = 16;
localparam mod_a2_DWIDTH = 16;
/*AUTOLOGIC*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
logic [DWIDTH-1:0] mod_a1_dout; // From mod_a1 of mod_a.v
logic [DWIDTH-1:0] mod_a2_dout; // From mod_a2 of mod_a.v
// End of automatics
/*AUTOREGINPUT*/
// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)
logic [DWIDTH-1:0] mod_a1_din; // To mod_a1 of mod_a.v
logic [DWIDTH-1:0] mod_a2_din; // To mod_a2 of mod_a.v
// End of automatics
/* mod_a AUTO_TEMPLATE (
.\(.*\) (@"vl-cell-name"_\1[]),
);
*/
mod_a
#(/*AUTOINSTPARAM*/
// Parameters
.DWIDTH (mod_a1_DWIDTH)) // Templated
mod_a1
(/*AUTOINST*/
// Outputs
.dout (mod_a1_dout[DWIDTH-1:0]), // Templated
// Inputs
.din (mod_a1_din[DWIDTH-1:0])); // Templated
mod_a
#(/*AUTOINSTPARAM*/
// Parameters
.DWIDTH (mod_a2_DWIDTH)) // Templated
mod_a2
(/*AUTOINST*/
// Outputs
.dout (mod_a2_dout[DWIDTH-1:0]), // Templated
// Inputs
.din (mod_a2_din[DWIDTH-1:0])); // Templated
endmodule
You can see the problem is that AUTO uses the parameter name from the module definition, which creates a conflict since DWIDTH is different in each one.
How can I set up AUTOs to deal with this?
Thanks!
David
Replies (4)
RE: parameters in signal width definitions question - Added by Wilson Snyder 8 months ago
verilog-auto-inst-param-value might do what you want; give it a try.
RE: parameters in signal width definitions question - Added by David Rogoff 8 months ago
Excellent - works perfectly. Also, while poking around verilog-mode.el, I found verilog-auto-inst-dot-name. That is great, too!
RE: parameters in signal width definitions question - Added by David Rogoff 8 months ago
Followup - when I set verilog-auto-inst-dot-name, lot's of stuff doesn't work right including some AUTOLOGIC/AUTOREGINPUT and AUTOINSTPARAM totally breaks. Sorry - don't have time to create a test case/report now.
DavidRE: parameters in signal width definitions question - Added by Wilson Snyder 8 months ago
When you get a chance to make a testcase please file another bug on .name, thanks. I did have some simple tests that work...
(1-4/4)
![[logo]](/img/veripool_small.png)