Question: Topic: Instruction Set Architecture: Addressing Data in Memory Problem: Create an ARC Tool algorithm calling a three-deep nested subroutine using the Stack Frames discussed in

Topic: Instruction Set Architecture: Addressing Data in Memory

Problem: Create an ARC Tool algorithm calling a three-deep nested subroutine using the Stack Frames discussed in Chapter 4.7.

Here are some PowerPoint Slides from Chapter 4.7 for reference:

 Topic: Instruction Set Architecture: Addressing Data in Memory Problem: Create anARC Tool algorithm calling a three-deep nested subroutine using the Stack Framesdiscussed in Chapter 4.7. Here are some PowerPoint Slides from Chapter 4.7

Final Reminders: We are using a x32 bit Architecture, and the program we are using is called ARC Tools. You can see the syntax I'm looking for in the example slides.

Subroutine Linkage Using Stack The idea in this method is that the calling routine pushes all of its arguments onto a stack. The called routine then pops the passed arguments from the stack and pushes any return values onto the stack. The calling routine then retrieves the return value(s) from the stack and continues execution ! Calling routine ! Called routine to Arguments are on stack %sp [0] %sp %sp [0] %sp [4] + %r14 %sp, %r8 , %Sp.egu %r14 .egu addcc %sp, -4, st addcc %sp, -4, st call add 3 ld addcc %sp, 4, %sp pl add 3: Id %r1, %sp addcc ld addcc st 4, %sp %sp %r9, %r10 %r10, %sp Note: the advantage of using a stack is that its size grows and shrinks as needed. This supports arbitrary deep nesting of procedure calls without having to declare the size of the stack at assembly time. Stack is a preferred way of implementing subroutine linkage and is universally adopted by all vendors Subroutine Linkage Using Stack The idea in this method is that the calling routine pushes all of its arguments onto a stack. The called routine then pops the passed arguments from the stack and pushes any return values onto the stack. The calling routine then retrieves the return value(s) from the stack and continues execution ! Calling routine ! Called routine to Arguments are on stack %sp [0] %sp %sp [0] %sp [4] + %r14 %sp, %r8 , %Sp.egu %r14 .egu addcc %sp, -4, st addcc %sp, -4, st call add 3 ld addcc %sp, 4, %sp pl add 3: Id %r1, %sp addcc ld addcc st 4, %sp %sp %r9, %r10 %r10, %sp Note: the advantage of using a stack is that its size grows and shrinks as needed. This supports arbitrary deep nesting of procedure calls without having to declare the size of the stack at assembly time. Stack is a preferred way of implementing subroutine linkage and is universally adopted by all vendors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!