Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q2: Write a MIPS code fragment that computes the equation $s0 = $s0*105 without the use of multiplication instructions with the minimum number of instructions?

Q2: Write a MIPS code fragment that computes the equation $s0 = $s0*105 without the use of multiplication instructions with the minimum number of instructions?
HINT: use 105 = 15*7.
Place your answer here
Q3: Write a minimum sequence of MIPS basic instructions to implement the pseudo instruction?
andi $t0,$t0,0x12345678
Place your answer here
Q4: Compile the C-Language statement A[100] = A[0] * 2; into MIPS assembly code using the minimum number of instructions. Assume that register $s2 holds the base of A (an array of integers).
Place your answer here
Q5: Assuming A is an integer array with base in $s4 and that the compiler associates the integer variables g, i, and n with the registers $s1, $s2, and $s3, respectively. What is the compiled MIPS assembly code for the following C code segment?
for (i = 0; i < n; i++)
g = g + A[i];
Place your answer here
Q6: Assume that argument registers $a0 and $a1 initially contain positive integers a and b, respectively. Assume that $v0 is used for the result.
add $t0, $0, $0
loop beq $a1, $0, exit
add $t0, $t0, $a0
addi $a1, $a1, 1
j loop
exit add $v0, $t0, $0
jr $ra
a) Add comments to the above MIPS subroutine code?
b) What does this code compute?
Place your answer here
Q7: Write MIPS assembly instructions to
a) Set bits 3, 8, and 12 of $s0 to 0
b) Complement all bits of $s0
Place your answer here
Q8: Write MIPS assembly instructions to load one byte from memory address 1025 into register $s0. Do not use MIPS lb or lh instructions.
Assume that register $t1 has the value 1016 (base address).
Place your answer here
Q9: Assume that the compiler associates registers $s5 and $s6 with integer variables i and x for the following code:
slti $at, $s5, 5
beq $at, $zero, Else
add $s6, $s5, $zero
j Exit
Else: add $s6, $zero, $zero
Exit:
a) Decompile the above MIPS code segment to a C-language code segment?
b) Suggest the appropriate MIPS pseudo instruction equivalent to the above MIPS assembly code?
Place your answer here
Q10: a) Disassemble the following MIPS machine instruction?
00 00 00 00hex
b) Suggest an appropriate MIPS pseudo instruction equivalent to that MIPS assembly code?
Place your answer here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions