From: niyander on
Hello,

I am trying to implement (simulation + synthesis) for 32bit floating
point division unit.
To perform division basically the 23+1bit (1 hidden bit) mantissa part
is divided with the other mantissa, and then 8bit exponents are
subtracted and finally normalization is applied.
So for the mantissa division part I am following Binary Division by
Shift and Subtract method (http://courses.cs.vt.edu/~cs1104/Division/
ShiftSubtract/Shift.Subtract.html).
I can use this algorithm if both the mantissa's are such that no
remainder is left (i.e. remainder=0) but if mantissa's are such that a
remainder is left then how can i proceed with the division? if i
proceed then quotient would be inaccurate.

I have already searched google for srt division algorithm but i am not
able to find an simple example. If some one give me srt division
example/algorithm for a value of 22/7 i would really appreciate that.

Thanks
From: glen herrmannsfeldt on
niyander <mightycatniyander(a)gmail.com> wrote:

> I am trying to implement (simulation + synthesis) for 32bit floating
> point division unit.
> To perform division basically the 23+1bit (1 hidden bit) mantissa part
> is divided with the other mantissa, and then 8bit exponents are
> subtracted and finally normalization is applied.
> So for the mantissa division part I am following Binary Division by
> Shift and Subtract method (http://courses.cs.vt.edu/~cs1104/Division/
> ShiftSubtract/Shift.Subtract.html).

> I can use this algorithm if both the mantissa's are such that no
> remainder is left (i.e. remainder=0) but if mantissa's are such that a
> remainder is left then how can i proceed with the division? if i
> proceed then quotient would be inaccurate.

You either truncate or round. Unless you are implementing an
existing architecture, it is your choice. IBM hex floating point
truncates, most of the others, including IEEE, round.

> I have already searched google for srt division algorithm but i am not
> able to find an simple example. If some one give me srt division
> example/algorithm for a value of 22/7 i would really appreciate that.

That will help you do it faster, but it won't change the question
about what to do with a remainder. If shift and subtract, or
more likely a non-restoring algorithm, is fast enough then you
might just as well use it.

-- glen

From: niyander on
On May 8, 9:56 am, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
> niyander <mightycatniyan...(a)gmail.com> wrote:
> > I am trying to implement (simulation + synthesis) for 32bit floating
> > point division unit.
> > To perform division basically the 23+1bit (1 hidden bit) mantissa part
> > is divided with the other mantissa, and then 8bit exponents are
> > subtracted and finally normalization is applied.
> > So for the mantissa division part I am following Binary Division by
> > Shift and Subtract method (http://courses.cs.vt.edu/~cs1104/Division/
> > ShiftSubtract/Shift.Subtract.html).
> > I can use this algorithm if both the mantissa's are such that no
> > remainder is left (i.e. remainder=0) but if mantissa's are such that a
> > remainder is left then how can i proceed with the division? if i
> > proceed then quotient would be inaccurate.
>
> You either truncate or round.  Unless you are implementing an
> existing architecture, it is your choice. IBM hex floating point
> truncates, most of the others, including IEEE, round.  
>
> > I have already searched google for srt division algorithm but i am not
> > able to find an simple example. If some one give me srt division
> > example/algorithm for a value of 22/7 i would really appreciate that.
>
> That will help you do it faster, but it won't change the question
> about what to do with a remainder.  If shift and subtract, or
> more likely a non-restoring algorithm, is fast enough then you
> might just as well use it.  
>
> -- glen

thanks