• Tidak ada hasil yang ditemukan

Ch04CAO.ppt 1953KB Jun 23 2011 01:00:04 PM

N/A
N/A
Protected

Academic year: 2017

Membagikan "Ch04CAO.ppt 1953KB Jun 23 2011 01:00:04 PM"

Copied!
42
0
0

Teks penuh

(1)

Computer Architecture and

Organization

Miles Murdocca and Vincent Heuring

(2)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

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 Memory—Addressing Modes 4.7 Subroutine Linkage and Stacks

(3)

The Instruction Set Architecture

• The Instruction Set Architecture (ISA) view of a machine corresponds to the machine and assembly language levels.

• A compiler translates a high level language, which is architecture independent, into assembly language, which is architecture

dependent.

• An assembler translates assembly language programs into executable binary codes.

• For fully compiled languages like C and Fortran, the binary codes are executed directly by the target machine. Java stops the

translation at the byte code level. The Java virtual machine, which is at the assembly language level, interprets the byte codes

(4)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

The System Bus Model of a Computer

System, Revisited

(5)

Common Data Type Sizes

• A byte is composed of 8 bits. Two nibbles make up a byte.

(6)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Big-Endian and Little-Endian Formats

• In a byte-addressable machine, the smallest datum that can be referenced in memory is the byte. Multi-byte words are stored as a sequence of bytes, in which the address of the multi-byte word is the same as the byte of the word that has the lowest address.

(7)
(8)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Example of ARC Memory Layout

• The table illustrates both the distinction between an address and the data that is stored there, and the fact that ARC/SPARC is a big-endian machine. The table shows four bytes stored at consecutive addresses 00001000 to 00001003.

• Thus the byte address 0x00001003 contains the byte 0xDD. Since this is a big-endian machine (the big end is stored at the lowest

(9)

Abstract View of a CPU

(10)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

The Fetch-Execute Cycle

• The steps that the control unit carries out in executing a program are: (1) Fetch the next instruction to be executed from memory.

(2) Decode the opcode.

(3) Read operand(s) from main memory, if any. (4) Execute the instruction and store results, if any. (5) Go to step 1.

(11)

An Example Datapath

• The ARC datapath is made up of a collection of registers known as the

(12)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

(13)

ARC Assembly Language Format

• The ARC assembly language format is the same as the SPARC assembly language format.

(14)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

ARC Load / Store Format

(15)

Simple Example: Add Two Numbers

• The figure shows a simple program fragment using our ld, st, and add instructions. This fragment is equivalent to the C statement:

z = x + y;

(16)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

ARC Transfer of Control Sequence

(17)

ARC Fragment that Computes the

Absolute Value

• As an example of using the ARC instruction types we have seen so far, consider the absolute value function, abs:

(18)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

A Portion of the ARC ISA

(19)
(20)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

(21)

ARC Pseudo-Ops

(22)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

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.

(23)

ARC Example Program

(24)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

A More

Complex

Example

Program

(25)

One, Two, Three-Address Machines

• Consider how the C expression A = B*C + D might be evaluated by each of the one, two, and three-address instruction types.

• Assumptions: Addresses and data words are two bytes in size. Opcodes are 1 byte in size. Operands are moved to and from memory one word (two bytes) at a time.

• Three-Address Instructions: In a three-address instruction, the expression A = B*C + D might be coded as:

mult B, C, A add D, A, A

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 72 = 14

(26)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

One, Two, Three-Address Machines

• Two Address Instructions: In a two-address instruction, one of the

operands is overwritten by the result. Here, the code for the expression A = B*C + D is:

load B, A

mult C, A

add D, A

(27)

One, Two, Three-Address Machines

• One Address (Accumulator) Instructions: A one-address instruction employs a single arithmetic register in the CPU, known as the

accumulator. The code for the expression A = B*C + D is now:

load B

mult C

add D

store A

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

(28)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Addressing Modes

• Four ways of computing the address of a value in memory: (1) a

(29)

Subroutine Linkage – Registers

(30)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Subroutine Linkage – Data Link Area

(31)

Subroutine Linkage – Stack

(32)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Stack

Linkage

Example

• A C program

(33)

Stack

Linkage

Example

(cont’)

• (a-f) Stack

(34)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Stack

Linkage

Example

(cont’)

• (g-k) Stack behavior during execution of the C program

(35)

Input and

Output for

the ISA

(36)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Touchscreen I/O Device

(37)

Flowchart for I/O

Device

(38)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

(39)

Java

Pro-gram

and

Com-piled

Class

(40)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

(41)
(42)

Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring

Byte Code for Java Program

• Disassembled byte code for previous Java program. Location Code Mnemonic Meaning

0x00e3 0x10 bipush Push next byte onto stack 0x00e4 0x0f 15 Argument to bipush

0x00e5 0x3c istore_1Pop stack to local variable 1 0x00e6 0x10 bipush Push next byte onto stack 0x00e7 0x09 9 Argument to bipush

0x00e8 0x3d istore_2Pop stack to local variable 2 0x00e9 0x03 iconst_0 Push 0 onto stack 0x00ea 0x3e istore_3Pop stack to local variable 3 0x00eb 0x1b iload_1 Push local variable 1 onto stack 0x00ec 0x1c iload_2 Push local variable 2 onto stack 0x00ed 0x60 iadd Add top two stack elements

Referensi

Dokumen terkait

Storage Devices: Input Meets Output. Solid-State

“Most popular” shelf: 20% most popular books.. 5 ft

Future Computer Advances are Between a Rock (Slow Memory) and a Hard Place (Multithreading)..

Organizations (ADAPSO), European Computer Manufacturers Association, American Federation of Information Processing Societies, and Business Equipment Manufacturers Assn.

transmisi data (contoh, komputer) dan media transmisi atau jaringan.  Karakteristik dari media transmisi 

 Network server software (installed on file server).  controls file access from the server’s

 Winners and their schools frequently mentioned in local newspapers  Subject of computer science is enhanced and attracts more attention  Good students (hopefully) get a

Using File hashes a forensic examiner can: Quickly locate and catalog every (graphic) file on a PC hard drive, and flag child pornographic images using a national database of