Question: Using a sequence of MIPS instructions, create a new addressing mode that implements a load-word (lw) or storeword (sw) with auto-increment (by 4) of the
Using a sequence of MIPS instructions, create a new addressing mode that implements a load-word (lw) or storeword
(sw) with auto-increment (by 4) of the address register after the memory access, where the syntax is
lw $t1, imm16($t0)+ and sw $t1, imm16($t0)+
Registers $t1 and $t0 are to be initialized to point to two distinct arrays of memory locations, where each element in
the array is one word (4 bytes). Thus, the imm16 value should be the array element number (starting with 0) times
4. For example, if you wanted to access the 3rd element in the array ( array[2] ), the imm16 value should be 8. You
are to use the la (load address) MIPS pseudo-instruction; no other pseudo-instructions may be used. Below is an
example code snippet of how to initialize $t1 and $t0 to point the data, along with appropriate data definitions:
la $t1, num_1 # initialize $t1 to point to memory location with label num_1
la $t0, array1 # initialize $t0 to point to memory location with label array2
:
: # MIPS code that actually implements the
: # enhanced MIPS instruction specified
:
ori $v0, $zero, 10 # $v0 <-- function code for "exit"
syscall # Syscall to exit
.data # array[0] array[1] array[2] array[3] array[4] array[5]
array1: .word 0xABCDEF01, 0x55AACC55, 0x01234567, 0x89ABCDEF, 0xFFFFFFFF, 0x76543210
num_1: .word 0x55AACC55
Note: beside $t1, $t0 and $v0, no other MIPS registers are to change.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
