Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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 vendorsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started