william stallings computer organization and architecture · amain memory (or virtual memory or...

30
1 William Stallings Computer Organization and Architecture Chapter 9 Set Instruksi: Karakteristik dan Fungsi

Upload: doankhue

Post on 03-May-2019

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

1

William Stallings Computer Organization and Architecture

Chapter 9Set Instruksi:Karakteristikdan Fungsi

Page 2: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

2

Set instruksi ?

Kumpulan instruksi lengkap yang dimengerti oleh CPUKode mesinBinerKode assembly

Page 3: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

3

Elemen Instruksi

Operation code (Op code)Kerjakan

Source Operand referenceDengan data ini

Result Operand referenceSimpan hasilnya kesini

Next Instruction ReferenceSetelah selesai, kerjakan ini ...

Page 4: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

4

Operands ?

Main memory (or virtual memory or cache)CPU registerI/O device

Page 5: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

5

Penyajian Instruksi

Dlm kode mesin setiap instruksi memiliki pola-bit tertentuUntuk konsumsi programmers disediakan penyajian simbolik

Contoh: ADD, SUB, LOAD

Operand juga disajikan secara simbolik Contoh: ADD A,B

Page 6: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

6

Jenis Instruksi

Data processingData storage (main memory)Data movement (I/O)Program flow control

Page 7: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

7

Jumlah addres (a)

3 addresOperand 1, Operand 2, ResultContoh: ADD A,B,Ca = b + c;Jarang digunakanPerlu word yang panjang

Page 8: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

8

Jumlah addres (b)

2 addresSalah satu sebagai operand dan resultContoh: ADD A,Ba = a + bInstruksi lebih pendekDiperlukan kerja ekstra⌧Temporary storage untuk menyimpan beberapa hasil

operasi

Page 9: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

9

Jumlah addres (c)

1 addresAddres kedua Implicit Biasanya register (accumulator)

Page 10: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

10

Jumlah addres (d)

0 (zero) addressemua addres implicitmenggunakan stackContoh:

push apush baddpop c

Berarti:c = a + b

Page 11: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

11

Addres banyak ? Sedikit ?

Addres banyakInstruksi semakin kompleksperlu register banyakProgram lebih pendekLebih cepat ?

Addres sedikitInstruksi lebih sederhanaEksekusi lebih cepat

Page 12: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

12

Pertimbangan Perancangan (1)

OperationBerapa banyak operand?Apa saja operasi yang dikerjakan?Seberapa komplekx?

Jenis dataFormat instruksi

Panjang opcodeJumlah addres

Page 13: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

13

Pertimbangan Perancangan (2)

RegisterJumlah register yang tersedia dlm CPUOperasi apa yg dpt dikerjakan oleh masing-masing registers?

Addressing modes (…)

RISC v CISC

Page 14: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

14

Jenis Operand

AddresNumber

Integer/floating point

CharacterASCII etc.

Logical DataBits or flags

(Apa ada bedanya antara number dg character?)

Page 15: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

15

Tipe Data pada Pentium

8 bit Byte16 bit word32 bit double word64 bit quad wordAddressing menggunakan 8 bit unit32 bit double word dibaca pada addres yg habis dibagi dg 4

Page 16: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

16

Tipe Data Specifik

General – sembarang isi binerInteger - single binary valueOrdinal - unsigned integerUnpacked BCD - One digit per bytePacked BCD - 2 BCD digits per byteNear Pointer - 32 bit offset within segmentBit fieldByte StringFloating Point

Page 17: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

17

Tipe Data Floating Point pada Pentium

Stallings hal:324

Page 18: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

18

Jenis Operasi

Data TransferArithmeticLogicalConversionI/OSystem ControlTransfer of Control

Page 19: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

19

Data Transfer

menentukanSourceDestinationJumlah data

Beda instruksi untuk setiap data movement yang beda

pada IBM 370

Atau satu instruction dengan addres yg bedapada VAX

Page 20: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

20

Arithmetic

Add, Subtract, Multiply, DivideSigned IntegerFloating point ?Termasuk operasi:

Increment (a++)Decrement (a--)Negate (-a)

Page 21: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

21

Logical

Bitwise operationsAND, OR, NOT

Page 22: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

22

Conversion

Contoh: Biner ke Decimal

Page 23: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

23

Input/Output

Tersedia instruksi khususAtau digunakan instruksi data movement (memory mapped)Atau dikerjakan oleh controller (DMA)

Page 24: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

24

Systems Control

Privileged instructionsCPU harus berada pada state tertentu

Ring 0 pada 80386+Kernel mode

Digunakan oleh operating systems

Page 25: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

25

Transfer of Control

BranchContoh: branch to x if result is zero

SkipContoh: increment and skip if zeroISZ Register1Branch xxxxADD A

Subroutine callinterrupt call

Page 26: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

26

Baca sendiri

Jenis operasi pada Pentium and PowerPCStallings hal:338

Page 27: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

27

Byte Order(bagian dari chips?)

Bagaiamana urutan bilangan yang lebih dari 1 byte disimpan/dibacacontoh (dalam hex)Bilangan 12345678 dapat disimpan pada lokasi 4x8bit sbb:

Page 28: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

28

Contoh Byte Order

Address Value (1) Value(2)184 12 78185 34 56186 56 34186 78 12

top down atau bottom up?

Page 29: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

29

Penamaan Byte Order

Problem ordering dinamakan EndianLSB pada posisi paling kiri (pada addres terkecil)Dinamakan big-endianLSB pada posisi paling kanan (pada addres terbesar)Dinamakan little-endian

Page 30: William Stallings Computer Organization and Architecture · aMain memory (or virtual memory or cache) aCPU register ... `Contoh: ADD A,B ... Tipe Data pada Pentium. a8 bit Byte

30

Standard…?

Pentium (80x86), VAX adalah little-endianIBM 370, Motorola 680x0 (Mac), dan RISC yang lain, adalah big-endianInternet menggunakan big-endian

Membuat program untuk Internet pada PC lebih susah.WinSock menyediakan htoi (Host to Internet) dan itoh (Internet to Host) untuk keperluan konversi