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

arithmetic for computers
SMART_READER_LITE
LIVE PREVIEW

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:


slide-1
SLIDE 1

Arithmetic for Computers

October 31, 2008

Arithmetic for Computers

slide-2
SLIDE 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

slide-3
SLIDE 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

slide-4
SLIDE 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

slide-5
SLIDE 5

Multiplication Algorithm

Figure: Multiplication using the simple hardware

Arithmetic for Computers

slide-6
SLIDE 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

slide-7
SLIDE 7

New Algorithm

Arithmetic for Computers

slide-8
SLIDE 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