Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For these programming exercises, use only those instructions that have been discussed so far in these notes: Basic Instructions add div mflo slt, slti addi
For these programming exercises, use only those instructions that have been discussed so far in these notes:
Basic Instructions | |||
---|---|---|---|
add | div | mflo | slt, slti |
addi | divu | mult | sltu, sltiu |
addiu | j | multu | sra |
addu | lb | nor | srl |
and | lbu | or | sub |
andi | lh | ori | subu |
beq | lhu | sb | sw |
bgez | lui | sh | xor |
bltz | lw | sll | xori |
bne | mfhi | ||
PseudoInstructions | |||
la | lw | nop | |
li | move | sw |
USING MIPS Simulator
Declare three arrays, each of the same size:
.data size .word 7 array1: .word -30, -23, 56, -43, 72, -18, 71 array2: .word 45, 23, 21, -23, -82, 0, 69 result: .word 0, 0, 0, 0, 0, 0, 0
Initialize a base register for each array (use the la instruction.) Now implement a loop that adds corresponding elements in the first two arrays and stores the result in the corresponding element of theresult array. Do this by moving each of the three base registers to its next array element after each addition.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started