Building a MIPS ALU

Tom Kelliher, CS 240

Feb. 17, 1999

Administrivia

Announcements

Assignment

From Last Time

Addition, subtraction, logical operations.

Outline

  1. Building blocks.

  2. One bit full adder.

  3. One bit ALU.

  4. 32 bit ALU.

  5. MIPS ALU.

Coming Up

Lookahead.

Building an ALU

Important design principle: reuse.

Basic logic gates:

  1. Two-input AND gate.

    Constructing a larger fan-in gate from smaller gates.

  2. Two-input OR gate.

    Constructing a larger fan-in gate from smaller gates.

  3. Inverter.

  4. 2-1 Multiplexor.

    Symbol:

Abbreviated truth table:

Remember: It is a switch. Full truth table, SOP equation, Karnaugh map, implementation.

A one-bit two function logical unit:

Constructing a 4-1 mux from 2-1 muxes.

One Bit Full Adder

Recall the addition table:

Write SOP equations for sum and carry-out. Minimize. Implement.

Block diagram:

An ALU

A one-bit three operation ALU:

A 32-bit three operation ALU:

Ripple carry addition. How fast/slow?

A MIPS ALU

What additional functionality needed?

  1. Subtraction.

  2. slt instruction.

  3. beq/ bne comparison.

  4. Overflow detection.

Subtraction

  1. Complementing the b input: additional control signal.

  2. Adding the 1.

slt

  1. result = (a - b) < 0

  2. Additional mux input to one bit ALU.

  3. Need adder output from msb; wraparound to lsb position.

Branch Comparisons

Need signal to indicate that result equals 0.

Overflow Detection

Inputs: operation, signs of a, b, result.

Why carry-out in Figure 4.17?

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
Tue Feb 16 22:39:34 EST 1999
Tom Kelliher