RE: [sv-bc] Members of unpacked structures containing a union shall not be assigned individual default member values

From: danielm <danielm_at_.....>
Date: Wed Jun 27 2007 - 07:46:52 PDT
I think that this statement in LRM:
"Members of unpacked structures containing a union as well as members of
packed structures shall not be assigned individual default member values."
is redundand according to yours explanation. Because it doesnt' metter if
you have union inside unpacked structure or not - you still cannot have
default initial values for union members.:
  union packed { int c=1; integer d; } ;//illegal even if not in unpacked
structure
  union packed { int c=1; integer d=2; } ;//illegal even if not in unpacked
structure

Rewritten by you statement  IMHO describes below code - but I don't think
that it was intended
module tb;
 struct { //structure containing a union
  bit a ;
  union packed { int c; integer d; } n=1;
 } str1;
endmodule

Please send me clear examples of code forbidden by this certain statement -
because I think that it should be rewritten or removed.
 
DANiel


  _____  

From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: Tuesday, June 26, 2007 9:48 AM
To: Neil.Korpusik@sun.com; sv-bc@server.eda.org
Cc: danielm@aldec.com.pl
Subject: RE: [sv-bc] Members of unpacked structures containing a union shall
not be assigned individual default member values


I believe the sentence could be re-written
 
"Unpacked structures members containing a union as well as members of
packed structures shall not be assigned individual default member values."
 
You example is legal because a is a member that does not contain a union.
The reason for the first part of the rule is if you allowed c and d to have
default values, you'd have a conflict and you couldn't determine which value
would stick. Even if only one had a default value, you would still be in
conflict with the implicit uninitialized default (0 for an int).
 
I can't remember entirely, but I think reason for the restriction on packed
structures is that they are implicit unions between the packed member as a
whole and the individual members as a packed struct.
 
Dave
 
 
 


  _____  

From: owner-sv-bc@server.eda.org on behalf of Neil Korpusik
Sent: Mon 6/25/2007 6:53 PM
To: sv-bc@server.eda.org
Cc: danielm@aldec.com.pl
Subject: [sv-bc] Members of unpacked structures containing a union shall not
be assigned individual default member values



<forwarding email from danielm@aldec.com>

It was originally sent to the sv-ec but it seems to belong in the sv-bc.

Neil



-------- Original Message --------
Subject:        Members of unpacked structures containing a union shall not
be
assigned individual default member values
Date:   Mon, 25 Jun 2007 12:17:41 +0200
From:   danielm <danielm@aldec.com.pl>
To:     owner-sv-ec@eda.org



LRM 1800-2005 in chapter 4.11 - states:

"Members of unpacked structures containing a union as well as members of
packed structures shall not be assigned individual default member values."

There is no example  in LRM for above rule and I have doubts why it is
forbidden, and what in fact is forbidden?

Should below code fail on compilation because of this rule?

  module tb;

 struct { //structure containing a union
  bit a = 1;
  union { int c; int d; } n;
 } str1;

endmodule

????

DANiel





--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 27 07:47:16 2007

This archive was generated by hypermail 2.1.8 : Wed Jun 27 2007 - 07:47:41 PDT