Instructions are the fundamental commands given to the CPU to perform specific operations. Based on how they operate and where they fetch or store data, instructions are broadly classified into:
✅ 1. Memory Reference Instructions
✅ 2. Register Reference Instructions
✅ 3. Input-Output Instructions
🧠 1. Memory Reference Instructions
These instructions access memory to perform operations. They are the most commonly used instructions and usually involve the Accumulator (AC).
🔸 Features:
- Involve memory locations for operands.
- Use the Accumulator (AC) as default.
- Can be of direct or indirect type.
🔹 Instruction Format (16-bit):
| 15 | 14 13 12 | 11..................0 |
| I | Opcode | Address |
- I = 0: Direct Addressing
- I = 1: Indirect Addressing
🔹 Common Memory Reference Instructions:
Mnemonic | Operation | Description |
---|---|---|
LDA | AC ← M[addr] | Load memory content into AC |
STA | M[addr] ← AC | Store AC content into memory |
ADD | AC ← AC + M[addr] | Add memory value to AC |
SUB | AC ← AC – M[addr] | Subtract memory value from AC |
AND | AC ← AC ∧ M[addr] | Logical AND operation |
OR | AC ← AC ∨ M[addr] | Logical OR operation |
BUN | PC ← addr | Unconditional jump |
BSA | M[addr] ← PC; PC ← addr + 1 | Branch & Save Address (Subroutine call) |
ISZ | M[addr] ← M[addr] + 1; if 0 skip | Increment and skip if result is 0 |
🧠 2. Register Reference Instructions
These instructions operate only on CPU registers, without accessing memory. Typically, they perform simple, fast operations on the Accumulator (AC) or control bits.
🔸 Features:
- Do not access memory.
- Involve AC or control flags.
- Execute micro-operations like clear, complement, or increment.
🔹 Instruction Format:
| 15 14 13 | 12....................1 | 0 |
| 111 | 00000000000 | 0 |
Opcode is 111, and the I-bit = 0 distinguishes it as register reference.
🔹 Common Register Reference Instructions:
Mnemonic | Operation | Description |
---|---|---|
CLA | AC ← 0 | Clear the Accumulator |
CLE | E ← 0 | Clear the carry flag (E) |
CMA | AC ← 1’s complement | Complement bits of AC |
CME | E ← 1’s complement | Complement the carry flag |
INC | AC ← AC + 1 | Increment AC by 1 |
SPA | Skip if AC > 0 | Skip next if AC is positive |
SNA | Skip if AC < 0 | Skip next if AC is negative |
SZA | Skip if AC = 0 | Skip next if AC is zero |
HLT | Halt | Stop the computer |
🧠 3. Input-Output Instructions
These instructions allow data transfer between the CPU and I/O devices. The communication happens using the I/O interface.
🔸 Features:
- Use special I/O control signals.
- Operate through Input/Output flags.
- No memory address is involved.
🔹 Instruction Format:
| 15 14 13 | 12....................1 | 0 |
| 111 | 00000000000 | 1 |
Opcode is 111, and I-bit = 1 identifies it as I/O instruction.
🔹 Common Input-Output Instructions:
Mnemonic | Operation | Description |
---|---|---|
INP | AC ← Input buffer | Read input from device to AC |
OUT | Output buffer ← AC | Send AC contents to output device |
SKI | Skip if input flag = 1 | Skip next if input ready |
SKO | Skip if output flag = 1 | Skip next if output ready |
ION | Interrupt enable | Allow interrupts |
IOF | Interrupt disable | Disable interrupts |
📊 Comparison Table
Feature | Memory Reference | Register Reference | Input-Output |
---|---|---|---|
Access Memory | Yes | No | No |
Operates on | Memory & AC | AC & Control Flags | I/O Devices |
Opcode Format | 3-bit + 12-bit addr | 111 + control bits | 111 + I/O bits |
Addressing Mode | Direct/Indirect | Not applicable | Not applicable |
Example Instructions | LDA, ADD, BUN | CLA, INC, HLT | INP, OUT, ION |
🎓 Conclusion
Understanding these instruction types is essential for:
- CPU instruction decoding
- Writing low-level programs
- Studying micro-operations and control logic
Each instruction type plays a vital role in CPU functioning, data processing, and device communication.