AddrDecoder (Address Decoder)

Inputs

PinTypeDescription
Addrbus8Memory address (0–255) from the operand or index register

Outputs

PinTypeDescription
RAM_SELbit1 = address is in RAM range, enable RAM read/write
RAM_SEL8bus80xFF when RAM is selected, 0x00 when I/O is selected — for BusAND gating
IO_SELbit1 = address is in I/O range, enable peripheral access
DevAddrbus8Device address within I/O range — Addr & 0x1F (0–31)

How It Works

The AddrDecoder implements memory-mapped I/O by splitting the 256-address space into two regions:

Address RangeSizeRegionRAM_SELIO_SELDevAddr
0x00–0xDF (0–223)224 bytesRAM10
0xE0–0xFF (224–255)32 bytesI/O01Addr & 0x1F

The key innovation is the RAM_SEL8 output. This 8-bit signal is used with a BusAND gate to gate the RAM data output:

This gating mechanism is essential because RAM and I/O peripherals share the same data bus. Without RAM_SEL8, both RAM and a peripheral could drive the bus simultaneously, causing a conflict.

In the I/O region, DevAddr = Addr & 0x1F extracts the lower 5 bits, yielding a device number from 0 to 31. Each peripheral compares its address against DevAddr and responds when it matches and IO_SEL = 1.

Usage

The AddrDecoder is the foundation of the I/O subsystem:

In a complete CPU with I/O:

Go to the simulator →