Preview

standard book ok computer architecture

Good Essays
Open Document
Open Document
1292 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
standard book ok computer architecture
Binary Multiplication
CMPE 325 Computer
Architecture II

• At each step we multiply the multiplicand by a single digit from the multiplier.
– In binary, we multiply by either 1 or 0 (much simpler than decimal).

Cem Ergün
Eastern Mediterranean University

• Keep a running sum instead of storing and adding all the partial products at the end.

Multiplication & Division Algorithms
Cem Ergun

Multiplication

Implementing Multiplication

• Long-hand multiplication (12 × 9 = 108)
1 1 0 0 = 12ten
× 1 0 0 1 = 9ten
----------------------1 1 0 0
0 0 0 0 0
0 0 0 0 0 0
+ 1 1 0 0 0 0 0
----------------------1 1 0 1 1 0 0 = 108ten

2
Multiplication & Division Algorithms

• Several different ways to implement
• Things to note about previous method

(n bit Multiplicand)
(m bit Multiplier)

– At each step we either copied or set the value to 0
– LSBs of the product don’t change once computed
⇒ Can form product by shifting and adding

• Solution #1
– Shift multiplicand left at each step (same as adding 0’s)
– Shift multiplier right so we can always consider the 0’th bit

(n + m bit Product)

• The result is a number that is n + m - 1 bits long

Cem Ergun

3
Multiplication & Division Algorithms

Solution #1:
Operations

• Multiplication without sign (12 × 9 = 108)
(n bit Multiplicand)
(m bit Multiplier)

Multiplicand

0 0 0 0
1 1 1

Multiplier

0 0 0 0
1 1

Multiplier0 = 1

1. Test
Multiplier0

Multiplier0 = 0

1a. Add multiplicand to product and place the result in Product register

2. Shift the Multiplicand register left 1 bit

3. Shift the Multiplier register right 1 bit

1 0 0 1

Product

4
Multiplication & Division Algorithms

Start

Solution #1
1 1 0 0 = 12ten
× 1 0 0 1 = 9ten
----------------------1 1 0 0
0 0 0 0 0
0 0 0 0 0 0
+ 1 1 0 0 0 0 0
----------------------1 1 0 1 1 0 0 = 108ten

Cem Ergun

1 1 0 0
0 0

32nd repetition?

No: < 32 repetitions

Yes: 32

You May Also Find These Documents Helpful