Re: [sv-bc] FW: BOUNCE sv-bc@eda.org: Non-member submission from ["Rohit K. Jain" <rohit_jain@mentorg.com>]

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Mon Feb 28 2005 - 10:46:36 PST
Maidment, Matthew R wrote:
>>From: "Rohit K. Jain" <rohit_jain@mentorg.com>
>>To: sv-bc@server.eda.org
>>Subject: Issue in determining signedness of Array
>>
>>Hi,
>>
>>I have query on a case mentioned below, for which rules 
>>doesn't seem clear.
>>can someone please clarify.
>>
>>
>>1)
>>Consider the following example :
>>
>>typedef reg signed [7:0] xx;
>>xx  [1:0]  temp ;
>>
>>always
>>begin
>>
>>temp = '1;
>>a1 = temp;  // signed or unsigned RHS??
>>a1 = temp[0]; // signed
>>a1 = temp[0][1]; // unsigned
>>
>>end
>>
>>
>>LRM 4.2 says :
>>If a packed array is declared as signed, then the array viewed as a 
>>single vector shall be signed. The individual elements of the 
>>array are 
>>unsigned unless they are of a named type declared as signed.

In your example xx is the named type of two signed elements of temp,
but temp itself is not signed.

> A 
>>part-select of a packed array shall be unsigned.
>>
>>In the above example, what is signedness of packed array 
>>'temp', when it 
>>is viewed as single vector?

unsigned.

>>
>>Since it is not defined explicitly to be signed, and its element is 
>>defined as named type signed.
>>
>>'temp' should be treated as unsigned, and its element i.e. temp[0] 
>>should be treated as signed?
>>
>>OR
>>
>>'temp' should be treated as signed because its element type is signed?
>>
>>
>>2)
>>typedef reg [7:0] xx;
>>xx  signed [1:0]  temp ;  // illegal

This code is legal, and declares the opposite signedness from your
first example.

The confusing thing about the signedness modifier is that it applies to
the outermost (last) packed dimension declared by that statement.

I would have prefered to see the signing keyword bind tightly to
the nearest "{" or "[" to its right.  Somehow that option was discarded
during the committee work, and perhaps this is for the best.  It
encourages naming the datatypes which have interesting properties.

Greg Jaxon
Received on Mon Feb 28 10:46:39 2005

This archive was generated by hypermail 2.1.8 : Mon Feb 28 2005 - 10:46:49 PST