1 / 10

CSCI206 - Computer Organization & Programming

This document discusses the revised algorithm for integer multiplication in computer organization and programming. It covers the use of the 10.3.2's Complement Multiplication in zyBook and provides an optimized multiplier circuit example.

dsarah
Download Presentation

CSCI206 - Computer Organization & Programming

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. CSCI206 - Computer Organization & Programming Integer Multiplication Revised by Alexander Fuchsberger and Xiannong Meng in spring 2019 based on the notes by other instructors. zyBook: 10.3

  2. 2’s Complement Multiplication For powers of 2, multiply is trivial (shift left). else use elementary algorithm:

  3. Algorithm In general, multiplying a M bit number times a N bit number results in M + N bits multiplicand multiplier product = 0; for (i = 0; i < N; i ++) { if (multiplier[i] == 1) // shift m by i bits then add // m remains the same! product += multiplicand << i; product Demo mult.c

  4. Signed Multiplication • This algorithm works for unsigned numbers. • For signed numbers, multiply the absolute values and then add the proper sign to the result.

  5. Signed Multiplication • Resulting sign is • + x+ = + • + x - = - • - x + = - • - x - = + • In general: • xor of input sign bits to get resulting sign bit

  6. The Multiplier 1011 multiplicand x 1110 multiplier ----------------------------- • Setup • multiplicand in lower half of multiplicand register (2n bits) • multiplier in multiplier register (n bits) • product register is zero (2n bits)

  7. The Multiplier

  8. 0010 x 0011 = ???? Example 1

  9. 0010 x 0011 = 0110

  10. Optimized Multiplier Basic circuits Multiplier is initialized in the left half of the product register. Now we shift product register right. The multiplicand is 32-bits and not shifted because the result is written to the correct position in the product register after 32 right shifts. Product is the MIPS hi/lo registers Optimized one

More Related