Write the MIPS assembly code
No pseudoinstrucions are allowed, use only the following basicMIPS instructions:
# add – arithmetic add
# sub – arithmeticsubtract
# and – bitwise and
# or – bitwise or
# slt – set on less than
# nor – bitwise nor
# addi – add with immediatedata
Example of how to perform exercises
#Variables A through C have the following registermapping:
# A:$16 B:$17 C:$18
#For temporary storage use registers $13, $14, or $15 as needed forcomplex operations.
#Example Exercise:
# Initial Variable Values: A = 50; B = 100; C =150;
# Assignment statement to perform: C = A + B – C;
addi $16, $0, 50 #A = 50;
addi $17, $0, 100 #B = 100;
addi $18, $0, 150 #C = 150;
add $13, $16, $17 #Temp = A + B;
sub $18, $13, $18 #C = A + B – C;
Instructions:
Variables A through F have the following register mapping:
A:$10 B:$11 C:$12 D:$13 E:$14 F:$15 G:$16 H:$17 I:$18
For temporary storage use register $1 through $9 as needed forcomplex operations.
Add without adding
Initial Variable Values: A = 25; B = 50
Assignment statement to perform: G = A – (~B + 1);
Subtract without Subtracting
Initial Variable Values: C = 1000; D = 750;
Assignment statement to perform: F = C + (~D + 1)
Less Than Comparison
Initial Variable Values: A = 20000; B = 30000
Assignment statement to perform: E = (A<B) ? 1 : 0; //ternaryoperator
Exclusive OR without XOR
Initial Variable Values: B = 0x0F0F; C =0x0FFF;
Assignment statement to perform: D = (B & ~C) | (~B &C)
Expert Answer
Answer to Write the MIPS assembly code No pseudoinstrucions are allowed, use only the following basic MIPS instructions: # add – a…