I don't think unpacked unions are bit-stream types either. But that example has been there a long time -- http://www.eda-stds.org/sv/3.0_LRM.pdf -- Brad ________________________________ From: Subhamoy Pal [mailto:subhamoy@cal.interrasystems.com] Sent: Wednesday, June 28, 2006 10:55 PM To: Brad Pierce Cc: sv-bc@eda-stds.org Subject: Re: [sv-bc] query regarding casting Brad, then does it mean we can not cast an unpacked aggregate, containing real/shortreal, to a bitstream type? If so, then the LRM example in 4.14, tagbits t = tagbits'(a[3]); // convert structure to array of bits is not correct because 'a[3]' can contain real type as a part of it. -- Subhamoy Brad Pierce wrote: Subhamoy, I think the only way to bit-stream reals or shortreals is with the $realtobits(), $bitstoreal(), $shortrealtobits() and $bitstoshortreal() system functions. Reals and shortreals are not bit-stream types. -- Brad ________________________________ From: owner-sv-bc@eda-stds.org [mailto:owner-sv-bc@eda-stds.org] On Behalf Of Subhamoy Pal Sent: Wednesday, June 28, 2006 5:32 AM To: sv-bc@eda-stds.org Subject: [sv-bc] query regarding casting In SV LRM 4.14, I found the following example: typedef struct { bit isfloat; union { int i; shortreal f; } n; // anonymous type } tagged_st; // named structure typedef bit [$bits(tagged_st) - 1 : 0] tagbits; // tagged_st defined above tagged_st a [7:0]; // unpacked array of structures tagbits t = tagbits'(a[3]); // convert structure to array of bits Here a[3] can be assigned with '{isfloat:1, n:'{f:2.5}}. Here the problem is if we consider the 33 bits needed to represent value of a[3], the least significant 32 bits will be a representation for shortreal(i.e. the memory representation will be of C float type). Treating this 32 bit representation as bitstream representation does not mean anything significant. In LRM, though I found how a real or shortreal data type can be casted to a bit stream, but I can not find any LRM verse which specifies how to cast an unpacked aggregate, containing real/shortreal data, to a packed aggregate. Can anyone please specify any such LRM section and verse? --SubhamoyReceived on Wed Jun 28 23:58:25 2006
This archive was generated by hypermail 2.1.8 : Wed Jun 28 2006 - 23:58:37 PDT