arithmetic for computers
play

Arithmetic for Computers October 31, 2008 Arithmetic for Computers - PowerPoint PPT Presentation

Arithmetic for Computers October 31, 2008 Arithmetic for Computers ALU Arithmetic Logic Unit Performs most processor operations Control signal predicates addition subtraction logic operations shifting (w / or w / o sign extension) Figure:


  1. Arithmetic for Computers October 31, 2008 Arithmetic for Computers

  2. ALU Arithmetic Logic Unit Performs most processor operations Control signal predicates addition subtraction logic operations shifting (w / or w / o sign extension) Figure: ALU symbol Arithmetic for Computers

  3. Multiplication Product of n with m bits = n + m bits long More complicated than addition use addition with shifting shift left 1 bit to align with previous sum Arithmetic for Computers

  4. Multiplication Product of n with m bits = n + m bits long More complicated than addition use addition with shifting shift left 1 bit to align with previous sum Figure: Hardware for multiplication 64-bit multiplicand reg.: ∵ will be moved 32 times 32-bit multiplicand in right half; left half: 0‘s Product: initialized to 0‘s Arithmetic for Computers

  5. Multiplication Algorithm Figure: Multiplication using the simple hardware Arithmetic for Computers

  6. Improvement Problem: need 64-bit adder Half bits in multiplicand are 0 Improvement: Don’t shift the multiplicand Shift product right ! Add it to product on the left Shift product to right Figure: Improved hardware Arithmetic for Computers

  7. New Algorithm Arithmetic for Computers

  8. Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Arithmetic for Computers

Recommend


More recommend