cse331-week4new

cse331-week4new - CSE 331 Computer Organization and Design...

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

View Full Document Right Arrow Icon
CSE331 W04.1 KB 2008Fall PSU CSE 331 Computer Organization and Design Fall 2008 Week 4 Section 1 & Section 2: K. Bhat. Course material on ANGEL: cms.psu.edu [Many thanks to Mary Jane Irwin’s Slides adapted from D. Patterson slides ]
Background image of page 1

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

View Full DocumentRight Arrow Icon
CSE331 W04.2 KB 2008Fall PSU Head’s Up Last week’s material MIPS control flow and logic operations This week’s material Supporting procedure calls and returns; addressing modes - Reading assignment - PH: 2.7-2.9, A.6, D.2 Next week’s material Assemblers, linkers and loaders - Reading assignment - PH: 2.10, A.1-A.5 Reminders HW 3 (another spim assignment) is due 9-18-08 (by 11:55pm) Exam #1 Thursday, Sept 29 th , 6:30 – 7:45pm, 101 Thomas - Please email me if you have a conflict
Background image of page 2
CSE331 W04.3 KB 2008Fall PSU The reality is that most code is not heavily performance-bound by the lack of one instruction. … So the belief that the microprocessor is but one or two instructions away from blindingly higher speed is almost always wrong. Bob Colwell, The Pentium Chronicles
Background image of page 3

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

View Full DocumentRight Arrow Icon
CSE331 W04.4 KB 2008Fall PSU Review: MIPS Organization Processor Memory 32 bits 2 30 words read/write addr read data write data word address (binary) 0…0000 0…0100 0…1000 0…1100 1…1100 Register File src1 addr src2 addr dst addr write data 32 bits src1 data src2 data 32 registers ($zero - $ra) 32 32 32 32 32 32 5 5 5 PC ALU 32 32 32 32 32 0 1 2 3 7 6 5 4 byte address (big Endian) Fetch PC = PC+4 Decode Exec Add 32 32 4 Add 32 32 br offset
Background image of page 4
CSE331 W04.5 KB 2008Fall PSU Programming Styles Procedures (or subroutines, functions) perform specific tasks based on the parameters provided. Reusable. Clever use of procedures in programs helps and debug the program Procedures allow the programmer to concentrate on one portion of the code at a time parameters act as barriers between the procedure and the rest of the program and data, allowing the procedure to be passed values ( arguments ) and to return values ( results )
Background image of page 5

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

View Full DocumentRight Arrow Icon
CSE331 W04.6 KB 2008Fall PSU Six Steps in Execution of a Procedure Main routine ( caller ) places parameters in a place where the procedure ( callee ) can access them $a0 - $a3 : four argument registers Caller transfers control to the callee Proc. Callee acquires the storage resources needed Callee performs the desired task Callee places the result value in a place where the caller can access it $v0 - $v1 : two value registers for result values Callee returns control to the caller $ra : one return address register to return to the point of origin
Background image of page 6
CSE331 W04.7 KB 2008Fall PSU MIPS procedure call instruction: jal ProcAddress #jump and link Saves PC+4 in register $ra as the link to the following instruction to set up the procedure return Machine format: Then can do procedure return with just jr $ra #return Instruction for Calling a Procedure op 26 bit address J format 3 ????
Background image of page 7

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

View Full DocumentRight Arrow Icon
CSE331 W04.8 KB 2008Fall PSU Basic Procedure Flow For a procedure that computes the GCD of two
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 40

cse331-week4new - CSE 331 Computer Organization and Design...

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

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