Steam-powered Turing Machine University of Washington Computer Science & Engineering
 CSE 378 Fall 2006
  CSE Home     CSE 378 Fall 2006  About Us    Search    Contact Info 

 Home
Administrative
 Syllabus
 Office Hours
 Mailing List
Assignments
 Reading
 Homework
 Labs
 Exams
Resources
 Lecture Slides
 Handouts
 Wiki
 MIPS Resources
 AHDL Resources
Anonymous Feedback
 Feedback Form
   

Arithmetic Components

The center of the computer is the Arithmetic and Logic Unit, but we also provide a simple adder component for use in computing branches and offsets. 

Module: Adder

    Simple unsigned adder of arbitrary size. No overflow checking 

Parameters:

 
Name Default Description
WIDTH 32 bit width of inputs and outputs

Port Description:

 
Name Dir Width Description
inA In WIDTH one input for the addition
inB In WIDTH second input for the addition
out Out WIDTH out = inA + inB

Symbol:

 
This is a variable width module. When connecting buses to the ports of this module, you must specify the width of the bus, or it will default to an 8-bit bus.

Module: MIPSALU

This is an ALU that supports the full complement of arithmetic and logical operations of both signed and unsigned varieties. In general, the only difference between signed and unsigned operations is the overflow checking. Signed operations perform overflow checking, while unsigned operations do not.  The lone exception is the Set on Less Than (SLT) operation.  Consider the following case:

SLTI
SLTIU
$t0, $0, 0xFFFF
$t1, $0, 0xFFFF
# $t0 = 0. SignExt(0xFFFF) = -1 (2's complement)
# $t1 = 1. SignExt(0xFFFF) = 2^32-1 (unsigned)
 

This happens because the unsigned version compares the numbers as unsigned numbers, while the signed version treats them as 2's complements numbers.  It's worth noting that SLTIU still performs sign extension on its immediate.    

Note: Does not implement any shift operations.

Parameters:

 
Name Default Description
AND 0 control code for logical AND
OR 1 control code for logical OR
ADD 2 control code for Addition
ADDU 3 control code for unsigned addition
SUBU 4 control code for unsigned subtraction
SUB 6 control code for subtraction
SLT 7 compare A and B as 2's complement numbers
SLTU 8 compare A and B as unsigned numbers
XOR 9 control code for XOR
NOR 12 control code for logical NOR
 

Port Description:

 
Name Dir Width Description
A In 32 left hand operand
B In 32 right hand operand
ALUctl In 4 determine which operation to perform
ALUOut Out 32 result of the operation
Zero Out 1 (ALUOut == 0)? 1 : 0
Overflow Out 1 Overflow status of signed operations

Symbols:

 


CSE logo Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to Course Staff]