1 / 35

Machine Instruction Formats and Types of Operations

This article explains the formats of machine instructions and the different types of operations such as data transfer, arithmetic, logical, I/O, system control, and transfer of control. It also covers the various instruction types and common instruction set operations.

tammybrown
Download Presentation

Machine Instruction Formats and Types of Operations

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. บทที่ 5 ภาษาเครื่อง Instruction Formats รูปแบบคำสั่งเครื่อง

  2. ประเภทของการดำเนินการประเภทของการดำเนินการ Type of Operations • Data Transfer • Arithmetic • Logical • I/O • System Control • Transfer of Control

  3. ประเภทของคำสั่ง Instruction Types • Data Storage (Memory Instructions) • Data Processing (Arithmetic & Logic Instructions) • Data Movement (I/O Instructions) • Control (Test & Branch Instructions)

  4. Data Transfer If one or both operands are in memory, CPU must perform some or all of the following actions : 1. Calculate memory address (Address Mode) 2. If refer to virtual memory, translate from virtual to actual memory address 3. Determine whether addressed item is in cache 4. If not, issue a command to memory module

  5. Data Transfer Common Instruction Set Operations • Move (transfer) Transfer word or block from source to destination • Store Transfer word from processor to memory • Load (fetch) Transfer word from memory to processor • Exchange Swap contents of source and destination • Clear (reset) Transfer word of 0s to destination • Set Transfer word of 1s to destination • Push Transfer word from source to top of stack • Pop Transfer word from top of stack to destination

  6. IBM S/370

  7. Arithmetic and Logical • May involve data transfer, before and/or after • Perform function in ALU • Set condition codes and flags

  8. Arithmetic Common Instruction Set Operations • Add Computer sum of two operands • Subtract Compute difference of two operands • Multiply Compute product of two operands • Divide Compute quotient of two operands • Absolute Replace operand by its absolute value • Negate Change sign of operand • Increment Add 1 to operand • Decrement Subtract 1 from operand

  9. Logical • AND • OR • NOTPerform the specified logical (Complement) operation bitwise • Exclusive-OR • Test Test specified condition; set flag(s) based on outcome • Compare Make logical or arithmetic comparison of two or more operands; set flag(s) based on outcome • Set Control Variables Class of instructions to set controls for protection purposes, interrupt handling, timer control, etc. • Shift Left (right) shift operand, introducing constants at end • Rotate Left (right) shift operand, with wraparound end

  10. Conversion • Similar to arithmetic and logical. May involve special logic to • perform conversion between data types and formats

  11. Conversion • Packed Decimal <==> Unpacked • Short ==> Long Form of Binary • Decimal <==> Binary • EBCDIC ==> ASCII

  12. Conversion • Translate Translate values in a section of memory based on a table of correspondences • Convert Convert the contents of a word from one form to another (e.g., packed decimal to binary)

  13. I/O • Issue command to I/O module If memory-mapped I/O, determine memory-mapped address

  14. I/O • Input (read) Transfer data from specified I/O port or device to destination (e.g., main memory or processor register) • Output (write) Transfer data from specified source to I/O port or device • Start I/O Transfer instructions to I/O processor to initiate I/O operation • Test I/O Transfer status information from I/O system to specified destination

  15. System Control • Read or Alter a Control Registers • Read or Modify a storage protection key • Access to process control blocks in a multiprogramming system Execute in the privileged state or privileged area of memory and reserve for use of O.S.

  16. Transfer of Control • Update program counter. For subroutine call/return, manage parameter passing and linkage

  17. Transfer of Control • Jump (branch) Unconditional transfer; load PC with specified address • Jump Conditional Test specified condition; either load PC with specified address or do nothing, based on condition • Jump to Subroutine Place current program control information in known location; jump to specified address • Return Replace contents of PC and other register from known location • Execute Fetch operand from specified location and execute as instruction; do not modify PC

  18. Transfer of Control • Skip Increment PC to skip next instruction • Skip Conditional Test specified condition; either skip or do nothing based on condition • Halt Stop program execution • Wait (hold) Stop program execution; test specified condition repeatedly; resume execution when condition is satisfied • No operation No operation is performed, but program execution is continued

  19. Transfer of Control • Branch (Conditional, Unconditional)

  20. Transfer of Control • Procedure Call

  21. Transfer of Control • Procedure CALLand RETURN

  22. Transfer of Control

  23. Types of Operands • Addresses • Numbers • Characters • Logical Data

  24. Types of Operands Intel Data Types

  25. Types of Operands Pentium Numeric Data Formats

  26. Types of Operands Pentium Numeric Data Formats

  27. Instruction Format ปัจจัยที่มีผลต่อความยาวของคำสั่งเครื่อง • Number of Addressing Modes • Number of Operands • Register versus Memory • Number of Register Sets Etc.

  28. DEC : Digital Equipment Corporation ตัวอย่างรูปแบบคำสั่งเครื่อง PDP-8

  29. ตัวอย่างรูปแบบคำสั่งเครื่องตัวอย่างรูปแบบคำสั่งเครื่อง PDP-11

  30. DEC : Digital Equipment Corporation ตัวอย่างรูปแบบคำสั่งเครื่อง • VAX Fig 11.7 MicroVAXes VAX stations VAX servers VAX 700 series VAX 8000 series VAX 4000 series VAX 6000 series VAX 7000 series More Information at http://www.netbsd.org/Documentation/Hardware/Machines/DEC/vax/sections.html

  31. Pentium • Instruction Prefixes • Segment Override • Address Size • Operand Size • Op-code • Mode R/m • SIB • Displacement • Immediate Scale factor + Index + Base

  32. Pentium Instruction Formats

  33. IBM System 360/370 Series RISC • Instruction Length • 16 bits, 32 bits, 48 bits • Op-Code = 8 bits IBM Reference

  34. PowerPC เพาเวอร์พีซี (PowerPC) เป็นสถาปัตยกรรมไมโครโพรเซสเซอร์แบบ RISC ร่วมกันสร้างโดยพันธมิตร AIM (Apple-IBM-Motorola) เมื่อ ค.ศ. 1991 ในช่วงแรกนั้นเพาเวอร์พีซีออกแบบมาสำหรับเครื่องคอมพิวเตอร์ส่วนบุคคล แต่ภายหลังเพาเวอร์พีซีได้รับความนิยมในวงการคอมพิวเตอร์ฝังตัว และคอมพิวเตอร์สมรรถนะสูงเช่นกัน เพาเวอร์พีซีถูกในไปใช้ในเครื่องแมคอินทอชของแอปเปิล รุ่นที่ออกระหว่าง ค.ศ. 1994-ค.ศ. 2005 และเครื่องเล่นวิดีโอเกมหลายรุ่น เช่น นินเทนโด เกมคิวบ์, เอ็กซ์บ็อกซ์ 360, เพลย์สเตชั่น 3 และนินเทนโด วี สถาปัตยกรรมเพาเวอร์พีซีนั้นพัฒนาต่อมาจากสถาปัตยกรรม POWER ของไอบีเอ็มเอง • Instruction Length 32 bits • Op-Code = 6 bits Fig 11.9

  35. โปรดติดตาม บทที่ 5 ภาษาเครื่อง Flow of Control การควบคุมสายงาน

More Related