I'm really new to MIPS, so I'm having a hard time reading and understanding the code. For my homework, I was asked to identify and corrects errors in the folllowing code which computes the fibonacci number with given n passed in register $a0, and return it in $v0. I was most of the time lost in the middle, while trying to to follow the flow control ... Could you help me figure out the errors? Or just simply help me with the actual correct piece of code, so I can work on that and find the errors in this one.
FIB: addi $sp, $sp, –12 sw $ra, 0($sp) sw $s1, 4($sp) sw $a0, 8($sp) slti $t0, $a0, 1 beq $t0, $0, L1 addi $v0, $a0, $0 j EXIT L1: addi $a0, $a0, –1 jal FIB addi $s1, $v0, $0 addi $a0, $a0, –1 jal FIB add $v0, $v0, $s1 EXIT: lw $ra, 0($sp) lw $a0, 8($sp) lw $s1, 4($sp) addi $sp, $sp, 12 jr $ra