pertemuan 15 instruction set

Post on 29-Jan-2016

53 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Pertemuan 15 Instruction Set. Matakuliah: H0344/Organisasi dan Arsitektur Komputer Tahun: 2005 Versi: 1/1. Learning Outcomes. Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : Menghubungkan instructions set untuk merealisasikan suatu proses sederhana. Outline Materi. - PowerPoint PPT Presentation

TRANSCRIPT

1

Pertemuan 15Instruction Set

Matakuliah : H0344/Organisasi dan Arsitektur Komputer

Tahun : 2005

Versi : 1/1

2

Learning Outcomes

Pada akhir pertemuan ini, diharapkan mahasiswa

akan mampu :

• Menghubungkan instructions set untuk merealisasikan suatu proses sederhana

3

Outline Materi

• Machine Instruction Characteristics

• Types of Operands

• Types of Operation

• Assembly Language

• Addressing

• Instruction Formats

4

Machine instruction characteristics

Instructionfetch

Instructionaddress

calculation

Instructionoperationdecoding

Operandfetch

Operandaddress

calculation

Dataoperation

Operandstore

Operandaddress

calculation

Multipleoperands

Multipleresult

Return for stringor vector data

Instruction complete,fetch next instruction

Instruction Cycle State Diagram

5

Machine instruction characteristicsElements of a machine instruction

1. Operation code

2. Source operand reference

3. Result operand reference

4. Next instruction reference

Source and result operands can be in one of three areas:

1. Main or virtual memory

2. CPU register

3. I/O device

6

Machine instruction characteristicsInstruction representation

• mnemonics

A simple instruction format

Opcode Operand reference Operand reference

4 bits 6 bits 6 bits

16 bits

7

Machine instruction characteristicsInstruction types

1. Load a register with the contents of memory location 513.

2. Add the contents of memory location 514 to the register.

3. Store the content of the register in memory location 513.

The operation

X = X + YX = 513Y = 514

could be accomplished with three instructions:

8

Machine instruction characteristicsInstruction types

1. Data processing

2. Data storage

3. Data movement

4. Control

We can categorize instruction types as follows:

9

Machine instruction characteristicsNumber of address

One of the traditional ways of describing processor architecture is in term of the number of address contained in each instruction.

Instruction Comment Instruction Comment Instruction Comment

Sub Y, A, B Y A - B Move Y, A Y A Load D Ac D

Mpy T, D, E T D x E Sub Y, B Y Y - B Mpy E Ac Ac x E

Add T, T, C T T + E Move T, D T D Add C Ac Ac + E

Div Y, Y, T Y Y / T Mpy T, E T E Stor Y Y Ac

Add T, C T C Load A Ac A

Div Y, T Y Y / T Sub B Ac Ac - B

Div Y Ac Ac / Y

Stor Y Y Ac

(a) Three address instructions (b) Two address instructions (c) One address instructions

10

Machine instruction characteristicsInstruction set design

The most important of these fundamental design issues include the following:

1. Operation repertoire

2. Data types

3. Instruction format

4. Register

5. Addressing

11

Types of operands

The most important general categories of data are:

1. Address

2. Numbers

3. Characters

4. Logical data

12

Types of operations

A useful and typical categories of operations is the following:

1. Data transfer

2. Arithmetic

3. Logical

4. Conversion

5. I/O

6. System control

7. Transfer of control

13

Branch instructions

Types of operationsTransfer of control

Memoryaddress

Instruction

200

201

202

203

Sub X, Y

Brz 211

210

211

Br 202

225 Bre R1, R2, 235

235

14

Skip instruction

Types of operationsTransfer of control

Memoryaddress

Instruction

301

202

203 Isz R1

210

Br 301

15

Procedure call instruction

Types of operationsTransfer of control

Call Proc1

Call Proc2

Call Proc2

Return

Return

4000

41004101

4500

46004601

46504651

4800

Mainprogram

ProcedureProc1

ProcedureProc2

4101

o o

4101

o

o

o

o o

4101

4601

4101

4651

4101

(a) Initial stackcontent

(b) AfterCall Proc1

(c) InitialCall Proc2

(d) AfterReturn

(e) AfterCall Proc2

(d) AfterReturn

(d) AfterReturn

16

Stock Frame Growth Using Sample Procedures P and Q

Types of operationsTransfer of control

Return point

Old frame pointer

x1

x2

Return point

Old frame pointer

x1

x2

Return point

Old frame pointer

y1

y2

Stack pointer

Frame pointer

P : P :

Q :

Stack pointer

Frame pointer

(a) P is active (b) P has called Q

17

Assembly language

Problem: N = I + J + K

The program consists of four instructions:

1. Load the contents of location 201 (I) into the Ac.

2. Add the contents of location 202 (J) into the Ac.

3. Add the contents of location 203 (K) into the Ac.

4. Store the contents of the Ac into location 204 (N).

18

Computation of the Formula N = I + J + K

Assembly language

101

102

103

104

201

202

203

204

0010 0010 0000 0001

0001 0010 0000 0010

0001 0010 0000 0011

0011 0010 0000 0100

0010

0011

0100

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

Address Contents

101

102

103

104

201

202

203

204

Address

(a) Binary program

2201

1202

1203

3204

0002

0003

0004

0000

Contents

(c) Hexadecimal program

101

102

103

104

201

202

203

204

Lda 201

Add 202

Add 203

Sta 204

2

3

4

0

Dat

Dat

Dat

Dat

Address Instructions

(b) Symbolic program

Formul

I

J

K

N

Lda I

Add J

Add K

Sta L

2

3

4

0

Dat

Dat

Dat

Dat

Label Instructions

(d) Assembly program

top related