Re: florating point and VHDL
- From: Amit <amit.kohan@xxxxxxxxx>
- Date: Mon, 22 Oct 2007 11:55:21 -0700
On Oct 22, 11:14 am, Jonathan Bromley <jonathan.brom...@xxxxxxxxxxxxx>
wrote:
On Sun, 21 Oct 2007 21:07:04 -0700, Amit <amit.ko...@xxxxxxxxx> wrote:
Regarding floating point multiplication in VHDL. Can I use the regular
* operator or should I use Adder for this matter?
I think Mike Treseler is basically right. For simulation only,
you can just use ordinary VHDL variables of type REAL, and
all the normal arithmetic operations are available. math_real
provides all the usual mathematical library functions. But
if you are trying to build hardware, it's quite likely that
you only *think* you need floating-point, and in fact you
would be at least as well served by fixed-point arithmetic,
which is only integer arithmetic in party dress.
If you really, really want floating-point hardware, there
are two quick answers:
(1) look at the new IEEE synthesisable packages (they've been
mentioned here many times);
(2) you need both + and *. Very roughly:
- add the two exponents, not forgetting to subtract the bias
value if you are using a biased-exponent representation;
- multiply together the two fractions
- normalize the fraction (possible 1-bit left shift) if
necessary; if so, decrement the exponent by 1
- throw away the unused less-significant bits of the fraction,
having first done the necessary rounding on the more
significant bits.
Oh, and there are the special cases for zero, and proper
handling of Not-A-Number inputs, and overflow, and
denormalization if the exponent underflows, and choice of
rounding mode, and remembering to handle the hidden units
bit if you're using any of the standard formats, and
correctly manipulating the sign bit, and...
See what I mean? You really DON'T want floating-point, do you? :)
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.brom...@xxxxxxxxxxxxxxxxx://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Thanks to you guys but whatever I find it just theory. It seems nobody
likes the floating point as Jonathan pointed out!
I have 4 different books of vhdl and none of them has talked about
floating point multiplications. Currently I'm using Quartus II 6.1 and
it is shipped by the board on a CD but it is all verilog and even when
I follow its steps I get error during compilation (using
MegaFunctions) I really don't know what to do.
.
- Follow-Ups:
- Re: florating point and VHDL
- From: Jonathan Bromley
- Re: florating point and VHDL
- References:
- florating point and VHDL
- From: Amit
- Re: florating point and VHDL
- From: Jonathan Bromley
- florating point and VHDL
- Prev by Date: Re: florating point and VHDL
- Next by Date: Re: florating point and VHDL
- Previous by thread: Re: florating point and VHDL
- Next by thread: Re: florating point and VHDL
- Index(es):
Relevant Pages
|