Complete the following tableusing the codes attributed. Provide how many instructions of the given categories are executed while finding the F(6) and calculate the total clock cycles.
Category
|
Instructions
|
CPI(Clock Cycle per Instruction)
|
Instruction Count
|
A: Arithmetic and Comparison |
add, addu, sub, slt, etc.. |
1 |
? |
B: Memory |
lw, sw |
8 |
? |
D: Branch and Jump |
beq, bnq, j, jal |
2 |
? |
Extracted text: 45 beqz $a0,zero 46 beg $a0,1,one 47 48 49 sub $ sp,$ sp,4 50 sw $ra,0($ sp) 51 52 sub $a0,$ a0,1 53 jal F 54 add $a0,$ a0,1 55 lw $ra,0($ sp) 56 57 add $sp,$ sp,4 58 59 60 sub $ sp,$ sp,4 61 sw $v0,0($sp) 62 sub $ sp,$ sp,4 sw $ra,0($ sp) 63 64 65 66 sub $a0,$ a0,2 67 jal F 68 add $a0,$ a0,2 69 70 lv $ra,0($ sp) 71 add $sp,$ sp,4 72 lv $s7,0($ sp) add $ sp,$ sp,4 73 74 75 76 add $v0,$v0,$s7 77 jr $ra 78 79 zero: 80 li $v0,0 81 jr $ra 82 one: 83 li $v0,1 84 jr $ra 85 86 . data 87 prompt: . asciiz " Program calculates the Fibonacci sequence using recursive functions. \n Enter a non-negative number: " 88 result: .asciiz "F " result2: . asciiz " asciiz "n". 89 endl:
Extracted text: .text 2 main: 4 la $a0,prompt li $v0,4 syscall 7 li $v0,5 syscall 10 11 move $t2,$vo 12 13 14 move $a0,$t2 15 move $v0,$t2 16 jal F 17 move $t3,$vo 18 la $a0,result li $v0,4 19 20 21 syscall 22 23 move $a0,$t2 24 li $v0,1 25 syscall 26 27 la şa0,result2 28 li $v0,4 29 syscall 30 31 move şa0,$t3 32 li $v0,1 33 syscall 34 la $a0,endl li $v0,4 35 36 37 syscall 38 39 40 li $v0,10 41 syscall 42 43 F: 44 45 begz $a0,zero