Re: Attributes and constant expressions

From: Michael McNamara (mac@verisity.com)
Date: Wed Oct 24 2001 - 09:21:53 PDT


Precedence: bulk

<p><p>Stuart Sutherland writes:
> Precedence: bulk
>
> I believe the standard very clealy states that a genvar is only valid at
> elaboration time. It therefore would have no value during simulation time,
> and therefore should not be a legal expression in an attribute.
>
> Just my opinion.
>
> Stu

 the genvar is expanded to a constant at elaboration time. So the
 genvar is gone at simulation time; replaced by a constant.

 // don't beat me up on precise syntax; I'm waiting for Paul's parser
 // to test this code :-)

 parameter butterfly_width = 3;
 localparam bw = (butterfly_width-1);

 generate // butterfly
   genvar i;
   for (i = 0; i < butterfly_width; i = i + 1) begin
     assign a[i] = b[bw-i] (* a_index = i, b_index = bw-i *);
   end
 endgenerate

 would (IMHO) expand at elaboration time to:

 assign a[0] = b[2] (* a_index = 0, b_index=2 *);
 assign a[1] = b[1] (* a_index = 1, b_index=1 *);
 assign a[2] = b[0] (* a_index = 2, b_index=0 *);

>
> At 09:13 PM 10/23/2001, you wrote:
> >Precedence: bulk
> >
> >Another question about attributes. The rule is that an attribute must be
> >associated with a constant expression:
> >
> > (* parallel_case = 1 *) case (x) ...
> >
> >Can the constant expression depend on parameters? On constant functions?
> >On genvars?
> >
> >Paul
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Stuart Sutherland Sutherland HDL Inc.
> stuart@sutherland-hdl.com 22805 SW 92nd Place
> phone: 503-692-0898 Tualatin, OR 97062
> www.sutherland-hdl.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:48 PDT and
sponsored by Boyd Technology, Inc.