Re: Fastest way to compute floating point log and exp



Marc Battyani wrote:

I'm looking at the fastest way to compute floating point (32bit) log and exp
on an FPGA (Stratix II or Virtex 4). It must be faster than a 3.6GHz Xeon
which can do that in 18.5 clock cycles on average on a 1000 float vector
(using SSE3)

So far I've found that with a few tables and floating point MUL and ADD
blocks I should be able to do that at 160MHz on a Stratix II (not tested
yet). It's still slower than the Xeon but at least it's close. I've looked
at cordic at a glance, but it looks slower or bigger if totally unrolled.

Any ideas or pointers on a better way to do that?

Thanks

Marc




You didn't mention how much precision you need, nor for that matter what the log base is to be. Log
is actually easier to compute for a floating point argument, since the significand is already presumably
normalized, which reduces the complexity of computing the log since the range is limited. for fixed point,
the usual approach is to normalize it first, essentially converting to floating point. Log base 2 is a little
bit easier than other bases because the floating point exponent is the integer portion of the log. The fraction
portion can be computed with a small (4 input) look-up to get you to 1/2 dB or so. If you need more
precision, there are iterative techniques that can get you to whatever precision you need. Exponent is the
reverse: you use a look-up to exponentiate the fractional portion and then use the integer portion to control
how much the exponentiated fraction is shifted. This can be pipelined, and run at over 200 MS/sec in a single
thread in Spartan3 FPGAs, faster in premium devices.


Do you need the log in floating point too, or is it fixed point log notation? Most importantly, what is the precision requirement?

--
--Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
401/884-7930 Fax 401/884-7950
email ray@xxxxxxxxxxx http://www.andraka.com


"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
-Benjamin Franklin, 1759



.



Relevant Pages

  • Re: Fastest way to compute floating point log and exp
    ... >>So far I've found that with a few tables and floating point MUL and ADD ... > You didn't mention how much precision you need, ... > bit easier than other bases because the floating point exponent is the ... > integer portion of the log. ...
    (comp.arch.fpga)
  • Re: Calculate the precision of a floating point number (ie: the number of decimal places)
    ... Your definition of precision does not correspond to standard ... when the number is converted from floating format (basically ... By your rules it is some constant minus the the exponent of ...
    (comp.programming)
  • Re: Precision
    ... Whether one does the subsequent calculations in internal ie integer format ... I have always used external format with Precision 4 since my ... floating point calcs which are done in binary have around 3% error albeit at ... positions it is IMPOSIBLE to have a result of 4 decimals with the 2 ...
    (comp.databases.pick)
  • Re: Linear Algebra Challenge
    ... Since I'm using floating point, so I'll never be able to calculate one ... floating point math set to 99 digits. ... As close as I'm willing to wait if I use arbitrary precision. ... This mode is fast; when you select arbitry ...
    (comp.sys.hp48)
  • Re: Floating point environment
    ... In all functions like fetestexcept, for instance, it is assumed that there is only one floating point environment ... one for double precision ... the 64 bit format and another for the 80 bit format. ... All versions of SSE use a status/control word separate from the main FPU, however, so they can indeed be considered a separate environment. ...
    (comp.std.c)

Loading