RE: [sv-bc] Manti 1457, 2374 revisited

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Sun Nov 23 2008 - 05:27:42 PST
Hi, See Mantis 1595, http://www.eda-stds.org/sv-bc/hm/4326.html and following, http://www.eda-stds.org/sv-bc/hm/5065.html and following, and http://www.eda-stds.org/sv-bc/hm/5170.html. I had also sent a mail on this and related subjects on June 22, 2006, but it seems not to have gotten to the reflector, which explains why I never got any replies.

Shalom

> 2374 et al (BC): 
> enums are now permitted as members of packed arrays, unions, 
> and structs.  This has a self-evident and useful meaning for 
> hardware design, and matches de facto tool behaviour. 
> But there remains an issue about copying a regular vector to 
> a packed what-have-you that contains an enum.
> It's an unchecked cast by the back door:
> 
>   typedef enum logic [1:0] {A = 2'b10, B = 2'b01} AB;
>   typedef struct packed {AB ab; logic [5:0] c;} S;
>   S s;
>   s = 8'b0;       // legitimate???
>   s[7:6] = 2'b11; // legitimate???
>   s.ab = 2'b10;   // definitely illegal!
>  
> I know there was some discussion about this and I even have a 
> recollection that, at one time, some tool(s?) forbade such 
> usage.  Is everyone agreed that the copying of a vanilla 
> vector to the packed struct 's' is legitimate? 
> If so, doesn't it render the type safety of enums rather toothless?
> 
> Disclaimer: I have code that uses exactly this idiom and 
> works as expected in tools I use.  I'm not trying to say the 
> behaviour is wrong; merely that the current state of things 
> is equivocal.
---------------------------------------------------------------------
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 Sun Nov 23 05:28:35 2008

This archive was generated by hypermail 2.1.8 : Sun Nov 23 2008 - 05:30:55 PST