: For the first checkpoint, download the bit.s MIPS code example from the lec-10-05 folder on Submitty. Understand how the code works to produce the output below:
x
-xxxx-xx-xxxxxx-xxxx-x-x-x-xxxxxx-xxx-xxxxxxxxxxxxxxxxxxxxxxxx -xxxx-xxxxxxx-
xxxxxxxxx-xx-x-xxxxx-xxxxxxxxxxx-xxxxx-xxxx-xx
xx-x-xx
x-xx-xx-
-xxxxx
-xxxx
xx-xxxx
x-x
xx
xxxxxxxxx-x
xxxxx-x
xxx-xx-
xxxx-xxxxxxxx
Modify the given code to eliminate the jmerge instruction in the printbit procedure. In other words, revise the procedure to use only one branch instruction.
To receive credit for this checkpoint, you need to show both your code revision and successful output.
- Checkpoint 2: Similar to Checkpoint 1, revise the bitcount procedure in s to eliminate the beq instruction. More specifically, you can only use the one bne instruction and the one jal instruction; no other branch or jump instructions are allowed.
Try running your code using the hexadecimal words shown in the lab06a.txt and lab06b.txt files available in Submitty.
And to test, add a syscall to print_int to display the return value (i.e., temporary register $t0) before you print the newline and return.
To receive credit for this checkpoint, you need to show both your code revision and successful output.
- Checkpoint 3: For the third checkpoint, make a copy of the revised s code, then modify this code as described below.
Currently, this code displays each 32-bit word of the given data on a line by itself, i.e., one word per line. Extend the bitcount procedure to display n words per line, where n is specified as the third argument to bitcount in register $a2.
Test your code by setting $a2 to 1. Then test your code using the lab06b.txt file with $a2 set to 2. What does your output look like?
As above, to receive credit for this checkpoint, you need to show both your code revision and successful output.
Reviews
There are no reviews yet.