Instruction Decoder

A processor doesn't "understand" assembly code. It receives raw bytes — opcodes — from ROM. But how does a byte like 0001 0010 turn into "load the accumulator from address 2"? The instruction decoder is the translator.

The decoder is a combinational circuit. It takes the opcode bits as inputs and produces control signals as outputs. Each control signal activates a specific part of the processor: "enable ALU output," "write to register," "read from RAM," "increment program counter." The pattern of bits in the opcode uniquely determines which signals fire.

In a simple processor, the upper bits of the opcode typically encode the operation type (ADD, SUB, LDA, STA, JMP...), while the lower bits encode the operand — a register number or an immediate value. The decoder splits these, routes the operation bits to the control logic, and the operand bits to the appropriate destination.

Practical example. Consider an instruction with opcode 0100 0011 — "add the value from register 3 to the accumulator." The decoder sees 0100 (ADD operation) and sets control lines: ALU operation = ADD, ALU input A = accumulator, ALU input B = register file output. It sees 0011 (register 3) and sets the register file read address to 3. On the next clock cycle, the ALU adds accumulator + register 3, and the result is captured back into the accumulator. One byte, transformed into a coordinated sequence of electrical signals.