CIS 451 Project 3: Extend Single Cycle CPU

Author: Zack Kurmas, with modifications by Andrew Kalafut

Objective: Use JLS to extend the the Single Cycle CPU from project 2 to support additional instructions, so that it will run code generated by a compiler. Additionally, this time you must write your own control unit.


  1. Add a text box to your jls files that includes
  2. Upload all relevant .jls files (please include a seperate JLS file for your control unit), bug reports, and assembly code to the assignment on Blackboard by 11:59 PM on 4/3/2013 4/10/2013.
  3. Print and submit hard copies of all new circuit diagrams. (When printing diagrams use the "File -> Print -> Just Visible Window" option. There should be one page per .jls file.)
  4. Write a brief document stating the maximum delay and number of gates used by your control unit. Include an explanation of how you calculated your results. There are no length requirements for this document: It need only be long enough to convince me your calculations are correct.
  5. Fill out an evaluation of your partner for this project. The evaluation form may be found on blackboard, and is due in lab on 4/4/2013 4/11/2013.

This project should be done in groups of 2. A group of 3 may be acceptable with permission of the instructor if there are an odd number of students.


You will need a working version of the CPU from project 2.


Add the following instructions to your single-cycle CPU. Your CPU must continue to support the instructions from the previous project as well.

(jal and jr are needed to call procedures. addu and addiu are used to implement the move and la pseudoinstructions.)

Note: jal should save the value PC+4 into register 31. Some instruction references say PC + 8. The "+8" is needed when implementing a delay slot after the jump. Your CPU doesn't have a delay slot, so the correct increment is 4, not 8.

Additionally, build a hard-wired control unit using JLS, then compute the number of gates used and the maximum time required by your control. Try to make your control as small and fast as possible. This control unit must be a separate JLS circuit that has the same interface as the starter control unit from project 2. (Your circuit may have as many sub-circuits as you like.) You must build a hard-wired control. You may not build a control that is effectively microcode. Specifically, your controller may not contain a ROM element, nor may effectively behave like a ROM element (e.g., you may not feed a bunch of constant values into a big mux). If you are not sure whether your design meets the spirit of the rules, please ask.


As with project 2, you are responsible for writing the code used to test your CPU. Your will need to write new tests for your new instructions.

When you are convinced your CPU works, upload your PHSingleCycleCPU.jls file. I will run my test scripts on your file. If my scripts show no errors, you will receive 10 points for your testing component. If my scripts turn up an error, you will get a chance to fix your code, but will lose 5 of these points. If the errors are still in your final project submission, you will lose the remaining 5 testing points. I will only do this once for each group, so do not submit until you are ready. This early submission must be before 11:59 PM on Monday, Apr 1 Friday, Apr 5. Remember, the earlier you submit, the more time you will have to fix any errors. If you know a particular instruction doesn't work, be sure to include a note explaining so with your early submission. I will exclude it from testing. You will loose testing points only for bugs that you have not identified yourself. However, do not submit substantially unfinished processors unless you are not planning on completing the known unimplemented features. Your grade will be penalized if I believe you are acting outside of the intention of this system.



Prof. McGuire has installed a version of gcc that will compile for MIPS at /home/mcguire/pub/bin/mips-gcc. To compile foo.c for mips, run the following command:

/home/mcguire/pub/bin/mips-gcc -mrnames -S foo.c

This will generate foo.s.

The code generated by mips-gcc will need some minor modifications to run with your CPU:

If you write a script to handle these changes automatically, feel free to contribute it for the use of the class.

Submission and grading

This project will be worth 100 points, divided as follows:

I-type 10 points
R-type 5 points
lw 5 points
sw 5 points
branch 5 points
jump 5 points
jal 10 points
jr 10 points
bne 5 points
addu, addiu, and subu 5 points
xor and xori 5 points
number of gates in control 5 points
speed of control 5 points
neatness / readability 10 points
testing 10 points

Note: It may not be possible to effectively test some instructions if others are broken. For example, it is not possible to test R-type instructions without first using an I-type instruction to load some registers. The list above reflects my testing order. If it is not possible to easily test category y because category x is broken, you will receive 0 points for category y. Thus, if your I-type instructions are broken, you will likely receive a 0 for the assignment.