COSC 201: Computer Organization

Lab 7: Single Cycle CPU -- part 2

Learn how to put together components to create a single cycle ARMv8 (simplified) CPU
Complete the circuits for a single cycle ARMv8 CPU, given several components.
Read Chapter 4 from H&P, 4.1-4.4
Files to Use
           MiscComponents.circ, CPUComponents.circ, control.circ, SingleCycleCPU.circ, fileSpecs.docx, fileSpecs.pdf , controls.docx (completed for homework), controls.pdftest.s, test.mem, testdata.memarraySum.s, arraySum.mem, arraysumdata.mem 
What to Hand In
           Week 2: Completed SingleCycleCPU.circ and control.circ. Explain if the datapath has been changed from week one.


This is a two week lab. In the first week, you should complete the circuit for a ARMv8 CPU that supports several basic instructions. The control part of this circuit will be filled in with fake controls that can be set by the user to test the data-path. The instructions to be supported are listed in the file controls.docx (controls.pdf) that was to be completed for homework 4.

The ARMv8 instructions implemented: add, sub, and, or, ldur, stur, cbz, b

The second week of the lab will be to complete the control part of the CPU circuit. Then this will be tested by using code that does a simple operation on arrays.

The circuit files that are used are described in the file filespecs.docx (filespecs.pdf).

Week 2

1. Complete the control circuits to implement all the instructions given in the file controls.docx (completed for homework), controls.pdf. Do this by completing the three subcircuits: ALUControl_0, Control_0, Control_1. (The circuits ALUControl and Control use these.) Save the file.

Note: the order of the control outputs is not the same as in the book diagrams. See the filespecs.

Hint1: Compare the opcodes and determine how many of the bits are needed (2, 3, 4, 5, ?) to differentiate each instruction or class (R-type). Use those lines to set the appropriate bits for the output, using OR-gates where necessary.

Hint2: For the ALUControl_0, remember the ALUOp bits completely determine the output for load/store/cbz. The opcode bits are only used (together with the ALUOp bits) for the R-type instructions.

2. Open your SingleCycleCPU.circ. Click on the control subcircuit to check that your implemented version has been loaded. Delete the controls in the circuit (these should have been the fake-controls) and then add ALUControl and Control from the new circuits instead.

3. Test your circuit by running the test program. Load test.mem and testdata.mem as in part 1, then click on the clock icon repeatedly to execute the program. (You do not have to enter control values by hand, of course.) You should get the behavior described in part 1.

4. Now try the program arraysum.s It finds the partial sums of the array, storing them back into the array, so when done the kth item in the array is the sum of the first k values in the original array. Load arraysum.mem and arraysumdata.mem into the instruction and data memories, then run the program.

When you are tired of clicking the clock icon, you can set the frequency of ticks under the simulate menu, then click "ticks enabled" and the clock will run by itself, until you uncheck "ticks enabled".

6. When the program completes (by cycling forever on the last instruction), the data memory should contain the following:

00       00000003
01       00000012
02       00000026
03       00000028

Sometimes the simulator has a hiccup and does not save the proper value. If you think your circuit is correct and you get a glitch in the results, try again by reloading the data memory and resetting the circuit (click reset twice).