In article <cefsvq$2cbb$>,
Patrice <> wrote:
>Helo
>I use quartus web edition, and made me some routines but
>sundely a saw that there is no math_real library in quarus !
>Does it mean what mathematical operation on real cannot be made
>with this board ?? (i'm interrested in sqrt function)
real=sqrt(real) Forget it
integer=sqrt(integer) Yes in more than one clock
fixedpoint=sqrt(fixedpoint) same as integer
If you can take more than one clock cycle to do it, you can make an
integer or fixedpoint SQRT. The trick is to use Booths[1] method.
[1] At least I think it was Booth, Gauss may be the real father of this.
Basic rule:
N^2 = the sum of the first N odd numbers.
Stupid method = subtract 1,3,5,7.. until it crosses zero.
Optimization:
If you multiply N by 2, you multiply N^2 by 4. As a result, you can get
there quicker if you include some shifting.
--
--
forging knowledge