Register Load Control Demo
Register with load control and multiplexed input selection. Learn conditional data loading and register control signals.
Lo que aprenderás
- Add load-enable to a register to control when data is captured.
- Recognize that LOAD = 0 means hold; LOAD = 1 means capture on next clock.
- Implement load-enable via flip-flop EN input or MUX-feedback.
- Apply load control to register files, pipeline stalls, and configuration registers.
- Understand why every CPU register file needs per-register load control.
Cómo funciona
A register with load control adds a load-enable input to the basic 4-bit register. When LOAD = 1 and a clock edge arrives, the register captures D into Q. When LOAD = 0, the register holds its current value regardless of clock activity.
Internally, this is implemented in one of two ways: 1. Flip-flop with enable input. Each DFF has a built-in enable that gates the clock edge. 2. MUX-feedback. A 2-to-1 MUX feeds the flip-flop's D, choosing between the new data (LOAD=1) and the flip-flop's own Q (LOAD=0).
Load control is essential for register files: only the register being written should be updated each cycle. Register-file write logic asserts LOAD on exactly one register's enable based on the destination-register address.
This is the standard pattern in CPU writeback — instructions write a result to a destination register's enable while all other registers hold their values.
Pruébalo paso a paso
Configura las entradas en la simulación de arriba, lee qué debería suceder y verifícalo.
- 1D = 1010 LOAD = 1 Clock = risingEsperado:
Q = 1010Lo que verás: LOAD high, clock edge → register captures D. Standard write. - 2LOAD = 0 Clock = runningEsperado:
Q frozen at last loaded valueLo que verás: LOAD low — clock edges arrive but Q doesn't change. The register ignores D until LOAD goes high. - 3D = 0011 LOAD = 1 → 0 Clock = rising during transitionEsperado:
Depends on LOAD timingLo que verás: If LOAD is high at the clock edge, register captures D. If LOAD goes low before the edge, register holds. LOAD's value at the edge moment matters. - 4D = 1111 LOAD = 1 Clock = stoppedEsperado:
Q unchangedLo que verás: LOAD high but no clock edge → no capture. Both LOAD and a clock edge are required to load.
Componentes utilizados
Aplicaciones en el mundo real
Register file write. A CPU's register file decodes the destination-register field of the instruction into one-hot LOAD signals; only one register's LOAD asserts each cycle.
Conditional register update. Architectures with predicated execution use the predicate flag as LOAD — "only write if condition was true."
Pipeline stall logic. When a stage stalls, downstream registers' LOAD inputs go low, freezing their values until the stall clears.
Configuration writes. Memory-mapped configuration registers update only when the bus-write strobe to that address asserts — that strobe is the LOAD signal.
FIFO entry write. Each FIFO slot has its own LOAD; the head pointer's decoded one-hot output asserts the active slot.