[OS Dev] Fundamentals - Registers

Registers

What is a register?

A register is a dedicated hardware component. It is located inside the CPU and typically one word (any processor design's natural unit of data, typically 32 or 64 bits) wide.

They can store things such as:

What should I know about registers on a hardware level?

It is made of many flip-flops (latches). The number of flip-flops is equivalent to the system's word size (e.g. 64 in a 64 bit system). These flip-flops for a register are all written and read in parallel via coordination (not electrical/hardware chaining) through the same shared clock and same write-enable signal.

You should think of them as a CPU's internal state in a single instant in time

How the coordination works

At the active clock edge:

Note: WE is Write Enable

How are they organized?

Registers are in a Register File, which is a hardware structure with:

  1. An array of registers
  2. 1+ write ports
  3. 2+ read ports

The Register File has additional components such as:

In summary, there are 3 layers:

  1. Flip-flop - stores 1 bit
  2. Register - stores 1 word via shared control
  3. Register File - enables indexed, parallel access to many registers