EE357Unit2b_Division

EE357Unit2b_Division - EE 357 Unit 2b Division Techniques...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 © Mark Redekopp, Al rights reserved EE 357 Unit 2b Division Techniques © Mark Redekopp, Al rights reserved DIVISION TECHNIQUES Restoring Division Non-Restoring Division © Mark Redekopp, Al rights reserved Binary Division • Performed using same rules as decimal division 1001 -10 0001 10 0100 r. 0001 Human Method Check whether divisor can divide the dividend (dividend >= divisor) in our heads Divisor Dividend Quotient © Mark Redekopp, Al rights reserved Restoring Division • Computer must subtract to check if current portion of the dividend >= divisor 1001 -10 11 +10 010 - 010 0000 - 0010 1110 +0010 00001 - 00010 11111 +00010 00001 10 Sub 2 Neg. => Can’t Divide (q=0) Add 2 (Restore) Get next bit Sub 2 Pos. => Divides (q=1) / Get next bit Sub 2 Neg. => Can’t Divide (q=0) Add 2 (Restore) Get Next bit Sub 2 Neg. => Can’t Divide (q=0) Add 2 (Restore) Remainder = 0001 0100 r. 0001
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 © Mark Redekopp, Al rights reserved Restoring Division • Sequential algorithm • Similar to long division method • Produce 1 bit of quotient each iteration • Three n -bit Registers, 1 Adder – M = Divisor – Q = Start: Dividend / Finish: Quotient – A = Start: 0 / Finish: Remainder • Q will end with the n -bit quotient • A will end with the remainder © Mark Redekopp, Al rights reserved 0 0010 A Q M Cout Cin 0 Division Hardware 0 0 0 1 0 0 1 2’s comp. Adder 0010 1110 Q(0) Logic msb © Mark Redekopp, Al rights reserved Restoring Algorithm Repeat n times 1. Shift A and Q left one bit 2. A = A – M 3. Set q and possibly restore a. If MSB of A is 1 (negative), q 0 =0 and do A=A+M (restore) b. If MSB of A is 0 (positive), q 0 =1 © Mark Redekopp, Al rights reserved
Background image of page 2
3 © Mark Redekopp, Al rights reserved 0 0010 A Q M Cout Cin 0 A Q Restoring Division 0000 1001 0 0 0 1 0 0 1 M = 0010 2’s comp. Adder 0010 1110 © Mark Redekopp, Al rights reserved 0 0010 A Q M Cout Cin 0 A Q Restoring Division 0000 1001 0 0 1 0 0 1 M = 0010 2’s comp. 10 1 Shift 001_ 0001 Shift Left Adder 0010 1110 © Mark Redekopp, Al rights reserved 0 0010 A Q M Cout Cin 0 A Q Restoring Division 0000 1001 0 0 1 0 0 1 M = 0010 2’s comp. 0010 1110 10 1 Shift 001_ 0001 Subtract Adder 1111 1111 Sub (Add -2) 1110 + © Mark Redekopp, Al rights reserved 1 0010 A Q M Cout Cin 0 A Q Restoring Division 0000 1001 1 1 1 0 0 1 0 M = 0010 2’s comp. 0010 1110 10 1 Shift 001_ 0001 A is neg. => set q 0 = 0 Adder Sub (Add -2) 1110 + 1 111 001 0 Set q 0 = 0 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 © Mark Redekopp, Al rights reserved 1 0010 A Q M Cout Cin 0 A Q Restoring Division 0000 1001 1 1 1 0 0 1 0 M = 0010 2’s comp. 0010 1110 10 1 Shift 001_ 0001 Restore Adder Sub (Add -2) 1110 + 1 111 001 0 Set q 0 = 0 Restore (+2) 0010 + 0001 0001 0 © Mark Redekopp, Al rights reserved 0 0010 A Q M Cout Cin 0 A Q Restoring Division 0000 1001 0 0 1 0 0 1 0 M = 0010 2’s comp. 0010
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/03/2011 for the course EE 357 taught by Professor Mayeda during the Spring '08 term at USC.

Page1 / 13

EE357Unit2b_Division - EE 357 Unit 2b Division Techniques...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online