Lecture 05 ALU Design Part 2

# Lecture 05 ALU Design Part 2 - CS M151B / EE M116C Computer...

This preview shows pages 1–9. Sign up to view the full content.

Reinman CSM151B 5-1 CS M151B / EE M116C Computer Systems Architecture ALU Design Part 2 Some notes adopted from Morgan Kaufman Publishing

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Reinman CSM151B 5-2 Multiplication • Start with long-multiplication approach 1000 × 1001 1000 0000 0000 1000 1001000 Length of product is the sum of operand lengths multiplicand multiplier product §3.3 Multiplication
Reinman CSM151B 5-3 Multiplication Hardware Initially 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Reinman CSM151B 5-4 Optimized Multiplier • Perform steps in parallel: add/shift • One cycle per partial-product addition – That’s ok, if frequency of multiplications is low
Reinman CSM151B 5-5 Control test Write 32 bits 64 bits Shift right Product Multiplicand 32-bit ALU Done 1. Test Product0 1a. Add multiplicand to the left half of theproduc tandp lacetheresu l tin thele f tha l fo ftheProductreg is ter 2. Shift the Product register right 1 bit 32nd repetition? Start Product0 =0 Product0 =1 No: < 32 repetitions Yes: 32 repetitions Multiply Example Multiplicand Multiplier Product 1000 (in product) 0000 1001

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Reinman CSM151B 5-6 MIPS Multiplication • Two 32-bit registers for product – HI: most-significant 32 bits – LO: least-significant 32-bits • Instructions – mult rs, rt / multu rs, rt • 64-bit product in HI/LO – mfhi rd / mflo rd • Move from HI/LO to rd • Can test HI value to see if product overflows 32 bits – mul rd, rs, rt • Least-significant 32 bits of product –> rd
Reinman CSM151B 5-7 Signed Multiplication? • Make both positive – remember whether to complement product when done • Apply definition of 2’s complement – need to sign-extend partial products and subtract at the end • Booth’s Algorithm – elegant way to multiply signed numbers • using same hardware as before and save cycles

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Reinman CSM151B 5-8 Example 2 x 6 = 0010 x 0110: 0010 x 0110 + 0000 shift (0 in multiplier) + 0010 add (1 in multiplier) + 0010 add (1 in multiplier) + 0000
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/18/2010 for the course CS 151B taught by Professor N/a during the Spring '10 term at UCLA.

### Page1 / 25

Lecture 05 ALU Design Part 2 - CS M151B / EE M116C Computer...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online