Up to this point, we have focused on storing a single bit. Using an SR Latch or a D Flip-Flop, we can remember a single 1 or 0. While this is the foundation of memory, a single bit cannot do much on its own. It is like having a single letter when you need to write a whole sentence.
To store useful information, like the number 13 (which is 1101 in binary) or the letter 'A', we need to group these bits together. This group of bits is called a Register.
Think of a single D Flip-Flop as a single light switch in your house. It is either ON or OFF. A register is like a control panel with eight switches. By looking at all the switches together, you can represent much more complex information. In this lesson, we will see how to build these "control panels" by grouping flip-flops together.
To build a register, we simply "stack" D Flip-Flops side by side. The number of flip-flops in the group determines the width of the register.
- A 4-bit register uses 4 flip-flops.
- An 8-bit register uses 8 flip-flops.
- A 64-bit register (common in modern computers) uses 64 flip-flops.
In a standard parallel register, each flip-flop handles its own specific piece of data. If you have a 4-bit register, you will have four separate data inputs ( through ) and four separate outputs ( through ).
There are two main ways to get data into a register: Parallel and Serial.
Parallel Loading
In a parallel register, every bit has its own dedicated input wire. When the save command is given, all bits enter their respective flip-flops at the exact same time.
- Analogy: Imagine a four-lane highway where four cars move through a toll booth simultaneously.
- Pros: It is extremely fast.
- Cons: It requires many wires (one for each bit).
Serial Loading In a serial register (often called a Shift Register), there is only one input wire. Data bits enter one by one, moving from one flip-flop to the next on every clock pulse.
- Analogy: Imagine a single-file line of people walking through a narrow door.
- Pros: It saves space because it only needs one wire.
- Cons: It is much slower because you have to wait for every bit to
marchinto place.
The most important part of a register is that all the flip-flops must update at the exact same moment. If they updated at different times, our data would get scrambled.
To ensure they stay synchronized, we connect the Clock pin of every single flip-flop to the same shared signal. However, we don't always want the register to save data on every single clock tick. Sometimes, we want the register to keep its old value even if the inputs change.
To solve this, we use a Load signal. We use an AND gate to combine the Clock and the Load signal.
In the circuit you will build, the output of this AND gate goes to the trigger inputs of all four flip-flops. If Load is 0, the flip-flops never "see" the clock pulse, so they stay frozen. If Load is 1, the clock pulse passes through, and all four bits () are captured and sent to the outputs () at once.
In this lesson, you learned that a Register is simply a team of flip-flops working together to store multiple bits of data.
- N-Bit Registers are created by placing flip-flops in a row.
Parallel Loadingallows us to store an entirewordof data (like 4 or 8 bits) instantly.- Control signals like
ClockandLoadensure that every bit in the register updates at the exact same time.
Next, you will head into the CodeSignal IDE to build a 4-bit parallel register yourself. You will use NAND gates to create the individual memory cells and use an AND gate to control the Load logic. This is a big step — you are moving from simple logic to building the actual components used inside a computer's processor!
