You are on page 1of 1

UEEA 4653

Computer Architecture
Year/ Sem


Engineering & Science

3E, EC
Year 4 / Sem 1

Unit Code
Unit Title

: UEEA4653
: Computer Architecture
: Dr. Lai An Chow

Tutorial #1
(A) Assembly program

Install and run the QtSpim.exe from your computer.

Click File menu on the top left corner, then select Reinitialize and Load File, and
enter the file, swap.s, which you just created.
You will see four tabs with labels of
o FP Regs: contents of floating pointer registers
o Int Regs: contents of integer registers
o Data: the content of data memory and stack; numbers in brackets [] are the starting
memory addresses in hexadecimal format for the particular data and stack elements.
o Text: the content of instructions; i.e. your MIPS assembly program is loaded here,
starting at 0x00400000.

(B) Understanding the program

Before you run the program, the separate window called Console should be empty.
Now, press F5 to execute once, write down what you see in the Console.
To execute again, you need to reinitialize the simulator and reload the file again by
clicking Simulator menu, then Reinitialize Simulator, and clicking File menu, then
Recent Files.
To understand why we get such output, step through each instruction by pressing F10.


Load the Pseudoinstructions in the following table into QtSpim and see what actually shows
up in QtSpim. big is a number requiring 32 bits to represent while small is a number
requiring 16 bits.
What it accomplishes
move $t1, $t2
$t1 = $t2
bgt $t4, $t5, L
if ($t4 > $t5) go to L
addi $t0, $t2, big
$t0 = $t2 + big
li $t1, small
$t1 = small