D-241, Computer Architecture, University of Tromso, 2001
Assignment 3 fall 2001
MIPS multicycle implementation
Assigment overview
This document describes an implementation of a MIPS multi-cycle microprocessor.
We used VisualState to create the controller and the clock methodology.
The datapath was implemented in C programming language using visual C++.
Bjørnar, Kai-Arne, Trond made this masterpiece.
Bjørnar Trondsen - the mind behind. |
Trond Larsen - was concentrated |
Kai Arne Bjørnenak - was tired |
Our assignment was to make a program written in MIPS assembly to run on our MIPS processor.
The assembly program uses the following MIPS instructions:
lw
sw
R-type (add, sub, or, and, slt)
addi
bne
j
syscall (only need to support print_int)
We used
a very simple implementation of the clock, taking advantage of
the OS_Wait function and the event queue. We had an event named clocktick,
that would, when called upon by being added to the event queue would trigger an
state shift in the controller. The clock is not set with an certain cycle time,
instead it uses so much time as it takes to execute the control signals and
code.
MIPS
program for testing the processor with each instructions respective hex value:
0:
addi $sp $zero
2048
= 201d0800;
1:
addi $t4 $zero 0
= 200c0000;
2:
addi $t5 $zero 1
= 200d0001;
3:
addi $t6 $zero 10
= 200e000a;
4:
sw $zero
-4($sp)
= afa0fffc;
5:
addi $v0 $zero 1
= 20020001;
6:
addi $a0 $zero 1
= 20040001;
7:
syscall
= 0000000c;
8:
lw $t4
-4($sp)
= 8facfffc;
9:
add $t7 $t4
$t5
= 018d7820;
10: add
$t4 $zero $t5
= 000d6020;
11: add
$t5 $zero $t7
= 000f6820;
12: sw
$t4 -4($sp)
= afacfffc;
13:
addi $v0 $zero 1
= 20020001;
14:
addi $a0 $t7 0
= 21e40000;
15:
syscall
= 0000000c;
16:
addi $t6 $t6 -1
= 21ceffff;
17: bne
$zero $t6 –9
= 15c0fff7;
18: jmp
0
= 08000000;
19: add
$a0 $a0 $zero
= 00802020;
20: add
$a0 $a0 $zero
= 00802020;
21: add
$a0 $a0 $zero
= 00802020;
The DataPath
We used the datapath components described in Patterson/Hennesy's Computer Organization & Desgin.
Kai Arne stood for the excellent chart below. Photodraw was used.
Note that we put an extra inverter from the ZERO output signal from the ALU.
We did this because we used branch not equal instead of branch equal.

We
implemented the controller part of the assignment using the VisualState tool
(See picture). This is a program that contains tools for making a state machine
and linking it with the datapath we made in VisualStudio C.
The
controller should set the control signals and the datapath should then execute
the right piece of code based on these. To run functions in C from the
controller you have to make Action functions. These acts as a function call from
the controller to the datapath. We used just one Action function called datapath
which contained all the code needed except from the ALU (Arithmetic Logical
Unit). That was implemented in a function of it’s own.
