Due:
Worth:
Late Submission
Introduction
11:59 pm 6th September, 2020 5% of the final mark
30% penalty
COMPSCI 313 S2 – Assignment 01
Computer Science
COMPSCI 313 S2
Assignment ONE
This assignment is to be done using the simulator (Mars4_5.jar). You can trace the value of the registers and the memory step by step. Notice that the memory setting is selected correctly. The MIPS memory configuration should be “Compact, Data at address 0”.
The assignment should be submitted the CodeRunner system: https://coderunner3.auckland.ac.nz
CodeRunner cannot read assembly codes. The assembly codes will be inputted as string by the predefined python function. The whole assembly programme will be executed by the simulator. Notice that all labels should be inputted as a new line. For example:
test2: addi $t0, $zero, 1
Question 1: Nested Loop (2 marks)
Translate the following C code to MIPS assembly code. Assume that the values of a, b, i, and j are in registers $s0, $s1, $t0, and $t1, respectively. Also, assume that register $s2 holds the base address of the array D and it value is 0x10 (1016).
The assembly codes should be inputted according to the following format:
mipsInst.assembler.addInstruction(“addi $t0, $zero, 0”)
mipsInst.assembler.addInstruction(‘test2:’) mipsInst.assembler.addInstruction(‘addi $t0, $zero, 1’)
for(i=0; i