[sv-bc] FW: Clarification on unions (from Stu Sutherland)

From: David W. Smith <dwsmith@synopsys.com>
Date: Thu Apr 01 2004 - 08:40:04 PST

-----Original Message-----
From: Stuart Sutherland [mailto:stuart@sutherland-hdl.com]
Sent: Thursday, April 01, 2004 7:58 AM
To: David.Smith@Synopsys.COM
Subject: Clarification on unions

David,

I'm not sure which subcommittee this question should go to. Could you
please forward this question to the right group?

Is it legal to access a union using just the union name without a member
name? If so, what are the rules for what type is read from the union? For
example, is the following legal?

  union {
    int unsigned u;
    int s;
  } foo;
  
  initial begin
    foo.i = -5;
    $display("foo = %d", foo); //is this reference to foo legal?
  end
  
I could not find anything in the LRM on this, for unpacked, packed or tagged
unions, although the following sentence might be on this topic (it is not
clear to me). It seems to me that this should be covered in section 3.11.

Stu
~~~~~~~~~~~~~~~~~~~~~~~~~
Stuart Sutherland
stuart@sutherland-hdl.com
503-692-0898
Received on Thu Apr 1 08:40:48 2004

This archive was generated by hypermail 2.1.8 : Thu Apr 01 2004 - 08:41:05 PST