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

From: Bresticker, Shalom <shalom.bresticker@intel.com>
Date: Fri Oct 15 2010 - 06:20:30 PDT

7.4.1 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. A part-select of a packed array shall be unsigned."

So I would assume S to be signed and S[0] as unsigned.

Shalom

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
> Steven Sharp
> Sent: Saturday, September 11, 2010 6:51 AM
> To: sv-bc@eda.org; jwill@BasicISP.net
> Subject: Re: [sv-bc] Sign of a signed packed array of struct
>
>
> >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.

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Oct 15 06:21:10 2010

This archive was generated by hypermail 2.1.8 : Fri Oct 15 2010 - 06:23:26 PDT