Subject: Re: Generate & defparams in Vlog-2001.
From: Shalom Bresticker (Shalom.Bresticker@motorola.com)
Date: Wed Aug 08 2001 - 05:25:38 PDT
Krishna Garlapati wrote:
> Hello folks,
>
> I have a couple of questions reg. the generate stmt specs of
> Vlog-2001. I see that there is a "parameter_override" allowed for
> generate item. I could not find any examples for this and made up
> one.
Actually the following examples appear:
generate
if((a_width < 8) || (b_width < 8))
CLA_multiplier #(a_width,b_width) u1(a, b, product); // instance a CLA multiplier
else
WALLACE_multiplier #(a_width,b_width) u1(a, b, product); // instance a Wallace-tree multiplier
endgenerate
and
generate
case (WIDTH)
1: adder_1bit x1(co, sum, a, b, ci); // 1-bit adder implementation
2: adder_2bit x1(co, sum, a, b, ci); // 2-bit adder implementation
default: adder_cla #(WIDTH) x1(co, sum, a, b, ci); // others - carry look-ahead adder
endcase
> 1. In the context of a for-generate statement is this snippet
> of verilog a valid usage of parameter-override ???
>
> module flop(input in, clk, output reg out);
> parameter xyz = 1; // dummy, not used
>
> always @(posedge clk)
> begin
> out <= in;
> end
>
> endmodule
>
> module simple(input [7:0] in, in1, output [7:0] out1);
>
> genvar i;
>
> generate for(i=0; i < 8; i = i+1)
> begin : somename
> flop my_flop(in[i], in1[i], out1[i]);
> defparam somename[2].my_flop.xyz = 2; // <----- is this the correct
> usage ???
> end endgenerate
>
> endmodule
In this case, since you want to override the value of the parameter in only one of the instances,
you would put the defparam outside of the generate.
On the other hand, you might write within the generate something like:
defparam somename[i].my_flop.xyz = i ;
> 2. If yes, the LRM says that the generated instances names should be :
>
> somename[0].myflop
> somename[1].myfop ...etc.
>
> However, the defparam usage has added an extra dot to the above
> generated instance names, which can be mistaken by the tools
> as a hierarchical name of depth 3 ( the association is left to
> right ). In this case though, the depth is just 2 and my opinion
> is the association should be done right to left. How can we
> differentiate
> **clearly** which is which ?? What if the user really has an instance
> name called somename[1] ?? How do we flag this error ??? What about
> readability ??
I did not understand this.
Clearly it is illegal to have two different instances with the same name
and it is the elaborator's responsibility to spot this.
Shalom
>
>
> Thanks in advance for any input.
>
> --
> - Krishna.
> (408)215-6152
-- ************************************************************************** Shalom Bresticker Shalom.Bresticker@motorola.com Motorola Semiconductor Israel, Ltd. Tel #: +972 9 9522268 P.O.B. 2208, Herzlia 46120, ISRAEL Fax #: +972 9 9522890 **************************************************************************
This archive was generated by hypermail 2b28 : Wed Aug 08 2001 - 05:35:58 PDT