[sv-bc] Query regarding array querying system function

From: Subhamoy Pal <subhamoy_at_.....>
Date: Tue Jul 25 2006 - 03:07:40 PDT
Hello,
I have a few queries regarding Array querying System Function $dimensions().

1>>
SV LRM 22.6 says,
"$diemsions shall return
   - the total number of dimensions in the array (packed and unpacked , 
static or dynamic )
   -1 for string datatype or anyother nonarray type that is equivalent 
to simple bit vector type .
   - 0 for any other type"

Now for the  following case,

module mod;
   string s1 = "ab";
   initial
      begin
         $display($dimensions(s1));  // output will be 1 according to 
LRM verses
      end
endmodule

It means s1 is a single dimension object. Though s1[0][0] is perfectly 
valid because s1[0] has the equivalent type of a byte and from that we 
can do another bitselect. So, it seems s1 is a two-dimensional packed 
array because we can use bitselect twice on the array. Hence the result 
of $dimensions() looks contradictory.

2>>

Second case is::==

module mod;
   integer i[3:0];
   initial
      begin
         $display($dimensions(i));  // output will be what?
      end
endmodule

If the previous case has output 1, then this output should be 1(since 
integer is not a packed array). On the contrary, vlog shows it is 2 
though the previous output it shows is 1.
My question is what should be the valid output?

-- Subhamoy
Received on Tue Jul 25 03:08:33 2006

This archive was generated by hypermail 2.1.8 : Tue Jul 25 2006 - 03:09:48 PDT