1 / 29

Multiplication Division

Multiplication Division. Multiplicand - 1000 Multiplier - 1001 1000 0000 0000 1000 Product 1001000 ten. Multiplication concepts. Product bits > either multiplicand or multiplier bits. Product bits = # of multiplicand bits + # of multiplier bits.

julie
Download Presentation

Multiplication Division

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multiplication Division

  2. Multiplicand - 1000 Multiplier - 1001 1000 0000 0000 1000 Product 1001000ten Multiplication concepts

  3. Product bits > either multiplicand or multiplier bits. Product bits = # of multiplicand bits + # of multiplier bits. Multiplication Steps Place a copy of multiplicand in proper place if multiplier digit = 1. Place 0 in the proper place if multiplier digit = 0. Concepts

  4. Multiplication hardware – Version1 • Multiplicand is 32 bits. • Initialize product = 0. • Need to move multiplicand left one digit during each step. • Here we will move a total of 32 times. • Multiplicand – 64 bit to align with 64 bit product register.

  5. Multiplication algorithm

  6. Multiplication algorithm contd..Multiply 2ten, 3ten, or 0010two X0011two

  7. Half of multiplicand bits are wasted. 64-bit ALU not a good idea. Slow algorithm. Instead of shifting multiplicand left, shift product right? Multiplicand fixed relative to product. Adder need only be 32 bits wide. Change halves width of ALU and Mcand. 32-bit sum is formed, only left half of 64-bit product register is changed by the addition. Second version of algorithm.

  8. Second version - hardware

  9. Second version of algorithm.

  10. Second version of algorithmmultiply 0010two X 0011two

  11. Product wasted space = size of the multiplier. As product wasted space disappears, so does the multiplier : gets shifted out… Suggestion: combination of rightmost half of product with multiplier. Final version

  12. Final version - hardware

  13. Final version - algorithm

  14. Observation: many ways to obtain a product. Purpose: speed – shifting was faster than addition. Also handles signed numbers. Replace a string of 1’s in the multiplier with initial subtract when we first see a 1. Later add when we seethe bit after the last 1. Booth recoding

  15. 0010two X0110two + 0000 shift (0 in multiplier) - 0010 sub (first 1 in multiplier) + 0000 shift (middle of string of 1’s) + 0010 add (prior step had last 1) 00001100two Example

  16. Key – classification of numbers into groups. End of runmiddle of runbeginning of run Booth recoding

  17. Depending on the current and previous bits of multiplier: 00: Middle of a string of 0s so no arithmetic operation. 01: End of a string of 1’s, so add Mcand to left half of the product. 10: Beginning of a string of 1’s, so subtract the Mcand from the left half of the product. 11: Middle of a string of 1’s, so no arithmetic operation. *******when shifting a negative number, always preserve the sign******** Booth’s algorithm

  18. Booth recoding contd.

  19. 5ten X 2ten using a left shift. 101two = 5ten Shift left 1 bit  1010two = 10ten 5ten X 2ten = 10ten Multiply 2i via shift

  20. Long division 1001ten Quotient Divisor 1000ten 1001010ten Dividend -1000 10 101 1010 1000 10ten Remainder Dividend = Quotient X Divisor + Remainder Division

  21. First version • 32-bit quotient register. • Each step moves the divisor to the right one bit. • Start with divisor placed in the left half of the 64-bit divisor register • Shift it right 1 bit each step to align it with the dividend. • ***Remainder register is initialized with the dividend.

  22. First version • If remainder is +ve, • Step 2a generates a 1 in the quotient. else, • Step 2b generates a 0 in the quotient and adds the divisor to the remainder. • Final shift aligns the divisor.

  23. Divide 710 by 210: 0000 01112 by 00102

  24. Second version • Only half the divisor contains useful data at any one time and so the divisor can be split in two. • Shift remainder left and shift divisor right results in alignment needed and also simplifies hardware.

  25. Final version • Eliminate quotient register. Shift quotient into remainder instead of shifting in zeros. • Algorithm has only 2 steps

  26. Final version -hardware • Start by shifting rem. Left. • This serves to shift both the remainder and the quotient. • Consequence: will shift rem. one time too many. • Final correction to shift back only the rem. half of the register.

  27. Divide 000001112 by 00102

More Related