Division Circuits
description
Transcript of Division Circuits
![Page 1: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/1.jpg)
1
Division Circuits
Jan 2013
Shmuel WimerBar Ilan University, Engineering Faculty
Technion, EE Faculty
![Page 2: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/2.jpg)
2Jan 2013
Sequential DivisionLike sequential multiplication of k-bit operands, yielding a 2k-bit product, the division of 2k-bit dividend by k-bit divisor can be realized in k cycles of shift and subtraction.
2 1 2 2 1 0
1 2 1 0
1 2 1 0
1 2 1 0
: Dividend: Divisor: Quotient
: , Reminder
k k
k k
k k
k k
z z z z zd d d d dq q q q q
s z q d s s s s s d
![Page 3: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/3.jpg)
3Jan 2013
2k bitsk bits
First subtraction must consider k+1 MSBs for non negative difference. Considering k bits would mean that quotient is 2k at least, which requires k+1 bits at least.
![Page 4: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/4.jpg)
4Jan 2013
Since for unsigned division we have q<2k and s<d, to
avoid overflow we must have
z<(2k-1)d+d=2kd
d must be strictly greater than the k MSBs of z, as
otherwise the quotient would have more than k bit.
This is called overflow detection and done prior to
division and can be used also to detect division by
zero.
![Page 5: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/5.jpg)
5Jan 2013
Fractional Division
2 22 2 2 2k k k kz d q s z d q s
Unsigned integer and unsigned fractional can be converted to each other as follows
Since z is 2k-bit and d, q, and s are k-bit, we obtain
frac frac frac frac2 kz d q s
We can therefore divide fractions just as integers, except that the reminder is right shifted by k bits.
Overflow detects that zfrac < dfrac , as otherwise the quotient would be no smaller than 1.
![Page 6: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/6.jpg)
6
Sequential Bit-at-a-Time Division
Jan 2013
It is performed by initializing s(0)=z, and successively
subtracting from it the properly shifted terms qk-jd.
Rather than shifting qk-jd rightwards, we shift the
partial quotient leftward, leading to left-shift division
algorithm.
1 02 2 with and 2j j kk kk js s q d s z s s
shift left
subtract
![Page 7: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/7.jpg)
7Jan 2013
1 02 2 with and 2j j kk kk js s q d s z s s
shift left
subtract
2k pre multiplies d to unsure proper alignment. After k iterations the above recursion turn into
02 2 = 2 2k k k k ks s q d z q d s
1 0frac frac fracfrac frac frac frac2 with and 2j j k k
js s q d s z s s
In the fractional version the dividend is aligned to the radix point. The bits of the quotient begin from -1.
![Page 8: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/8.jpg)
multiply divisor by 2k
initialize reminderleft-shiftsubtract
left-shiftsubtract
left-shiftsubtract
left-shiftsubtract
Jan 2013 8
![Page 9: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/9.jpg)
9Jan 2013
1fracfrac frac
0fracfrac
fracfrac
2
with
and 2
j jj
k k
s s q d
s z
s s
In fractional division the dividend is aligned to the radix point. The bits of the quotient begin from -1.
![Page 10: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/10.jpg)
10Jan 2013
Unlike multiplication that can be done by right and
left shifts, division can be done only by left shift.
This follows from the bit of the quotient that are
known progressively, starting from MSB. In
multiplication, then multiplier bits are known in
the outset.
![Page 11: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/11.jpg)
11Jan 2013
The partial reminder is left shifted and its MSB is loaded into a special FF.
A trial difference2s(j-1)-qk-j(2kd) is computed.
![Page 12: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/12.jpg)
12Jan 2013
![Page 13: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/13.jpg)
13Jan 2013
![Page 14: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/14.jpg)
14Jan 2013
![Page 15: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/15.jpg)
15Jan 2013
![Page 16: Division Circuits](https://reader035.fdocuments.us/reader035/viewer/2022081604/568165d2550346895dd8dfc6/html5/thumbnails/16.jpg)
16Jan 2013