1. Instruction formats and the number of addresses
An instruction is an opcode (which operation) followed by operand fields (registers, memory addresses or constants). The instruction set architecture (ISA) is the set of instructions, formats, registers and addressing modes the programmer sees.
| Format | Example | Meaning |
|---|---|---|
| 3-address | ADD R1, R2, R3 |
|
| 2-address | ADD R1, R2 |
(one source is overwritten) |
| 1-address | ADD X |
(accumulator machine) |
| 0-address | ADD |
pop two values, push their sum (stack machine) |
Fewer addresses mean shorter instructions but more instructions per program.
RISC vs CISC
| RISC | CISC | |
|---|---|---|
| Instruction length | fixed | variable |
| Memory access | only LOAD/STORE (load-store architecture) |
many instructions can use memory operands |
| Addressing modes | few | many |
| Registers | many general-purpose | fewer |
| Control unit | usually hardwired | often microprogrammed |
| Pipelining | easy | harder |
A field that must name one of registers needs bits. A memory address field for addressable units needs bits. Whatever is left in a fixed-length instruction is the opcode, and opcode bits allow at most distinct opcodes.