____________________________________
Input: a = ( 0, am-1 , …, a0 )
b = ( bn-1 , …, b0 )
A = ( 0, am-1 , …, am-n+1 )
Output: q = a div b and r = a mod b
_____________________________________
b _ CPL2n (b)
for j = 1 to (m – n + 1) do
a _ SHLm+1(a , 1)
_ _ carry
A _ ADDn (A , b)
_ _ _ _ carry
if (_ _) then b _ CPL2n (b)
A _ ADDn (A , b)
b _ CPL2n (b)
else LSB(a) = 1
end for
b _ CPL2n (b)
/* b = ‘’- b ’’ */
/* Shift */
/* Subtract */
/* Correction*/
/* quotient bit*/
Previous slide | Next slide | Back to first slide | View graphic version |