[sv-bc] query regarding casting

From: Subhamoy Pal <subhamoy_at_.....>
Date: Wed Jun 28 2006 - 05:31:47 PDT
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?

--Subhamoy
Received on Wed Jun 28 05:32:00 2006

This archive was generated by hypermail 2.1.8 : Wed Jun 28 2006 - 05:32:16 PDT