Computing Library › Digital Logic & Circuits
Digital Logic & Circuits

Register

A register is a group of flip-flops that stores a multi-bit word and updates all its bits together on a clock edge.

What it does

A register holds an n-bit value. It is simply n D flip-flops sharing a common clock, so all bits are captured on the same edge. An n-bit register stores one word of the machine's data width.

Load control

Kronos motion — he 3 cold edge

A plain register loads new data on every clock edge. Adding a load-enable line lets it hold its value across edges: a multiplexer in front of each flip-flop chooses between the current output and new input, so the register updates only when enabled.

Register file

Processors group many registers into a register file with read and write ports. Address lines select which register is read or written, and read ports are often combinational so operands are available immediately for the ALU. The register file is a small, fast, multi-ported memory.

Uses

Registers hold program variables, pipeline-stage data, status flags, and the program counter. They form the fast working storage at the top of the memory hierarchy in a CPU.

In code

python
class Register:
    def __init__(self, width): self.value = 0
    def clock(self, data, load):
        if load: self.value = data