Analyze the following MIPS assembly code: ori $s1,$0,0 ori $t0,$0,16 repeat: ori
ID: 3530320 • Letter: A
Question
Analyze the following MIPS assembly code: ori $s1,$0,0 ori $t0,$0,16 repeat: ori $t2,$0,4 lw $t1,0($s0) add $s1,$s1,$t1 add $s0,$s0,$t2 addi $t0,$t0,-1 bne $t0,0,repeat (a) What is the total number of MIPS instructions executed when this code is run? (b) Rewrite the MIPS assembly code fragment to reduce the number of executed instructions. (c) Translate the MIPS assembly code fragment to C. Assume that integers i, j and k are held in $t0, $t1 and $t2, respectively, integer result is held in $s1, and $s0 contains the base address of an integer array A.Explanation / Answer
you can refer to this following pdf www2.mta.ac.il/~ohadbr/arch/LectureNotes/02_MIPS_assembly_Eng2.pdf
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.