[sv-bc] When are constant expressions evaluated?

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Sun Feb 11 2007 - 03:49:42 PST
Two recent cases piqued my curiosity.

1.
   sync 
     #(.BUS_WIDTH(ADD_WIDTH),
       .RST_VALUE(ADD_WIDTH == 2 ? 2'b11  : 
                  ADD_WIDTH == 3 ? 3'b111 :
                  {1'b1,{ADD_WIDTH-3{1'b0}},2'b11})
       )
       sync(...);

In this case, if ADD_WIDTH is less than 3, the replication constant ADD_WIDTH-3 is negative and it is not legal.

However, if ADD_WIDTH is 2, one could say that the replication constant does not need to be evaluated at all.

This is related to the short-circuiting issue we discussed last year.

Is this legal? Should it be?


2. 
parameter ADD_WIDTH = 0 ;
... {ADD_WIDTH-1{1'b0}}...

Is there any significance to the legality of a default value of the parameter, or only to the actual instantiated values?

Shalom




Shalom Bresticker
Intel Jerusalem LAD DA
+972 2 589-6852
+972 54 721-1033 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Feb 11 03:53:48 2007

This archive was generated by hypermail 2.1.8 : Sun Feb 11 2007 - 03:54:23 PST