1 / 11

Binary Multipliers

Binary Multipliers. The key trick of multiplication is memorizing a digit-to-digit table… Everything else was just adding. You’ve got to be kidding… It can’t be that easy. Reading: Study Chapter 3. The “Binary” Multiplication Table. Hey, that looks like an AND gate. X. 0. 1. 0. 0. 0. 1.

loman
Download Presentation

Binary Multipliers

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. Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table… Everything else was just adding You’ve got to be kidding… It can’t be that easy Reading: Study Chapter 3.

  2. The “Binary” Multiplication Table Hey, that looks like an AND gate X 0 1 0 0 0 1 0 1 Binary Multiplication Binary multiplication is implemented using the same basic longhand algorithm that you learned in grade school. A0 A1 A2 A3 B0 B1 B2 x B3 A0B0 A1B0 A2B0 A3B0 AjBi is a “partial product” A0B1 A1B1 A2B1 A3B1 A0B2 A1B2 A2B2 A3B2 A0B3 + A1B3 A2B3 A3B3 Multiplying N-digit number by M-digit number gives (N+M)-digit result Easy part: forming partial products (just an AND gate since BI is either 0 or 1) Hard part: adding M, N-bit partial products

  3. 1 . T e s t M u l t i p l i e r 0 1 a . A d d m u l t i p l i c a n d t o p r o d u c t a n d p l a c e t h e r e s u l t i n P r o d u c t r e g i s t e r 2 . S h i f t t h e M u l t i p l i c a n d r e g i s t e r l e f t 1 b i t 3 . S h i f t t h e M u l t i p l i e r r e g i s t e r r i g h t 1 b i D o n e Multiplication: Implementation S t a r t M u l t i p l i e r 0 = 1 M u l t i p l i e r 0 = 0 t N o : < 3 2 r e p e t i t i o n s 3 2 n d r e p e t i t i o n ? Y e s : 3 2 r e p e t i t i o n s

  4. 1 . T e s t M u l t i p l i e r 0 1 a . A d d m u l t i p l i c a n d t o t h e l e f t h a l f o f t h e p r o d u c t a n d p l a c e t h e r e s u l t i n t h e l e f t h a l f o f t h e P r o d u c t r e g i s t e r 2 . S h i f t t h e P r o d u c t r e g i s t e r r i g h t 1 b i t 3 . S h D o n e Second Version S t a r t M u l t i p l i c a n d 3 2 b i t s M u l t i p l i e r 0 = 1 M u l t i p l i e r 0 = 0 M u l t i p l i e r 3 2 - b i t A L U S h i f t r i g h t 3 2 b i t s S h i f t r i g h t P r o d u c t C o n t r o l t e s t W r i t e 6 4 b i t s i f t t h e M u l t i p l i e r r e g i s t e r r i g h t 1 b i t N o : < 3 2 r e p e t i t i o n s 3 2 n d r e p e t i t i o n ? Y e s : 3 2 r e p e t i t i o n s

  5. Iteration Step Multiplier Multiplicand Product 0 Initial 1011 0010 0000 0000 1 Test trueshift right 10110101 0010 0010 00000001 0000 2 Test trueshift right 01010010 0010 0011 00000001 1000 3 Test falseshift right 00100001 0010 0001 10000000 1100 4 Test trueshift right 00010000 0010 0010 11000001 0110 Example for second version

  6. 1 . T e s t P r o d u c t 0 1 a . A d d m u l t i p l i c a n d t o t h e l e f t h a l f o f t h e p r o d u c t a n d p l a c e t h e r e s u l t i n t h e l e f t h a l f o f t h e P r o d u c t r e g i s t e r 2 . S h i f t t h e P r o d u c t r e g i s t e r r i g h t 1 b i t 3 2 n d r D o n e Final Version S t a r t M u l t i p l i c a n d 3 2 b i t s P r o d u c t 0 = 1 P r o d u c t 0 = 0 3 2 - b i t A L U C o n t r o l S h i f t r i g h t P r o d u c t t e s t W r i t e 6 4 b i t s The trick is to use the lower half of the productto hold the multiplier during the operation. N o : < 3 2 r e p e t i t i o n s e p e t i t i o n ? Y e s : 3 2 r e p e t i t i o n s

  7. What about the sign? • Positive numbers are easy. • How about negative numbers? • (see Booth coding in textbook)

  8. Faster Multiply A1 & B A0 & B A2 & B A2 & B A31 & B P32-P63 P2 P1 P0 P31

  9. tPD = 10 * tPD,FA A Co B S A Co B S A Co B S A Co B S HA HA HA HA not 16 A B The Logicof a Half-Adder CO S Simple Combinational Multiplier tPD = (2*(N-1) + N) * tPD,FA Components N * HA N(N-1) * FA NB: this circuit only works for nonnegative operands

  10. These Adders can be removed, and the AND gate outputs tied directly to the Carry inputs of the next stage. This small improvement in performance hardly seems worth the effort, however, this design is easier to pipeline. Carry-Save Combinational Multiplier Observation: Rather than propagating the sums across each row, the carries can instead be forwarded onto the next column of the following row tPD = 8 * tPD,FA tPD = (N+N) * tPD,FA Components N * HA N2 * FA

  11. Division Start 1. Subtract Divisor from the Remainder leave the result in the Remainder >=0 <0 Test Remainder Restore Remainder by adding DivisorShift Quotient to the leftset its rightmost bit = 0 Shift Quotient to the leftset its rightmost bit = 1 Shift Divisor Register right 1 bit Repeat 33times

More Related