Instruction Set Architecture
The Instruction Set Architecture (ISA) defines the interface between hardware and software. It specifies the instructions a processor can execute, their formats, addressing modes, and data types. ISA is the programmer's view of the machine.
Instruction Format
An instruction consists of an opcode (operation) and operands (data/addresses). Formats vary by number of operands: three-address (R1 = R2 + R3), two-address (R1 = R1 + R2), one-address (uses accumulator), and zero-address (stack-based). Instruction length can be fixed or variable.
Addressing Modes
Immediate: operand is in the instruction. Direct: address of operand is given. Indirect: address of address is given. Register: operand is in a register. Register indirect: register holds the address. Indexed: base + offset. Relative: PC + offset. Each mode offers different trade-offs in flexibility and speed.
Instruction Types
Instructions are categorised as: data transfer (MOV, LOAD, STORE, PUSH, POP), arithmetic (ADD, SUB, MUL, DIV), logical (AND, OR, XOR, NOT, shift/rotate), control flow (JMP, CALL, RET, conditional branches), and I/O instructions.
CISC vs RISC
CISC (Complex Instruction Set Computer) has many complex instructions with variable length (x86). RISC (Reduced Instruction Set Computer) has fewer, simpler, fixed-length instructions (ARM, MIPS). RISC favours pipelining and compiler optimisation. Modern processors blend both approaches.
Assembly Language
Assembly language is a low-level language using mnemonics for machine instructions. An assembler translates assembly to machine code. Assembly provides direct hardware control and is used for performance-critical code, device drivers, and embedded systems. Each processor family has its own assembly language.
Stack Architecture
Stack-based architectures use a stack for operands. Operations pop operands and push results. Postfix (Reverse Polish) notation eliminates parentheses. Java bytecode uses a stack architecture. Stack machines simplify compiler design but may not map efficiently to register-based hardware.
Summary
The ISA defines what a processor can do. Understanding instruction formats, addressing modes, CISC/RISC philosophies, and assembly language is essential for system programming and computer architecture.