FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-24-2008, 03:02 PM
Guest
 
Posts: n/a
Default decimal to ieee 754 single precision floating point

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
Reply With Quote
  #2 (permalink)  
Old 09-25-2008, 10:32 PM
Kevin Neilson
Guest
 
Posts: n/a
Default Re: decimal to ieee 754 single precision floating point

[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
Reply With Quote
  #3 (permalink)  
Old 09-26-2008, 01:33 PM
Gabor
Guest
 
Posts: n/a
Default Re: decimal to ieee 754 single precision floating point

On Sep 25, 5:32*pm, Kevin Neilson
<[email protected]> wrote:
> [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


If you have a C compiler you can write a simple program that
includes your data file as a comma-delimited list like:

float foo[] = {
#include numberlist.csv
};

and then write some simple code to coerce the values to unsigned int
and print them out.

Just a thought....
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MicroBlaze floating point precision issues JD Newcomb FPGA 6 01-07-2008 08:32 PM
Re: precision errors. microblaze vs matlab single precision... huh? chriskoh FPGA 5 09-13-2007 04:18 AM
precision errors. microblaze vs matlab single precision... huh? chriskoh FPGA 0 09-12-2007 11:27 AM
Microblaze FPU and IEEE754 single precision number format Aaron Curtin FPGA 1 11-07-2006 04:05 PM
[Newbie] 64-point complex FFT with 32 bit floating-point representation Franco Tiratore FPGA 10 05-12-2006 04:17 PM


All times are GMT +1. The time now is 12:08 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved