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

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

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

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

View Full Document
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
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)

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

View Full Document
int fact (int n) { if (n < 1) return 1; else return (n * fact(n-1)); } Example 2 Compile into MIPS (done in class)
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

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

View Full Document
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
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
Ask a homework question - tutors are online