Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Answer the following questions supposing the code listing shown starts from main

ID: 1839418 • Letter: A

Question

Answer the following questions supposing the code listing shown starts from main()

Machine A uses the single-cycle MIPS processor shown below executing at 500 MhZ. Fill in the table with the number of instructions that are executed and the execution time for the above program with Machine A.

.text fun: # int fun (int s) { addi $sp, $-8 sw $a, 0 ($Sp) sw $0, 4 ($sp) blez $a0, base addi $a0, $ao,-1 0 # if (s > 0) { # # 1 fun done r=fun (s) ; base: addi $v0, $zero, 0 # else r = 0; done: lw $ra, 0 ($sp) lw $a0, 4 ($sp) addi $sp, ssp, 8 add $v0, $v0, $ao 8 # r = r + s; # return r; } # int main() { 2 main: addi $sp, $-8 sw $a, 0 ($Sp) sw $0, 4 ($sp) addi $s0, $zero, 0 # x = 0 addi $a0, $zero, 2 #i=2 5 loop: blez $ao, end # while (i> 0) { jal fun add $80, $80, $v0 # x -x + fun(1); addi $a0, $ao,-1 # i--; j loop 9 end: addi $v0, $s0, 0 lw $s0, 4 ($Sp) 1w $ra, 1w $za, o (sp) addi $sp, $sp, 8 8 $ra # return x; }

Explanation / Answer

inst class istructiions time

or,and,slit OR 2.1

add, sub ADD, SUB 1.2

branch SE CTION 3.6

load LOD 4.6

store STA

jump JMP

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote