Computer Science 324 |
Lab 6: MIPS Multi-Cycle Control
Due: 4:00 PM, Tuesday, November 20, 2007
Your task in this lab is to build two simulators that are able to execute programs that use the MIPS subset we have discussed in class. You will be working with the MIPS multi-cycle data path as shown in Figure 5.28 of Patterson and Hennessy and the control as described later in Section 5.5 and Section 5.7 on the CD.
You may work alone or in pairs. Everyone should inform me by Thursday, November 13 whether you intend to work individually or have formed a group.
You will implement three components that will be used to construct two simulators:
The data path simulator can be combined with either control simulator to produce a program that can execute simple MIPS programs.
In order to allow our simulators to work together in either combination, we must define the interface between the data path and the control. This is done with a set of functions that have prototypes defined in MIPScontrol.h. Any control implementation must provide implementations of each of these functions.
The data path simulator is to be implemented in the file datapath.c. In order to keep busy work to a minimum, I am providing much of the infrastructure for the data path, including definitions of the state components and a complete main execution loop. You will need to think carefully about how to take the current values of the state elements (registers, memory) and control lines to get the correct values for all state elements at the end of the cycle. For example, if you are both reading the PC to get a memory address and updating its value, you need to make sure you use the old value before replacing it with the new value.
In addition to implementing the data path to function as described in the text, we have this special functionality:
Your finite state control implementation should be done in the file fsm.c. You should implement a finite state machine as described in Chapter 5.5. This implementation is in a sense "hard wired" in that you will explicitly program the details of which control lines are to have particular values (aside: use "don't care" conditions to your advantage to keep code simple!) and how to transition from one state to the next based on the opcode.
Your microprogrammed control implementation should be done in the file microcode.c. You should implement a machine that can read a microprogram from a file and execute it appropriately. This programmability is the advantage of the approach - the implementation of the microsequencer and microcode store are independent of the microcode it executes.
The provided framework in datapath.c includes a main program that takes the name of a memory initialization file. That file is loaded into main memory, the program counter is initialized to 0, and the simulation begins.
The main program interacts with the user through a command prompt. The commands it implements:
As with the MIPS instruction decoding lab (which may be worth looking back at, by the way), I will provide compiled object files of my implementation to aid you as you proceed. You can use the provided Makefile to switch back and forth between my version and your own.
I have also provided a few memory files that you can use. These,
along with the starter framework, are available on the CSLab Linux
systems in
/home/jteresco/shared/cs324/labs/mipscontrol.
In addition to the software you develop, you should include a file rq.txt in your submission with your responses to the following questions:
When you are finished, you are to submit your source code using the turnin utility. Detailed submission instructions will be provided.
In addition to the example programs provided, you should develop a few of your own programs to make sure you test all required functionality. Please include your tests in your submission. I will develop my own tests, will use your submitted tests, plus the ones I provided, to aid in grading.