CPR E 381x/382x - Lab 3a and 3b
Single
Cycle CPU Implementation
1. Objectives
In this lab you will
implement a single-cycle MIPS instruction subset.
1.1
Reference Files for Lab
2. Prelab
Understand the single-cycle
datapath, control unit and ALU control.
3. Setup
Create
the folder in your home directory U:\CPRE381\Lab03,
and then a sub-folder ~\cpu.
4. CPU in Verilog
Figure 5.24 in your Patterson
& Hennessy textbook shows a single cycle datapath with control
units. You will be implementing a
similar datapath, capable of performing the subset of the full MIPS instruction
set given below. Begin by drawing a block
diagram of your datapath. Pay close
attention to all control signals that are needed for your modules.
Have the TA check your diagram before proceeding.
Next, design the control module that will generate
the control signals based on the opcode of the instruction. It might be useful to construct a table that
shows the value of each control signal for every instruction. For the No Op instruction, you should set the
control signals such that no memory structures are written to. Be sure that your control module is working
as you expect, then have it checked by the TA.
Finally, connect all modules together to form your
datapath. Although there are no inputs
or outputs shown in the diagram in the book, you will need to add inputs to the
Instruction Memory so that it may be initialized, and some additional outputs
for testing purposes.
Test the datapath with all instructions until you are
convinced it is working.
OPCODES
Opcode |
Instruction |
Format |
000000 |
No Op |
- |
000001 |
add |
R |
000010 |
sub |
R |
000011 |
and |
R |
000100 |
or |
R |
000101 |
slt |
R |
000110 |
lw |
I |
000111 |
sw |
I |
001000 |
beq |
I |
001001 |
bne |
I |
001010 |
addi |
I |
001011 |
andi |
I |
001100 |
ori |
I |
001101 |
slti |
I |
001110 |
j |
J |
Instruction Format
J Format |
OPCODE |
ADDRESS |
|
31:26 |
25:0 |
I Format |
OPCODE |
RS |
RT |
IMM/OFFSET |
|
31:26 |
25:21 |
20:16 |
15:0 |
R Format |
OPCODE |
RS |
RT |
RD |
Unused |
FUNCT |
|
31:26 |
25:21 |
20:16 |
15:11 |
10:6 |
5:0 |