CSE 341
Fall 2011
Homework #1 Solutions
1.
No, this is merely a mechanism to allow code written by different people to be integrated together.
It
is NOT a requirement of the hardware.
2.
No.
If the LUI instruction were removed, it would take multiple instructions to accomplish the same
end result as the LUI instruction.
SUBI can be executed without increasing the instruction count of a
program by using ADDI. For example, we can use
addi
to add a negative number.
SUBI $5, $2, #4
could be implemented as ADDI $5, $2, #-4.
To perform LUI $a0, 0x1000 we’d need two
instructions:
ADDI $a0, $0, 0x1000 followed by LSL $a0, $a0, 16.
3.
There are many solutions, three of which are discussed here.
ADDI can be eliminated.
This
instruction can be implemented by loading the immediate value into a register then using ADD to
perform the operation.
Similarly, many immediate variants of instructions can be eliminated. BEQ or
BNE can be eliminated.
If BNE is eliminated, BEQ could be used by negating the condition and vice
versa.
Finally NOR can be eliminated.
This
preview
has intentionally blurred sections.
Sign up to view the full version.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Fall '09
- Assembly Language, machine language, Machine code, BNE, lui
-
Click to edit the document details