l5_handouts_4up

l5_handouts_4up - Announcements ECE 3140/CS 3420 Computer...

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

View Full Document Right Arrow Icon
1 ECE 3140/CS 3420 Computer Organization Spring 2009 Procedures ECE3140/CS3420 Announcements • Homework 1 is done – Congratulations on very few CMS problems! roject 1 • Project 1 – Due Tue., Feb 10 at 10:00pm – Don’t wait until the last minute to post to CMS! – Problems in convert.s have been fixed • You will need and ECE account on amdpool to do the projects for this class ECE3140/CS3420 pj – https://accounts.ece.cornell.edu/ – Please do this now, not Feb 10! 2 Hennessy and Patterson • Read Chapter 1 – 1.1-1.9 ead Chapter 2 Read Chapter 2 – 2.1 through 2.14, – Skim B.1,B.2, B.10 • Read – Appendix B.6 – 3.1 through 3.2 IPS Calling Convention Document (website) ECE3140/CS3420 MIPS Calling Convention Document (website) • Read (for Tuesday) – Appendix B.1-B.5 – Notes on Programming in C (website) 3 Procedure Calls Jump to start main: la $4, s M Numspaces: li $2, 0 bu $8 0($4) Parameters Register Management Procedure Returns Return from end Return values Register Management jal NumSpaces ori $4,$2,0 jal puts M lbu $8, 0($4) jr $31 M puts: lbu $8, 0($4) r $31 M ECE3140/CS3420 MIPS support Very little HW support Mostly Convention Caller/Callee Contract li $4, 0 jal exit M jr $31 exit: syscall M 4
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Memory Layout ECE3140/CS3420 5 Our Stack Frames ECE3140/CS3420 Top of stack 6 Simple Leaf Routine Stack Frame Design • Local Storage: NO - Everything fits in registers • Pad: NO - Not needed ECE3140/CS3420 • Return Address: NO - Leaf Routine • Saved Registers NO - No Saved Regs used • Argument Block: NO - Leaf Routine • Stack Size = 32 words (128 bytes) 7 Leaf Routine with Local Data Stack Frame Design • Local Storage: YES - Local data cannot fit in registers • Pad: NO - Not needed ECE3140/CS3420 8 • Return Address: NO - Leaf Routine • Saved Registers NO - Not needed • Argument Block: NO - Leaf Routine • Stack Size = 32 words (128 bytes)
Background image of page 2
3 Leaf Routine with Local Data ECE3140/CS3420 9 Prologue/Epilogue • Prologue sets up stack frame for this call • Epilogue undoes stack frame before returning to caller • Keeping stack manipulation instructions together simplifies code ECE3140/CS3420 • Everything between the Prologue and the Epilogue is the Body 10 Leaf Routine with Local Data ECE3140/CS3420 11 Leaf Routine w/ Saved Regs int g( int x, int y) { int a,b,c; // use $s1 for a, $s3 for b, $s4 for c ...
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2009 for the course ECE 3140 taught by Professor Mckee/long during the Spring '07 term at Cornell.

Page1 / 8

l5_handouts_4up - Announcements ECE 3140/CS 3420 Computer...

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

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