Subject: Re: [sv-ec] Re: [sv-bc] Packed arrays
From: Kevin Cameron x3251 (Kevin.Cameron@nsc.com)
Date: Wed Jan 29 2003 - 17:35:52 PST
> From sharp@cadence.com Wed Jan 29 17:01:10 2003
>
> >Date: Wed, 29 Jan 2003 16:27:48 -0800 (PST)
> >From: "Kevin Cameron x3251" <Kevin.Cameron@nsc.com>
>
> >> I do agree that it would be far nicer if one didn't have to call
> >> $realtobits and $bitstoreal when passing things around.
> >
> >That's where the real inefficiency is.
>
> Are you assuming that because these are called "system functions", the
> compiler actually has to generate a function call? I assure you that
> NC-Verilog doesn't do anything of the sort. That would be inefficient.
The conversion isn't the issue, it's the propagation as bits. Sure you
can spend a lot of time optimizing it all away, but it's cheaper just
to specify it as a shared real value if that's what you want.
> >The code above should behave the same in SV as it does in C, the
> >argument is about the behavior in packed structs/unions. Your example
> >shows that there is no real difference in the FP representation (IEEE
> >I presume) between X86 and Sparc so there would only be minor bit twiddling
> >required if you pick a particular order for packed doubles.
>
> There is no guarantee that this is the only difference on all different
> platforms. If this is the only difference, the cost is approximately
> the same as a $bitstoreal and $realtobits on each read and write of the
> packed double. And you have yet to provide a reason why a user needs this.
Given that most hardware is going to use IEEE formats, I don't see why I
shouldn't be able to do:
packed union {
double d;
bit [63:0] i;
} pdi;
as well as
union {
double d;
bit [63:0] i;
} di;
If my wires are carrying a "double" value I'd like to be able to say so.
$bitstoreal and $realtobits are a hack, they are user-replaceble functions
and therefore cannot be trusted to have any specific behavior in tools
outside the simulator.
Which platform does your simulator run on that doesn't use IEEE floating
point representation? If you do have one how much information is lost if
you assign the platform specific double to the IEEE format?
Kev.
> Steven Sharp
> sharp@cadence.com
This archive was generated by hypermail 2b28 : Wed Jan 29 2003 - 17:36:37 PST