# CPSC220: Introduction to Computer Architecture (Fall 2013)

## Assignment #6

#### Due at the start of class on Thursday, 11/07/2013

• Patterson & Hennessy, C.7–C.8
• Logisim

## To do

In this assignment, you begin constructing the major components of a simulation of the 32-bit MIPS processor. We will carry out this project over the next several assignments, and each one will build on the previous work. Don't fall behind!

#### PART ONE: The ALU

Your ALU circuit (including all subcomponents) should be in a file named ALU_32.circ.

1. In Assignment 5, you built a 4-bit ALU, supporting 4-bit versions of the MIPS operations and, or, add, sub, slt. Extend that work to a 32-bit version (i.e. 32 bit inputs and result). Note: The hardest part of this is the complexity of laying out so many components, especially the wires and splitters. You'll have a much easier time if you complete this work by implementing a number of sub-components first:

• A 32-bit addition circuit, which takes two 32-bit inputs and outputs a 32-bit result, the least significant bit of the result (as a separate value), and a 1-bit overflow signal. Since overflow can be determined as the XOR of the carry-in and carry-out values on the high-order input bits, you can build this circuit with a 31-bit adder and a 1-bit adder
• A "less than" circuit, which takes two single-bit inputs (the MSB of the subtraction result and the overflow signal) and outputs a 32-bit value
• An "is zero" circuit, which takes one 32-bit input and outputs a one-bit value, signaling whether the input represents 0.

#### PART TWO: The register file

The following steps will take you through the construction of a complete, 32-register file of 32-bit registers. All circuits should be in a file named regfile_32.circ.

1. Implement an S-R latch in Logisim.

2. Use your S-R latch to implement a D-latch, as described on pp. C50–54

3. Use your D-latch to build a rising edge D flip-flop (a "D-flop").

4. Use your D-flop to build an 8-bit register.

5. Use your 8-bit register to build a full, 32-bit register.

6. Using this register, construct a file of 32 registers.