A MIPS ALU

Tom Kelliher, CS 240

Feb. 23, 2004

Administrivia

Announcements

Homework due Wednesday!

Assignment

Read carry lookahead material of 4.5.

From Last Time

String handling, summary of addressing modes, program build process.

Outline

  1. Building an ALU.

Coming Up

Carry lookahead addition.

Building an ALU

Important design principle: reuse.

2-1 mux symbol:

A one-bit two function logical unit:

Recall block diagram for full adder:

An ALU

A one-bit three operation ALU:

A 32-bit three operation ALU:

Ripple carry addition.

A MIPS ALU

What additional functionality needed?

  1. Subtraction.

  2. slt instruction.

  3. beq/ bne comparison.

  4. Overflow detection.

How do we modify the basic ALU to handle these operations?

Notes:

  1. Semantics of slt:
    slt $t0, $t1, $t2
    
    $t0 = ($t1 < $t2);
    

  2. What is overflow?
    1. Adding two unsigned numbers.

      Can the difference of two unsigned numbers result in an overflow?

    2. Adding two signed (both positive or both negative) numbers.

      Difference?

    3. Detecting overflow.

Control Summary

Three input lines:

  1. Subtract b.

  2. Mux select: two lines.

  3. Eight possibilities, five used: and, or, add, subtract, set on less than.



Thomas P. Kelliher
Thu Feb 19 08:42:13 EST 2004
Tom Kelliher