Beruflich Dokumente
Kultur Dokumente
4-2
Chapter Contents
4.1 Hardware Components of the Instruction Set Architecture 4.2 ARC, A RISC Computer
4.3 Pseudo-Operations
4.4 Synthetic Instructions 4.5 Examples of Assembly Language Programs 4.6 Accessing Data in MemoryAddressing Modes 4.7 Subroutine Linkage and Stacks 4.8 Input and Output in Assembly Language 4.9 Case Study: The Java Virtual Machine ISA
4-3
4-4
4-5
4-6
4-7
4-8
Thus the byte address 0x00001003 contains the byte 0xDD. Since this is a big-endian machine (the big end is stored at the lowest address) the word stored at address 0x00001000 is 0xAABBCCDD.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-9
4-10
4-11
An Example Datapath
The ARC datapath is made up of a collection of registers known as the register file and the arithmetic and logic unit (ALU).
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-12
4-13
4-14
4-15
Since ARC is a load-store machine, the code must first fetch the x and y operands from memory using ld instructions, and then perform the addition, and then store the result back into z using an st instruction.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-16
4-17
4-18
4-19
4-20
4-21
ARC Pseudo-Ops
Pseudo-ops are instructions to the assembler. They are not part of the ISA, but instruct the assembler to do an operation at assembly time.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-22
Synthetic Instructions
Many assemblers will accept synthetic instructions that are converted to actual machine-language instructions during assembly. The figure below shows some commonly used synthetic instructions.
Synthetic instructions are single instructions that replace single instructions, which are different from macros which are discussed later.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-23
4-24
4-25
which means multiply B by C and store the result at A. (The mult and add operations are generic; they are not ARC instructions.) Then, add D to A and store the result at address A. The program size is 72 = 14 bytes. Memory traffic is 14 + 2(23) = 26 bytes.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-26
load
mult add
B, A
C, A D, A
The program size is now 3(1+22) or 15 bytes. Memory traffic is 15 + 22 + 223 or 31 bytes.
4-27
load
mult add
B
C D
store
The load instruction loads B into the accumulator, mult multiplies C by the accumulator and stores the result in the accumulator, and add does the corresponding addition. The store instruction stores the accumulator in A. The program size is now 34 or 12 bytes, and memory traffic is 12 + 42 or 20 bytes.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-28
Addressing Modes
Four ways of computing the address of a value in memory: (1) a constant value known at assembly time, (2) the contents of a register, (3) the sum of two registers, (4) the sum of a register and a constant. The table gives names to these and other addressing modes.
Computer Architecture and Organization by M. Murdocca and V. Heuring 2007 M. Murdocca and V. Heuring
4-29
4-30
4-31
4-32
4-33
(a-f) Stack behavior during execution of the program shown in previous slide.
4-34
4-35
4-36
4-37
4-38
4-39
4-40
4-41
4-42