Topic 4b - Procedures II

Topic 4b - Procedures II - Computer Architecture...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer  Architecture Procedures II Reading:  Section 2.13
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
A Glance at the Schedule What’s coming in… Lab2 – Today midnight Hw1 – Monday midnight What’s going out…
Image of page 2
Outline  Procedure examples Recursive Non-recursive Work on relprime() Start thinking about designing an assembler
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
“A computer once beat me at chess, but it was  no match for me at kick boxing. . “
Image of page 4
Leaf Procedure Example Doesn’t call another procedure C code: int leaf_example (int g, h,  i, j) int f;   f = (g + h) - (i + j);   return f; } Arguments g, …, j in $a0, …, $a3 f in $s0 (hence, need to save $s0 on stack) CAT #1
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Leaf Procedure Example Assuming that $T0 and $T1  have to be saved MIPS code: leaf_example:   addi $sp, $sp, -4 sw $s0, 0($sp) add  $t0, $a0, $a1   add  $t1, $a2, $a3   sub  $s0, $t0, $t1   add  $v0, $s0, $zero   lw   $s0, 0($sp) addi $sp, $sp, 4
Image of page 6
To Preserve or Not??
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern