1. MIPS is a load/store architecture. What does this mean?
2. MIPS requires that most data to be aligned. What does this mean?
3. What are the restrictions on label names in MIPS?
4. What does this assembler directive accomplish?
arr: .byte 'a','b','c','d','e','g'
5. What do these assembler directives accomplish?
mem: .space 15
mem2: .word 0:10
6. Since MIPS instructions are all one word (4 bytes), it is easy to compute
the address of the next instruction even if the instructions vary by number
of operands. Give the addresses of the next two instructions after addi.
Address Instruction
0x00400024 addi $t2, $t3, 5
__________ la $a0, mystuff
__________ b target
7. It is easy to encode MIPS instructions since there are so few instruction
types (I, R and J). The encoding format for this type
I instruction with opcode 8
Addi is opcode 8, rt is register target, rs is
register source, and imm is the immediate value.
What is the binary encoding of this addi instruction?
(The opcode for addi is 8. See quick guide for register numbers. )
8. Pseudoinstructions are macros added to MIPS to make life
easier for the programmer. The assembler translates pseudos
into actual instructions; e.g., this pseudo:
move $t1, $s3 # $t1 = $s3
is really an add operation. Provide the
equivalent MIPS add. Why provide a macro for a single instruction?
9. Most pseudoinstructions are macros for multiple MIPS instructions. For
example, the bgt pseudo is really three instructions: beq, slt and bne.
Explain the meaning of the bgt below and translate it into its
equivalent three MIPS instructions beq, slt and bne.
bgt $t0, $s2, Label
10. Using Appen A-10 or the quick guide as a reference, write a brief comment
for each line of MIPS code below. Then explain what the code is doing
in general. Assume that $s2 holds the starting address of an array of
five integers
1,2,3,4,5.
For the following 3 questions, do not write a complete program.
Write only the statements asked for.
Apply your best handwriting to this part of the homework.
12. Write MIPS statements that will branch to a label named BIG if the
value stored in register $v0 is greater than 1-million.
13. Write MIPS statements that will branch to a label named LARGE if the
value stored at the address in register $a0 is greater than 1-million.
14. Your MIPS program has an array of integers defined like so:
.data
arr: .space 100
Each integer is stored as a word (4-bytes).
Write MIPS statements that will branch to a label named start if the
value stored in the first array element is the value 123.