1 / 31

Apakah Set Arahan?

Apakah Set Arahan?. Koleksi arahan yg lengkap yg difahami oleh CPU Kod Mesin (Machine code) Perduaan (Binary) Selalunya diwakili oleh kod2 penghimpunan (assembly codes). Element2 Arahan. Kod operasi (Operation code - op code). Buat ini (Do this).

Download Presentation

Apakah Set Arahan?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 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 => 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 • Arahan komen/makna • Sub y, a, b y<= a-b • MPY t, d, e t<= d*e • Add t, t, c t<= t+c • Div y, y, t y<= y/t • Y= (a-b) / (c+d*e)

  14. Bilangan Alamat • Arahan dua alamat • MOV y, a y<= a • Sub y, b y<= y-b • MOV t, d t<= d • MPY t, e t<= t*e • Add t, c t<= t+c • Div y, t y<= y/t • Y= (a-b) / (c+d*e)

  15. Bilangan Alamat • Arahan satu alamat • LOD d ac<= d • MPY e ac<= ac*e • Add c ac<=ac+c • STR y y<= ac • LOD a ac<= a • Sub b ac<= ac-b • Div y ac<= ac/y • STR y y<= 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 (5th Ed - Chapter 9, 6th Ed – Chap 10) / Instruction Sets: Characteristics and Function

More Related