[email protected] wrote:
> what's the best way to transform decimal numbers to 32bits wide ieee
> 754 single precision floating point numbers? possibly using perl or
> verilog. i did some searching, there are converters like this
> http://babbage.cs.qc.edu/IEEE-754/Decimal.html, but not for large
> amount of data. thanks, -j
I've never had cause to use it, but there are Verilog functions
$bitstoreal and $realtobits which convert reals to the IEEE-754 format
and vice versa. (Note: these use the 64-bit double format, not
single-precision.) One main use of these is to allow a user to pass
reals as vectors through 64-bit ports (since a port can't have a real
format). If you have Matlab, you can also use "format hex".
-Kevin