Division in a fixed point processor


Thread Starter

H. Singh

I have a question.
How do we implement division in a fixed point processor when DIV is not included in the assembly language instruction set but multiplication is.
Shifting right will give division by 2 only.
example how do I divide 200000 by 3535 and get accurate result of 56.
well if u r only interested in integers, i mean if uwant only the quotient and not the fraction like u want to divide 10 by 2 and u can get 5, but if u divide 11/2 u get 5.50. so if u r only interested in 5, use subtraction. keep subtracting divisor from the dividend while dividend is greater than divisor. and at the end the number of iterations will give the quotient.
e.g a=8, b=2, quot=0;
Iteration 1
a = a-b; so a=8-2=6; amd quot+=1; so quot = 1;

Iteration 2
a = a-b; so a=6-2=4; amd quot+=1; so quot = 2;

Iteration 3
a = a-b; so a=4-2=2; amd quot+=1; so quot = 3;

Iteration 1
a = a-b; so a=2-2=0; amd quot+=1; so quot = 4;

and now as a<divisor so we exit from the loop and hence the quotient is 4 as should have been.

take care