Decoder (Instruction Decoder)

Inputs

PinTypeDescription
Instrbus8Instruction byte — bits 7:4 = opcode, bits 3:0 = operand (ignored)

Outputs

PinTypeDescription
ALUOp0bitALU operation select, bit 0
ALUOp1bitALU operation select, bit 1
MemWrbitMemory write enable (1 = write to RAM)
JumpUncondbitUnconditional jump to PC.Load
JumpCondbitConditional jump (if Zero flag = 1)
RegLoadbitLoad accumulator register
IXLoadbitLoad index register (extended I/O addressing)
IXIncbitIncrement index register
UseIXbitUse index register as memory address source

How It Works

The Decoder is a combinational circuit that converts a 4-bit opcode into a set of 9 control signals. These signals orchestrate all CPU operations: ALU function selection, memory access, register control, and program flow.

Opcode → Control Signals table:

OpcodeMnemonicALUOp[1:0]MemWrJumpUncondJumpCondRegLoadIXLoadIXIncUseIX
0NOP0000000
1ADD000001000
2SUB010001000
3AND100001000
4OR110001000
5LDA0001000
6STA1000000
7JMP0100000
8JZ0010000
9LDX0000100
10LDAX0001001
11STAX1000001
12JN0010000
13INX0000010
15HLT0000000

Key behaviors:

See the Assembler Manual for the full instruction set reference.

Usage

The Decoder is essential for CPU operation:

In a complete CPU:

Without the Decoder, instructions have no effect — the CPU cannot interpret opcodes.

Go to the simulator →