Writing Fibonacci in MIPS (caller saved)

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024

Комментарии • 33

  • @TheBumi12
    @TheBumi12 8 лет назад +21

    great tutorial, but your add should be an addi, cheers :)

  • @2ScoopsPlz
    @2ScoopsPlz 3 года назад +3

    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.

    • @ghy518
      @ghy518 3 года назад +1

      I was thinking the exact thing like tf

  • @HưngTrầnQuốc-x3n
    @HưngTrầnQuốc-x3n 12 часов назад

    really approciate

  • @Rmontgomery07
    @Rmontgomery07 8 лет назад +7

    Any idea why I might be getting "Runtime exception at 0x00400060: address out of range 0x7fbffffc" at the line sw $v0, 8($sp)?

  • @sukritkapil9816
    @sukritkapil9816 4 года назад

    Thanks for this video. It is really helpful!

  • @EsmirAlvarez
    @EsmirAlvarez 8 лет назад +1

    Thank you very much, greatly appreciate it. =)

  • @daadii8784
    @daadii8784 2 года назад

    it's bge instead of bgt, otherwise it would not calculate the correct sequence

  • @samuelheman-ackahiii2029
    @samuelheman-ackahiii2029 3 года назад

    God Bless you.

  • @kevin1933
    @kevin1933 2 года назад

    really helpful! thank you!

  • @lefterismagkoutas4430
    @lefterismagkoutas4430 4 года назад

    is it possible to not use registers and to make it only with stack pointer?

  • @rickk722
    @rickk722 6 лет назад

    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.

    • @doctorsid88
      @doctorsid88 6 лет назад +1

      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

  • @shubhama003
    @shubhama003 7 лет назад

    Amazing video with nice explanations

  • @RH-zp1ry
    @RH-zp1ry 6 лет назад

    shouldnt u use the $s0 for the n?

  • @ming-hsuanhsieh9050
    @ming-hsuanhsieh9050 3 года назад

    nice

  • @張大刀-g1y
    @張大刀-g1y 2 года назад

    wft are you talking? add xx xx imm isn't exist dude

    • @CompArchIllinois
      @CompArchIllinois  2 года назад

      "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.

  • @SrajanBhatnagar
    @SrajanBhatnagar 8 лет назад

    Why do we do the 'jr $ra' ? kindly explain ?

    • @Cnixian
      @Cnixian 8 лет назад

      +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.

  • @96Muhsin96
    @96Muhsin96 6 лет назад

    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....

    • @96Muhsin96
      @96Muhsin96 6 лет назад

      oh and yes, you use add instead of addi, add is just for registers commands

    • @96Muhsin96
      @96Muhsin96 6 лет назад

      addi for immediate of course :) you better update your tutorial. Thanks tho for the tutorial, it helped a lot! Cheers.

    • @CompArchIllinois
      @CompArchIllinois  2 года назад

      @@96Muhsin96 add acts as a pseudoinstruction for addi; the assembler does the transformation for you.

  • @MaggieMize
    @MaggieMize 7 лет назад

    jr $ra equals 0x00000000, so I get an error

    • @Kapir00to
      @Kapir00to 7 лет назад +3

      you have to do a jal fib before the function to start it.

  • @akitomoya6598
    @akitomoya6598 3 года назад

    终于搞懂了。。ᕕ( ᐛ )(*´д`)ᕗ

  • @joyride6062
    @joyride6062 5 лет назад +5

    so many mistakes....

  • @ghy518
    @ghy518 3 года назад

    Bruh