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

From: Rich, Dave <Dave_Rich_at_.....>
Date: Tue Jun 26 2007 - 00:48:24 PDT
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 Tue Jun 26 00:48:41 2007

This archive was generated by hypermail 2.1.8 : Tue Jun 26 2007 - 00:49:24 PDT