1 / 14

Unsigned Multiplication - Shift Multiplicand Left

Csci136 Computer Architecture II Lab#6 Arithmetic Operations HW #5: Due on Mar. 1, before class Feb.23, 2005. Unsigned Multiplication - Shift Multiplicand Left. Example: 4-bit register 0010*0011 Multiplicand: 8 bits Multiplier: 4 bits Product: 8 bits.

zan
Download Presentation

Unsigned Multiplication - Shift Multiplicand Left

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. Csci136 Computer Architecture IILab#6 Arithmetic Operations HW #5: Due on Mar. 1, before classFeb.23, 2005

  2. Unsigned Multiplication- Shift Multiplicand Left • Example: • 4-bit register • 0010*0011 • Multiplicand: 8 bits • Multiplier: 4 bits • Product: 8 bits

  3. Unsigned Multiplication- Shift Multiplicand Left • Initial • Prod+Mcand •  Mcand • Mier  • Cost ??? • Time • Space

  4. Unsigned Multiplication- Shift Product Right • Observations: • Work on one bit each time • 1/2 bits in multiplicand always 0 • least significant bits of product never changed once formed • Save Space? • Example: • 4-bit register • 0010*0011 • Multiplicand: 4 bits • Multiplier: N/A • Product: 8 bits • Save Time? M’cand=0010 Product=0000 0011

  5. Signed Multiplication • Booth’s algorithm

  6. Booth’s algorithm • Example: • M’cand =3 = 0011 • -m’cand=1101 • M’ier = -2 = 1110

  7. Start: Place Dividend in Remainder 1. Subtract the Divisor register from the Remainder register, and place the result in the Remainder register. Remainder < 0 Test Remainder Remainder  0 2a. Shift the Quotient register to the left setting the new rightmost bit to 1. 2b. Restore the original value by adding the Divisor register to the Remainder register, & place the sum in the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to 0. 3. Shift the Divisor register right 1 bit. 33 repetition? No: < 33 repetitions Yes: 33 repetitions Done Unsigned Division- Restoring Division

  8. Unsigned Division- Restoring Division • Example: • 4-bit register • Dividend=0111, divisor=0010 initial Rem = Rem-Div Rem<0+Div, sll, Q0=0 / sll, Q0=1 Div  srl

  9. 31 30 23 22 0 S Exponent Significand 1 bit 8 bits 23 bits Floating-point Representation • IEEE 754 Standard • (-1)S x (1 + Significand) x 2(Exponent-127) • Double precision identical, except with exponent bias of 1023

  10. 1 0111 1101 100 0000 0000 0000 0000 0000 Decimal  Floating-point Representation • Example: -0.375 • -0.375 = -3/8 • -11two/1000two = -0.011two • Normalized to -1.1two x 2-2 • (-1)S x (1 + Significand) x 2(Exponent-127) • (-1)1 x (1 + .100 0000 ... 0000) x 2(125-127)

  11. 1 10000001 010 0000 0000 0000 0000 0000 Floating-point Representation  Decimal • Example: • (-1)S x (1 + Significand) x 2(Exponent-127) • (-1)1 x (1 + 0.25) x 2(129-127)

  12. Floating-point Addition • Example: 0.5ten + -0.4375ten • 0.5ten = 1/2ten = 1.000two x2-1 • -0.4375ten = -7/16ten = -1.110two x2-2 • Alignment: -1.110two x2-2 = -0.111two x2-1 • 1.000two x2-1 +(-0.111two x2-1) = 0.001two x2-1 • Normalization: 0.001two x2-1 = 1.000two x2-4 • Rounding: 4-bit already • 1.000two x2-4 = 0.0625

  13. Floating-point Multiplication • Example: 0.5ten x -0.4375ten • 0.5ten = 1/2ten = 1.000two x2-1 • -0.4375ten = -7/16ten = -1.110two x2-2 • Exponents: (-1+127)+(-2+127)-127 = 124 • Significands: 1.000twox1.110two=1.110000twox2-3 • Normalization: -126≤exp. ≤127 • Rounding: =1.110twox2-3 • Sign: -1.110twox2-3

  14. HW#5 • Example: • 0111/0011: quotient=0010,remainder=0001 • Difference? • Restoring Division: • (Remainder+Divisor)*2 – Divisor • Non-restoring Division: • Remainder*2 + Divisor

More Related