学べること

  • 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.

仕組み

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.

順を追って試す

上の埋め込み回路で入力を設定し、期待される結果と一致するか確認しましょう。

  1. 1
    D = 1010 LOAD = 1 Clock = rising
    期待値: Q = 1010
    観察ポイント: LOAD high, clock edge → register captures D. Standard write.
  2. 2
    D = varying LOAD = 0 Clock = running
    期待値: Q frozen at last loaded value
    観察ポイント: LOAD low — clock edges arrive but Q doesn't change. The register ignores D until LOAD goes high.
  3. 3
    D = 0011 LOAD = 1 → 0 Clock = rising during transition
    期待値: Depends on LOAD timing
    観察ポイント: 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.
  4. 4
    D = 1111 LOAD = 1 Clock = stopped
    期待値: Q unchanged
    観察ポイント: LOAD high but no clock edge → no capture. Both LOAD and a clock edge are required to load.

使用コンポーネント

実世界での応用

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.

よくある質問

How is LOAD different from gating the clock?
Gating the clock creates clock-domain issues — different parts of the chip see different clocks. LOAD cleanly multiplexes between holding and loading without disrupting the clock signal. Modern designs prefer LOAD over clock gating.
Where does this LOAD signal come from in a CPU?
Decoded from the instruction. The destination-register field (e.g., 5 bits for 32 registers) goes into a 5-to-32 decoder; the active output is the LOAD signal for the chosen register. Only one register's LOAD asserts per cycle.
Can I make multiple registers update on one cycle?
Yes — a SIMD or VLIW CPU writes multiple registers per cycle. The instruction encodes multiple destinations; the decoder asserts multiple LOAD signals simultaneously, one per target register. Each target's data comes from its own functional unit.
What if D and LOAD glitch during clock-high?
Edge-triggered flip-flops only sample at the clock edge; glitches between edges are ignored. So even if LOAD or D wiggles during the high phase, only their values at the next clock edge matter. This is one big reason synchronous design uses flip-flops, not latches.
How is this implemented in CMOS?
Two main approaches: (1) Each flip-flop has a transmission-gate-controlled clock input that gates only when LOAD = 1; (2) A 2-to-1 MUX feeds D, choosing between Q (held) and new data (LOAD = 1). Approach 2 is simpler and more common in modern libraries.

学習を続ける