You... don't ever run it? M8, I'm garbage at this stuff and even I can pick out issues with with this, ones you would likely be aware of if you bothered trying to run it.
fib calls itself before it can return a result. it would therefore overwrite what was stored in the temporary registers by the previews call. in contrary, the stack grows with each call (remember that you can't know in advance how many will happen) - thats why you decrease the stack pointer $sp on each call
"add" acts as a pseudo-instruction for "addi" when you use that form. See: en.wikibooks.org/wiki/MIPS_Assembly/Pseudoinstructions Try it and see that it works.
+Srajan Bhatnagar You use jr $ra to "jump" the program back to the "main" program. jal fib "jumps" the program to his fib function and jr $ra jumps back out of the function to the mainline code.
at 2:17 you just store $a0 in your stack. Actually, in MIPS reference call you first gotta move $a0 to $s0(for example), since we just use the $a registers for arguments and $s registers to save numbers or variables for example for recursive functions. But this should work, tho....
great tutorial, but your add should be an addi, cheers :)
Why?
because he is adding an immediate not two registers :)
Got you. Thanks.
You... don't ever run it? M8, I'm garbage at this stuff and even I can pick out issues with with this, ones you would likely be aware of if you bothered trying to run it.
I was thinking the exact thing like tf
really approciate
Any idea why I might be getting "Runtime exception at 0x00400060: address out of range 0x7fbffffc" at the line sw $v0, 8($sp)?
Thanks for this video. It is really helpful!
Thank you very much, greatly appreciate it. =)
it's bge instead of bgt, otherwise it would not calculate the correct sequence
God Bless you.
really helpful! thank you!
is it possible to not use registers and to make it only with stack pointer?
Why do you save v0 on the stack you could aswell use a temporary register. Still dont figured out 100% why we use this stack thing so often.
fib calls itself before it can return a result. it would therefore overwrite what was stored in the temporary registers by the previews call. in contrary, the stack grows with each call (remember that you can't know in advance how many will happen) - thats why you decrease the stack pointer $sp on each call
Amazing video with nice explanations
shouldnt u use the $s0 for the n?
nice
wft are you talking? add xx xx imm isn't exist dude
"add" acts as a pseudo-instruction for "addi" when you use that form. See: en.wikibooks.org/wiki/MIPS_Assembly/Pseudoinstructions Try it and see that it works.
Why do we do the 'jr $ra' ? kindly explain ?
+Srajan Bhatnagar
You use jr $ra to "jump" the program back to the "main" program. jal fib "jumps" the program to his fib function and jr $ra jumps back out of the function to the mainline code.
at 2:17 you just store $a0 in your stack. Actually, in MIPS reference call you first gotta move $a0 to $s0(for example), since we just use the $a registers for arguments and $s registers to save numbers or variables for example for recursive functions. But this should work, tho....
oh and yes, you use add instead of addi, add is just for registers commands
addi for immediate of course :) you better update your tutorial. Thanks tho for the tutorial, it helped a lot! Cheers.
@@96Muhsin96 add acts as a pseudoinstruction for addi; the assembler does the transformation for you.
jr $ra equals 0x00000000, so I get an error
you have to do a jal fib before the function to start it.
终于搞懂了。。ᕕ( ᐛ )(*´д`)ᕗ
so many mistakes....
Bruh