computer organization and architecture

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

Upload: thai

Post on 20-Mar-2016

48 views

Category:

Documents


0 download

DESCRIPTION

Computer Organization and Architecture. Chapter 9 Set Instruksi: Karakteristik dan Fungsi. Set instruksi ?. Kumpulan instruksi lengkap yang dimengerti oleh CPU Kode mesin Biner Kode assembly. Elemen Instruksi. Operation code (Op code) Kerjakan Source Operand reference Dengan data ini - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computer Organization  and Architecture

1

Computer Organization and Architecture

Chapter 9Set Instruksi:Karakteristik dan Fungsi

Page 2: Computer Organization  and Architecture

2

Set instruksi ?

Kumpulan instruksi lengkap yang dimengerti oleh CPU

Kode mesinBinerKode assembly

Page 3: Computer Organization  and Architecture

3

Elemen Instruksi

Operation code (Op code) Kerjakan

Source Operand reference Dengan data ini

Result Operand reference Simpan hasilnya kesini

Next Instruction Reference Setelah selesai, kerjakan ini ...

Page 4: Computer Organization  and Architecture

4

Operands ?

Main memory (or virtual memory or cache)

CPU registerI/O device

Page 5: Computer Organization  and Architecture

5

Penyajian Instruksi

Dlm kode mesin setiap instruksi memiliki pola-bit tertentu

Untuk konsumsi programmers disediakan penyajian simbolik Contoh: ADD, SUB, LOAD

Operand juga disajikan secara simbolik Contoh: ADD A,B

Page 6: Computer Organization  and Architecture

6

Jenis Instruksi

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

Page 7: Computer Organization  and Architecture

7

Jumlah addres (a)

3 addres Operand 1, Operand 2, Result Contoh: ADD A,B,C a = b + c; Jarang digunakan Perlu word yang panjang

Page 8: Computer Organization  and Architecture

8

Jumlah addres (b)

2 addres Salah satu sebagai operand dan result Contoh: ADD A,B a = a + b Instruksi lebih pendek Diperlukan kerja ekstra

Temporary storage untuk menyimpan beberapa hasil operasi

Page 9: Computer Organization  and Architecture

9

Jumlah addres (c)

1 addres Addres kedua Implicit Biasanya register (accumulator)

Page 10: Computer Organization  and Architecture

10

Jumlah addres (d)0 (zero) addres

semua addres implicit menggunakan stack Contoh: push a push b add pop c Berarti: c = a + b

Page 11: Computer Organization  and Architecture

11

Addres banyak ? Sedikit ?

Addres banyak Instruksi semakin kompleks perlu register banyak Program lebih pendek Lebih cepat ?

Addres sedikit Instruksi lebih sederhana Eksekusi lebih cepat

Page 12: Computer Organization  and Architecture

12

Pertimbangan Perancangan (1)

Operation Berapa banyak operand? Apa saja operasi yang dikerjakan? Seberapa komplekx?

Jenis dataFormat instruksi

Panjang opcode Jumlah addres

Page 13: Computer Organization  and Architecture

13

Pertimbangan Perancangan (2)

Register Jumlah register yang tersedia dlm CPU Operasi apa yg dpt dikerjakan oleh masing-

masing registers?Addressing modes (…)

RISC v CISC

Page 14: Computer Organization  and Architecture

14

Jenis Operand

AddresNumber

Integer/floating pointCharacter

ASCII etc.Logical Data

Bits or flags (Apa ada bedanya antara number dg character?)

Page 15: Computer Organization  and Architecture

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: Computer Organization  and Architecture

16

Tipe Data Specifik General – sembarang isi biner Integer - single binary value Ordinal - unsigned integer Unpacked BCD - One digit per byte Packed BCD - 2 BCD digits per byte Near Pointer - 32 bit offset within segment Bit field Byte String Floating Point

Page 17: Computer Organization  and Architecture

17

Tipe Data Floating Point pada Pentium

Stallings hal:324

Page 18: Computer Organization  and Architecture

18

Jenis Operasi

Data TransferArithmeticLogicalConversionI/OSystem ControlTransfer of Control

Page 19: Computer Organization  and Architecture

19

Data Transfer

menentukan Source Destination Jumlah data

Beda instruksi untuk setiap data movement yang beda pada IBM 370

Atau satu instruction dengan addres yg beda pada VAX

Page 20: Computer Organization  and Architecture

20

Arithmetic

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

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

Page 21: Computer Organization  and Architecture

21

Logical

Bitwise operationsAND, OR, NOT

Page 22: Computer Organization  and Architecture

22

Conversion

Contoh: Biner ke Decimal

Page 23: Computer Organization  and Architecture

23

Input/Output

Tersedia instruksi khususAtau digunakan instruksi data movement

(memory mapped)Atau dikerjakan oleh controller (DMA)

Page 24: Computer Organization  and Architecture

24

Systems Control

Privileged instructionsCPU harus berada pada state tertentu

Ring 0 pada 80386+ Kernel mode

Digunakan oleh operating systems

Page 25: Computer Organization  and Architecture

25

Transfer of Control

Branch Contoh: branch to x if result is zero

Skip Contoh: increment and skip if zero ISZ Register1 Branch xxxx ADD A

Subroutine call interrupt call

Page 26: Computer Organization  and Architecture

26

Baca sendiri

Jenis operasi pada Pentium and PowerPCStallings hal:338

Page 27: Computer Organization  and Architecture

27

Byte Order(bagian dari chips?)

Bagaiamana urutan bilangan yang lebih dari 1 byte disimpan/dibaca

contoh (dalam hex)Bilangan 12345678 dapat disimpan pada

lokasi 4x8bit sbb:

Page 28: Computer Organization  and Architecture

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: Computer Organization  and Architecture

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: Computer Organization  and Architecture

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