lecture6 - CSCI-365 Computer Organization Lecture 6 Note:...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-365 Computer Organization Lecture Note : Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson & Hennessy, ©2005 Some slides and/or pictures in the following are adapted from: slides ©2008 UCB 6
Background image of page 1

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

View Full DocumentRight Arrow Icon
entry_label: addi $sp,$sp, -framesize sw $ra, framesize-4 ($sp) # save $ra save other regs if need be ... restore other regs if need be lw $ra, framesize-4 ($sp) # restore $ra addi $sp,$sp, framesize jr $ra Epilogue Prologue Body (call other functions…) ra memory Basic Structure of a Function
Background image of page 2
int leaf_example (int g, int h, int i, int j) { int f ; f = (g + h) – (i + j); return f; } Example 1 Compile into MIPS (done in class)
Background image of page 3

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

View Full DocumentRight Arrow Icon
int fact (int n) { if (n < 1) return 1; else return (n * fact(n-1)); } Example 2 Compile into MIPS (done in class)
Background image of page 4
int fib (int n) { if (n == 0) return 1; if (n == 1) return 1; return ( fib(n-1) + fib(n-2) ); } Example 3 Compile into MIPS
Background image of page 5

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

View Full DocumentRight Arrow Icon
Bitwise Operations Up until now, we’ve done arithmetic ( add , sub , addi ), memory access ( lw and sw ), and branches and jumps All of these instructions view contents of register as a single quantity
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/26/2009 for the course MATH AND C CSCI365 taught by Professor Laurencetianruoyang during the Spring '09 term at St. Francis Xavier, Antigonish.

Page1 / 15

lecture6 - CSCI-365 Computer Organization Lecture 6 Note:...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online