Re: [sv-bc] Sign of a signed packed array of struct

From: Steven Sharp <sharp@cadence.com>
Date: Fri Sep 10 2010 - 20:50:48 PDT

>From: John Michael Williams <jwill@basicisp.net>

>An array is an unordered set, and it does not represent a quantity,
>so I think it could not be either signed or unsigned.

A packed array, such as this one, is an ordered set that represents
a quantity, and can be either signed or unsigned.

In this case, I believe the answer is that S is unsigned, and S[0]
is signed. I will have to dig deeper into the spec for support for
this.

For a packed array of packed arrays, you can use typedefs to make any
one of the levels of selects signed, but only one of them. If you use

logic signed [3:0] [3:0] S;

then S is signed, and S[0] is unsigned. If you use

typedef signed [3:0] s_nibble;
s_nibble [3:0] S;

then S is unsigned, and S[0] is signed. You cannot make both of them
signed, which is a shortcoming of the language.

In the array of structs case, I think you can only make the struct signed.
I don't think there is a way to make the full array vector signed if it
is composed of packed structs.

Steven Sharp | Architect | Cadence

P: 508.459.1436 M: 774.535.4149 www.cadence.com

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Sep 10 20:51:28 2010

This archive was generated by hypermail 2.1.8 : Fri Sep 10 2010 - 20:54:11 PDT