Digital logic

register

Think of a register as a tiny whiteboard inside the chip — wide enough to hold one number, and the whole row gets rewritten in a single stroke. Where a single flip-flop remembers just one bit, a register lines up N of them side by side so they can hold an N-bit value together: an 8-bit register holds a byte, a 32-bit register holds a typical machine word. It is the chip's short-term memory — the place a value lives between the moment it's computed and the moment something downstream consumes it.

What makes a register more than a loose handful of flip-flops is that they all share one clock. On each active clock edge every bit captures its input at (nominally) the same instant and holds it steady until the next edge, so the whole word updates together — you never see half-old, half-new bits, as long as each input is stable across the flip-flop's setup-and-hold window around that edge. Between edges the inputs can swing around as much as they like through the surrounding combinational logic; only the value present at the edge gets captured. That clean "sample once per tick, then freeze" behaviour is exactly what lets a pipeline pass data forward one stage per cycle without the stages tripping over each other.

In practice you rarely instantiate flip-flops by hand. In RTL you describe a register by assigning to a signal inside a clocked process, and synthesis infers the flip-flops for you. Real registers usually carry a few extras: a reset to force a known starting value (either synchronous, applied on a clock edge, or asynchronous, applied immediately), and often a clock-enable so the register holds its current value on cycles when you don't want it to load — letting the rest of the design stall or skip without disturbing what's stored.

// 8-bit register with synchronous reset and clock-enable
module reg8 (
  input        clk,
  input        rst,   // synchronous, active-high
  input        en,    // clock-enable
  input  [7:0] d,
  output reg [7:0] q
);
  always @(posedge clk)
    if (rst)      q <= 8'd0;   // clear to a known value
    else if (en)  q <= d;      // load d, otherwise hold q
endmodule

An 8-bit register — on each rising clock edge it clears to zero, loads new data, or holds its current value.

Don't confuse this hardware register with the named CPU registers (like a programmer's `R0`–`R31`) or with a memory-mapped "control register" you poke from software — those are architectural concepts built out of registers like this one, not the gate-level row of flip-flops itself.

Also called
registerhardware registerdata registerparallel register寄存器暫存器