Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

how would you have done things differently?

Answered: 1 week ago