Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Apakah Set Arahan? Koleksi arahan yg lengkap yg difahami oleh CPU Kod Mesin (Machine code) Perduaan (Binary) Selalunya diwakili oleh kod2 penghimpunan."— Presentation transcript:

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 Op-Code Operand Reference 1 Operand Reference 2 466 16 bits Arahan Operand field

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 => ac = ac + b Mesin dua alamat –Sub a, b => a = a - b Mesin tiga alamat –Add a, b, c => a = b + c

13 Bilangan Alamat Arahan tiga alamat –Arahankomen/makna –Sub y, a, by<= a-b –MPY t, d, et<= d*e –Add t, t, ct<= t+c –Div y, y, ty<= y/t »Y= (a-b) / (c+d*e)

14 Bilangan Alamat Arahan dua alamat –MOV y, ay<= a –Sub y, by<= y-b –MOV t, dt<= d –MPY t, et<= t*e –Add t, ct<= t+c –Div y, ty<= y/t »Y= (a-b) / (c+d*e)

15 Bilangan Alamat Arahan satu alamat –LOD dac<= d –MPY eac<= ac*e –Add cac<=ac+c –STR yy<= ac –LOD aac<= a –Sub bac<= ac-b –Div yac<= ac/y –STR yy<= ac »Y= (a-b) / (c+d*e)

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 m’gunakan 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 (5 th Ed - Chapter 9, 6 th Ed – Chap 10) / Instruction Sets: Characteristics and Function


Download ppt "Apakah Set Arahan? Koleksi arahan yg lengkap yg difahami oleh CPU Kod Mesin (Machine code) Perduaan (Binary) Selalunya diwakili oleh kod2 penghimpunan."

Similar presentations


Ads by Google