Computer Architecture : Instruction Types

The instruction set of a CPU can be categorized as follows:

1. Data Transfer Instructions:

Data transfer instructions cause transfer of data from one location to another without changing the information content. The common transfers may be between memory and processor registers.

  • MOV : Move byte or word to register or memory .
  • IN, OUT : Input byte or word from port, output word to port.
  • PUSH, POP : Push word onto stack, pop word off stack.
  • XCHG : Exchange byte or word.
  • LEA : Load effective address.
  • LDS, LES : Load pointer using data segment, extra segment. 

2. Data Manipulation Instructions: 

Data manipulation instructions perform operations on data and provide the computational capabilities for the computer. There are three types of data manipulation instructions: Arithmetic instructions, Logical and bit manipulation instructions, String manipulation instructions and Shift instructions.

Arithmetic Instructions :
  • ADD, SUB : Add, subtract byte or word 
  • ADC, SBB :Add, subtract byte or word and carry (borrow).
  • INC, DEC : Increment, decrement byte or word.
  • CMP : Compare byte or word (subtract without storing).
  • MUL, DIV : Multiply, divide byte or word (unsigned).
  • IMUL, IDIV : Integer multiply, divide byte or word (signed)

Logical instructions :
  • NOT :   Logical NOT of byte or word (one’s complement)
  • AND :  Logical AND of byte or word
  • OR : Logical OR of byte or word.
  • XOR : Logical exclusive-OR of byte or word
  • TEST : Test byte or word (AND without storing).

String Manipulation instructions :
  • MOVS : Move byte or word string
  • MOVSB, MOVSW : Move byte, word string.
  • CMPS :  Compare byte or word string.
  • LODS, STOS :  Load, store byte or word string to AL.
  • SCAS S : can byte or word string (comparing to A or AX)

Shift Instructions :
  • Shift, rotate instruction- SHL, SHR Logical shift left, right byte or word? by 1or CL
  • SAL, SAR : Arithmetic shift left, right byte or word? by 1 or CL
  • ROL, ROR : Rotate left, right byte or word? by 1 or CL .
  • RCL,  RCR : Rotate left, right through carry byte or word? by 1 or CL.

3. Program Control Instructions :

Program control instructions specify conditions for altering the content of the program counter, while data transfer and manipulation instructions specify conditions for data processing operations. The change in value of a program counter as a result of the execution of a program control instruction causes a break in the sequence of instruction execution.

Loop control Instructions :
  • LOOP : Loop unconditional, count in CX, short jump to target address.
  • LOOPE (LOOPZ) : Loop if equal (zero), count in CX, short jump to target address.
  • LOOPNE (LOOPNZ) : Loop if not equal (not zero), count in CX, short jump to target address.
  • JMP :Unconditional jump
  • JCXZ : Jump if CX equals zero (used to skip code in loop).

Subroutine and Intrrupt instructions :
  • CALL, RET :  Call, return from procedure (inside or outside current segment).
  • INT, INTO :  Software interrupt, interrupt if overflow.IRET: Return from interrupt.

4. Processor Control Instructions :

These instructions control the functioning of the available hardware inside the processor chip. These instructions are categorized into two types:

Flag Manipulation instructions :  The Flag manipulation instructions directly modify some of the Flags.
  • CLC – Clear Carry Flag.
  • CMC – Complement Carry Flag.
  • STC – Set Carry Flag.
  • CLD – Clear Direction Flag.
  • STD – Set Direction Flag.
  • CLI – Clear Interrupt Flag.
  • STI – Set Interrupt Flag.

Machine Control instructions : The Machine control instructions control the bus usage and execution.
  • WAIT – Wait for Test input pin to go low.
  • HLT – Halt the process. 
  • NOP – No operation.
  • ESC – Escape to external device like NDP
  • LOCK – Bus lock instruction prefix.



Next Topic : 

No comments:

Post a Comment