{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture_6 - ECE 445 Computer Organization Structured...

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

View Full Document Right Arrow Icon
ECE 445 – Computer Organization Structured Programming and The Stack (Lecture #6)
Image of page 1

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

View Full Document Right Arrow Icon
ECE 445 - Computer Organization 2 Structured Programming
Image of page 2
ECE 445 - Computer Organization 3 Structured Programming Structured programming is a subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. Structured programming frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A structured program is composed of - Functions - Procedures - Subroutines
Image of page 3

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

View Full Document Right Arrow Icon
ECE 445 - Computer Organization 4 Structured Programming To execute a subroutine, the program needs to: 1. Pass parameters to the procedure 2. Transfer control 3. Acquire storage needed 4. Perform the desired task 5. Return values to the calling procedure 6. Return control #1, #5 – parameter passing; #3 – storage - Requires memory and/or registers #2, #6 – jump
Image of page 4
ECE 445 - Computer Organization 5 Registers and Procedure Calls Registers are faster than memory. - Therefore, use registers to implement parameter passing and jumps. Registers $a0 - $a3 - Parameter passing Registers $v0 - $v1 - Return values Register $ra - Return address - Set by jal instruction; used by jr instruction See MIPS Reference Card
Image of page 5

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

View Full Document Right Arrow Icon
ECE 445 - Computer Organization 6 Registers and Procedure Calls Registers $s0 - $s7 - preserved across a procedure call.
Image of page 6
Image of page 7
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