Presentation is loading. Please wait.

Presentation is loading. Please wait.

5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Assembly.

Similar presentations


Presentation on theme: "5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Assembly."— Presentation transcript:

1 5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Assembly Example We explore how the assembly process proceeds by “hand assembling” a simple ARC assembly language program.

2 5-2 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Memory Map for the ARC Memory locations are arranged linearly in consecutive order. Each numbered locations corresponds to an ARC word. The unique number that identifies each word is referred to as its address.

3 5-3 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Forward Referencing An example of forward referencing:

4 5-4 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Macro Definition A macro definition for push:

5 5-5 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring ARC User-Visible Registers

6 5-6 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Subroutine Linkage – Registers Subroutine linkage with registers passes parameters in registers.

7 5-7 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Subroutine Linkage – Data Link Area Subroutine linkage with a data link area passes parameters in a separate area in memory. The address of the memory area is passed in a register (%r5 here).

8 5-8 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Subroutine Linkage – Stack Subroutine linkage with a stack passes parameters on a stack.

9 5-9 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Stack Linkage Example A C program illustrates nested function calls.

10 5-10 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Stack Linkage Example (cont’) (a-f) Stack behavior during execution of the program shown in previous slide.

11 5-11 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Stack Linkage Example (cont’) (g-k) Stack behavior during execution of the C program shown previously.

12 5-12 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Exercise Pg. 148 4.7


Download ppt "5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Assembly."

Similar presentations


Ads by Google