Apakah Set Arahan - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Apakah Set Arahan

Description:

1 address. Implicit second address. Usually a register (accumulator) ... Lbh daftar (register) Inter-register operations are quicker. Sedikit arahan per program ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 32
Provided by: falkultisa
Category:
Tags: apakah | arahan | register | set

less

Transcript and Presenter's Notes

Title: Apakah Set Arahan


1
Apakah Set Arahan?
  • Koleksi arahan yg lengkap yg difahami oleh CPU
  • Kod Mesin (Machine code)
  • Perduaan (Binary)
  • Selalunya diwakili oleh kod2 penghimpunan
    (assembly codes)

2
Element2 Arahan
  • Kod operasi (Operation code - op code).
  • Buat ini (Do this).
  • Sumber rujukan operan (Source operand reference).
  • Ke ini (To this).
  • Rujukan jawapan operan (Result operand
    reference).
  • Letak jawapan di sini.
  • Rujukan arahan berikut (Next instruction
    reference).
  • Pabila ia selesai, buat ini pulak...

3
Pewakilan Arahan
  • Dlm kod mesin, setiap arahan mempunyai pola bit
    yg unik
  • Utk kemudahan manusia (yakni pengaturcara),
    pewakilan simbolik digunakan
  • Cth. Add, sub, load
  • Operan juga boleh diwakili dgn cara ini
  • Add a,b

4
Format2 Arahan
  • Paparan bit2 dlm arahan
  • Termasuk opcode
  • Termasuk (tersirat atau nyata) operan2
  • Selalunya lbh drpd satu format arahan dlm set
    arahan.

5
Format Arahan
Arahan
4
6
6
Operand Reference 1
Operand Reference 2
Op-Code
Operand field
16 bits
6
Jenis2 Arahan
  • Pemprosesan data (Data processing)
  • Penyimpanan data (Data storage - memori utama)
  • Pergerakkan data (Data movement- I/O)
  • Program flow control

7
Panjang Arahan
  • Dipengaruhi oleh dan mempengaruhi
  • Saiz Memori
  • Oraganisasi Memori
  • Struktur bas
  • Kekompleksan CPU
  • Kelajuan CPU
  • Keseimbangan ant powerful instruction
    repertoire saving space.

8
Number of Addresses (a)
  • 3 addresses
  • Operand 1, Operand 2, Result
  • a b c
  • May be a forth - next instruction (usually
    implicit)
  • Not common
  • Needs very long words to hold everything

9
Number of Addresses (b)
  • 2 addresses
  • One address doubles as operand and result
  • a a b
  • Reduces length of instruction
  • Requires some extra work
  • Temporary storage to hold some results

10
Number of Addresses (c)
  • 1 address
  • Implicit second address
  • Usually a register (accumulator)
  • Common on early machines

11
Number of Addresses (d)
  • 0 (zero) addresses
  • All addresses implicit
  • Uses a stack
  • e.g. push a
  • push b
  • add
  • pop c
  • c a b

12
Bilangan Alamat
  • Mesin satu alamat
  • Add b gt ac ac b
  • Mesin dua alamat
  • Sub a, b gt a a - b
  • Mesin tiga alamat
  • Add a, b, c gt a b c

13
Bilangan Alamat
  • Arahan tiga alamat
  • Arahan komen/makna
  • Sub y, a, b ylt a-b
  • MPY t, d, e tlt de
  • Add t, t, c tlt tc
  • Div y, y, t ylt y/t
  • Y (a-b) / (cde)

14
Bilangan Alamat
  • Arahan dua alamat
  • MOV y, a ylt a
  • Sub y, b ylt y-b
  • MOV t, d tlt d
  • MPY t, e tlt te
  • Add t, c tlt tc
  • Div y, t ylt y/t
  • Y (a-b) / (cde)

15
Bilangan Alamat
  • Arahan satu alamat
  • LOD d aclt d
  • MPY e aclt ace
  • Add c acltacc
  • STR y ylt ac
  • LOD a aclt a
  • Sub b aclt ac-b
  • Div y aclt ac/y
  • STR y ylt ac
  • Y (a-b) / (cde)

16
Berapa banyak alamat?
  • Lebih alamat
  • Lbh komplek (powerful?) arahan
  • Lbh daftar (register)
  • Inter-register operations are quicker
  • Sedikit arahan per program
  • Sedikit alamat
  • Krg komplek (powerful?) arahan
  • Lbh arahan per program
  • Cepat Ambil/Laksana arahan

17
Keputusan Rekabentuk (1)
  • Himpunan operasi
  • Berapa byk operasi?
  • Apa yg blh dilakukan?
  • Berapa komplek?
  • Jenis2 data
  • Format2 arahan
  • Panjang kod operasi
  • Bilangan alamat

18
Keputusan Rekabentuk (2)
  • Daftar2 (Registers)
  • Bil. daftar2 CPU yg ada
  • Which operations can be performed on which
    registers?
  • Mod Alamat (later)
  • RISC v CISC

19
Jenis2 Operan
  • Alamat2.
  • Nombor2.
  • Integer/floating point.
  • Characters.
  • ASCII etc.
  • Data Logikal.
  • Bits or flags.
  • (Aside is there any difference between numbers
    and characters? Ask a C programmer!).

20
Pentium Data Types
  • 8 bit byte
  • 16 bit word
  • 32 bit double word
  • 64 bit quad word
  • Addressing is by 8 bit unit
  • A 32 bit double word is read at addresses
    divisible by 4

21
Specific Data Types
  • General - arbitrary binary contents
  • 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

22
Jenis2 Operasi
  • Perpindahan data (Data transfer)
  • Aritmetik
  • Logikal
  • Pertukaran (Conversion)
  • I/O
  • Kawalan sistem (System control)
  • Transfer of control

23
Perpindahan Data
  • Tentukan
  • Sumber (Source)
  • Destinasi (Destination)
  • Amount of data
  • Berkemungkinan arahan yg berbeza utk permindahan
    yg berbeza
  • E.G. IBM 370
  • Atau satu arahan dan berlainan alamat
  • E.G. VAX

24
Aritmetik
  • Tambah, tolak, darab, bahagi
  • Integer bertanda
  • Titik apungan?
  • Mungkin juga termasuk
  • Increment (a)
  • Decrement (a--)
  • Negate (-a)

25
Shift and Rotate Operations
26
Logikal
  • Bit wise operations
  • And, or, not

27
Pertukaran
  • Cth. Binary to decimal

28
Input/output
  • Mungkin ada arahan spesifik
  • Mungkin dilakukan mgunakan arahan peralihan data
    (memory mapped)
  • Mungkin dilakukan oleh controller (DMA) yg
    terasing.

29
Kawalan Sistem
  • Arahan terlindung
  • CPU perlu berada dlm situasi tertentu
  • Ring 0 on 80386
  • Kernel mode
  • Utk kegunaan OS

30
Permindahan Kawalan
  • Cabang (Branch)
  • E.G. Branch to x if result is zero
  • Langkau (Skip)
  • E.G. Increment and skip if zero
  • ISZ register1
  • Branch xxxx
  • Add a
  • Panggil subrutin (Subroutine call)
  • C.F. Interrupt call

31
Pentium Floating Point Data Types
  • See Stallings (5th Ed - Chapter 9, 6th Ed Chap
    10) / Instruction Sets Characteristics and
    Function
Write a Comment
User Comments (0)
About PowerShow.com