CS 370 – Spring 2005
Introduction
to Digital Design
Instructor:
Carl Ebeling
Homework Set 7
DISTRIBUTED:
May 13
DUE: May 20, Start of class
Collaboration Policy:
Unless otherwise noted, you may collaborate with other CSE370 students on the
homework assignments. Do not look at homework or exam solutions from previous
years. You must spend at least 15 minutes working on a problem before seeking
assistance. Collaboration means that you may discuss the problems and make
notes during the discussion, but you may not look at other student’s work
when writing up your homework. Your homework represents your own work—the
homework must show that you understand the material and have worked as an
individual on every problem. You may not divide up the task of doing the problem
sets in the interpretation of collaboration. You may discuss lecture material
with anyone.
Late Homework Policy:
The weekly assignments are due at the beginning of class. Assignments handed in
during or immediately after class will incur a 10% penalty.
We will penalize your assignment 10% per day for each additional day late.
Please show all of your work. Your solutions
must be legible…we will not spend time trying to decipher poorly written
assignments.
The test fixtures for this homework are linked here and are in the course hw7 folder.
In this assignment, you will continue the design of a simple processor. You will start with the register file and ALU that you’ve already designed, and add a simple controller that can execute very simple programs.
1. (100) The text fixture for the register executed ALU commands that take values from two registers and stores the result value back to a register. We will now make our own controller that contains instructions that are executed on this simple datapath, one at a time in sequence.
The figure below shows our simple controller, which uses a ROM (the iram module) to generate the control signals for the datapath. The PC0 module (program counter) is a simple counter that starts at 0 on reset, and then increments each clock cycle. Together these implement a simple state machine that starts in state ‘0’ and progresses through state ‘1’, ‘2’, etc. executing an ALU operation in each state. That is, the iram contains a simple program of instructions that are executed one at a time.
The iram is a table of 16-bit “instructions”, whose format is shown above. RA, RB and RD are the addresses of the A and B source registers of the D destination register. Note that these are 3-bit values, but since we have only 4 registers, we will use only the two low-order bits. The ALU Op is the opcode you used in the design of your ALU.
Construct the simple processor shown above. You will have to connect the register file and alu control signals yourself. The file iram0.dat is a text file that is read automatically by the simulator to initialize the values in the ROM. The first few instructions are listed below. This program implements doubling, although not particularly efficiently. The file should go in the design folder, i.e. the parent of the src folder.
10110_000_00_000_000 // R0 = 0
10010_001_00_000_000 // R1 = R0 + 1
10011_010_00_001_000 // R2 = R1
10000_001_00_001_010 // R1 = R1 + R2
10011_010_00_001_000 // R2 = R1
10000_001_00_001_010 // R1 = R1 + R2
10011_010_00_001_000 // R2 = R1
10000_001_00_001_010 // R1 = R1 + R2
10011_010_00_001_000 // R2 = R1
Write your own program in a new file that computes the Fibonacci numbers: 1,1,2,3,5,8,13,… The file name is a parameter of the iram module – right-click the module to change the parameter and then recompile.
1) Schematic of your simple processor
2) Printout of your Fibonacci program
3) Timing diagram of the program running, showing the values of the registers
in the register file