Presentation is loading. Please wait.

Presentation is loading. Please wait.

Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000.

Similar presentations


Presentation on theme: "Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000."— Presentation transcript:

1 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000

2 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 1 - 1000 0001 (partial remainder)

3 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 1 - 1000 00010

4 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 1010 - 1000 00010

5 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 10 - 1000 000100

6 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 100 - 1000 000100

7 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 100 - 1000 0001000

8 Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000 1001 (quotient) - 1000 0001000 - 0001000 0000000 (remainder)

9 Integer division Pencil and paper binary division Steps in hardware  Shift the dividend left one position  Subtract the divisor from the left half of the dividend  If result positive, shift left a 1 into the quotient  Else, shift left a 0 into the quotient, and repeat from the beginning  Once the result is positive, repeat the process for the partial remainder  Do n iterations where n is the size of the divisor 01001000 (dividend)(divisor) 1000 1001 (quotient) - 1000 0001000 - 0001000 0000000 (remainder)

10 Integer division Initial state 01001000 (dividend)(divisor) 10000000 (quotient)

11 Integer division Shift dividend left one position 10010000 (dividend)(divisor) 10000000 (quotient)

12 Integer division Subtract divisor from left half of dividend 10010000 (dividend)(divisor) 10000000 (quotient) - 1000 00010000 (keep these bits)

13 Integer division Result positive, left shift a 1 into the quotient 10010000 (dividend)(divisor) 10000001 (quotient) - 1000 00010000

14 Integer division Shift partial remainder left one position 10010000 (dividend)(divisor) 10000001 (quotient) - 1000 00100000

15 Integer division Subtract divisor from left half of partial remainder 10010000 (dividend)(divisor) 10000001 (quotient) - 1000 00100000 - 1000 11010000

16 Integer division Result negative, left shift 0 into quotient 10010000 (dividend)(divisor) 10000010 (quotient) - 1000 00100000 - 1000 11010000

17 Integer division Restore original partial remainder (how?) 10010000 (dividend)(divisor) 10000010 (quotient) - 1000 00100000 - 1000 11010000 00100000

18 Integer division Shift partial remainder left one position 10010000 (dividend)(divisor) 10000010 (quotient) - 1000 00100000 - 1000 11010000 01000000

19 Integer division Subtract divisor from left half of partial remainder 10010000 (dividend)(divisor) 10000010 (quotient) - 1000 00100000 - 1000 11010000 01000000 - 1000 11000000

20 Integer division Result negative, left shift 0 into quotient 10010000 (dividend)(divisor) 10000100 (quotient) - 1000 00100000 - 1000 11010000 01000000 - 1000 11000000

21 Integer division Restore original partial remainder 10010000 (dividend)(divisor) 10000100 (quotient) - 1000 00100000 - 1000 11010000 01000000 - 1000 11000000 01000000

22 Integer division Shift partial remainder left one position 10010000 (dividend)(divisor) 10000100 (quotient) - 1000 00100000 - 1000 11010000 01000000 - 1000 11000000 10000000

23 Integer division Subtract divisor from left half of partial remainder 10010000 (dividend)(divisor) 10000100 (quotient) - 1000 00100000 - 1000 11010000 01000000 - 1000 11000000 10000000 - 1000 00000000

24 Integer division Result positive, left shift 1 into quotient 10010000 (dividend)(divisor) 10001001 (quotient) - 1000 00100000 - 1000 11010000 01000000 - 1000 11000000 10000000 - 1000 00000000 (remainder)

25 Integer division Hardware implementation What operations do we do here? Load dividend here initially


Download ppt "Integer division Pencil and paper binary division 01001000 (dividend)(divisor) 1000."

Similar presentations


Ads by Google