ChipFACTORYFoundations
Apply now
Foundations/STAGE 04
Foundations Track/STAGE 04
30 min discovery journey
SECTION 4

Our circuits can calculate, but can they remember?

The Core Question

“How can a physical circuit of semiconductor switches hold onto a piece of information after the input is gone?”

In Section 3, we assembled adders, multiplexers, and an entire ALU. But all of those circuits share a critical limitation: they are purely combinational. The moment an input wire changes, the previous calculation disappears forever. In this section, we will cross one of the most profound boundaries in computer engineering: discovering how feedback loops, clock pulses, flip-flops, and registers allow circuits to carry information through time.

4.1Combinational vs Sequential Logic

What does “remember” mean for a circuit?

To understand how a circuit remembers, we must first examine why standard logic gates do not. Consider a basic AND gate: does it remember its previous input? The answer is definitively no.

Why are combinational circuits “memoryless pass-through calculators”?

An AND gate or Adder has instantaneous dependency. Its output depends strictly on whatever electrical signals are present at its input terminals right at this exact microsecond. The instant the inputs change, the previous output value is permanently lost.

How can we make an output depend on the past?

By introducing a feedback loop into the circuit design! By taking the output wire from a logic gate and routing it back into one of its own input terminals, we force the circuit to continuously feed its current state back to itself, trapping electricity in a self-reinforcing ring.

Pedagogy: Slides 2, 3 & 4Interactive Discovery

4.1 Combinational Logic vs Memory: The Power of Feedback

Combinational logic circuits are instantaneous pass-through calculators: the moment inputs change, the previous output is lost forever. Introducing a feedback loop allows a circuit to trap electricity and hold state.

1. Combinational Logic (Pass-Through)Zero Memory

An AND gate calculates strictly based on whatever electrical signals exist at its terminals right at this microsecond.

Input A:
Input B:
A=1B=1ANDY=1

The Limitation: As soon as Input A or B drops to 0, Output Y immediately drops to 0. It cannot remember that it was previously 1!

2. Circuit with Feedback (Memory)Traps 1 Bit

By routing the output wire back into the input, the circuit continuously feeds its own state back to itself.

STORAGEELEMENTQ = 0Continuous Feedback Loop (Self-Reinforcing)

Bistable Memory: Once pulsed, the state Q = 0 is sustained forever by the continuous feedback current, even when your pulse input is completely gone!

First Principles: Memory is not a special material. Memory is electricity trapped in a self-reinforcing feedback loop.
4.2Bistable Storage & Latches

Can a circuit remember one bit?

When a circuit successfully feeds its own output back into its input, it begins to exhibit bistable behavior: it locks itself into one of two highly stable physical states (sustained HIGH or sustained LOW).

What is an SR Latch?

An SR Latch is constructed from two cross-coupled NOR or NAND gates. It has two inputs: Set (S) to force the stored bit to 1, and Reset (R) to force the stored bit to 0. When both inputs are LOW (S=0, R=0), the latch enters HOLD MODE, holding its trapped state indefinitely without power dissipation.

What does “Level-Sensitive” and “Transparent” mean?

In a Gated D-Latch, an Enable line controls writing. While Enable is HIGH, the latch is transparent: any changes to Data D flow directly through to output Q. When Enable drops to LOW, the latch closes and locks the value. However, transparency creates a critical window of vulnerability: unwanted noise or glitches on D will corrupt the stored state while Enable is active!

Pedagogy: Slides 5 & 6Interactive Discovery

4.2 Cross-Coupled Latches: Level-Sensitive 1-Bit Storage

Connecting two NOR gates in a cross-coupled feedback loop creates the fundamental SR Latch. Adding an Enable signal creates the Gated D-Latch, which becomes transparent when Enable is HIGH.

Set / Reset / Hold Action
Inputs:
Output Q:Q = 0
Q̄:Q̄ = 1
Cross-Coupled 74HC02 NOR SchematicFeedback Circuit
R (0)NOR 1Q = 0S (0)NOR 2Q̄ = 1
SR Latch Truth TableState Transitions
SRActionQ(next)
00HOLD (Memory)Q(prev)
01RESET (Clear)0
10SET (Write 1)1
11INVALID (Forbidden)Unstable
Notice that when (S=0, R=0), the latch enters HOLD MODE: it preserves its stored state without any power dissipation or active refresh.
Key Takeaway: A latch is level-sensitive. While Enable is HIGH (1), the latch is transparent and vulnerable to capturing input glitches.
4.3Global Synchronization

Why do we need a clock?

As digital circuits scale to millions of gates, asynchronous designs encounter a catastrophic problem: different physical wire lengths and transistor switching delays mean electrical signals arrive at staggered nanoseconds, causing glitches and race conditions.

The Master Drumbeat for the Chip

To coordinate changes and eliminate race conditions, digital systems use a global synchronization signal that acts like a conductor's baton or a master drumbeat: The Clock Signal. A clock is a continuous electrical square wave oscillating regularly between HIGH (1) and LOW (0).

What is a Clock Edge?

Within the square wave, the most critical moments are the instantaneous transitions:
• Rising (Positive) Edge (↑): Transition from LOW (0V) to HIGH (3.3V).
• Falling (Negative) Edge (↓): Transition from HIGH (3.3V) down to LOW (0V).
These sub-nanosecond transition points are used as the exact trigger events for memory elements, guaranteeing that all arithmetic logic has settled cleanly before sampling.

Pedagogy: Slides 7, 8 & 9Interactive Discovery

4.3 The Clock Signal: The Conductor's Baton of Silicon

To coordinate billions of transistors and eliminate race hazards, digital chips rely on a global periodic clock signal. Transition edges (Rising and Falling) define the exact nanosecond when data is sampled.

Clock Line (CLK):CLK = 0 (LOW / 0V)
Continuous Clock Square WaveFrequency: 1.0 Hz (Slow Motion)
HIGH (3.3V)LOW (0V)Time (t) →RISING EDGE (↑)Trigger Event 1RISING EDGE (↑)Trigger Event 2RISING EDGE (↑)Trigger Event 3FALLING (↓)FALLING (↓)FALLING (↓)Clock Period (T = 1000 ms (1.0 s))
The Asynchronous Hazard (Race Conditions)

Across a silicon chip, wires have different lengths and transistors have varying switching speeds. Without synchronization, electrical signals arrive at staggered nanoseconds, causing temporary invalid glitches.

The Synchronous Solution (Guaranteed Settling Window)

The clock period guarantees a generous settling window. Combinational adders and ALUs calculate freely while the clock is running; all memory registers sample the clean, stabilized results only on the rising clock edge!

Clock Formula: Frequency (f) = 1 / Period (T). At 3 GHz, each clock cycle lasts exactly 0.33 nanoseconds (333 picoseconds).
4.4Edge-Triggered Sampling

What is a flip-flop?

The D Flip-Flop is the cornerstone of modern synchronous memory. Unlike a latch, a flip-flop is strictly edge-triggered: it updates its stored bit ONLY during the exact instant of a clock edge transition.

Rising Edge Sampling & Hold State

At the precise nanosecond the clock rises from LOW to HIGH (↑), the data input signal (D) is sampled and firmly locked into output Q. Between clock edges, the flip-flop completely ignores any input changes on wire D. The output Q remains frozen, holding its stored value safely.

Why does Edge-Triggering create robust timing boundaries?

Edge-triggering isolates combinational logic stages from one another. By only allowing data to pass at specific, synchronized nanoseconds, it creates clean timing boundaries. Data moves in lockstep across billions of transistors, completely eliminating the risks of glitches and race conditions that plague level-sensitive latches.

Pedagogy: Slides 10 & 11Interactive Discovery

4.4 The D Flip-Flop: Edge-Triggered Synchronous Storage

The D Flip-Flop updates its stored output Q exclusively at the instantaneous rising edge (↑) of the clock signal. Between clock edges, all data fluctuations on wire D are completely ignored.

Inputs:
CLK: 0
DFF Stored Q = 0
1. Gated D-Latch (Level-Sensitive)Transparent when CLK=1
Current Latch Output:
Q(latch) = 0
🔒 LOCKED (CLK = 0)

While CLK remains HIGH, any changes or glitches on Data D flow directly into Q.

Try changing Data D while CLK is HIGH: the latch output flips instantly.
2. D Flip-Flop (Edge-Triggered)Samples ONLY on (↑)
Synchronous Stored Q:
Q(dff) = 0
ROBUST BOUNDARY

The D Flip-Flop ignores all data changes between clock edges. It only samples D at the exact nanosecond of the rising edge (↑).

Try changing Data D now: notice Q(dff) remains perfectly frozen until you trigger a clock edge!
Synchronized Timing Diagram (Waveform Scope)Live Signal Capture
CLK (Clock Line)Level: 0
D (Data Input)Level: 1
Q(DFF) (Edge-Sampled Memory)Stored: 0
Architecture Principle: Edge-triggering isolates combinational stages, allowing billions of transistors to execute in lockstep without glitches or race conditions.
4.5Parallel Registers & Machine State

Can we remember multiple bits?

Now that we can reliably store one bit using a D flip-flop, how do we scale up to store words, bytes, and numbers?

The Multi-Bit Parallel Register

To store 8 bits of data, we place 8 D flip-flops side-by-side in parallel and connect them to a single shared global clock line. Because they share the exact same clock pulse, all 8 bits are sampled and saved simultaneously in lockstep. This synchronized group is called a Register.

What do registers store in a real CPU?

Registers are the fastest storage in computing:
• Binary Numbers: Storing integer operands (e.g. 00101010₂ = 42₁₀).
• Machine State Tracking: Holding hardware status flags (Zero, Carry, Negative, Overflow) and current state variables for state machine sequencing.

Pedagogy: Slides 12 & 13Interactive Discovery

4.5 Multi-Bit Registers: Parallel Storage for Data & State

Connecting 8 D Flip-Flops in parallel to a shared global clock line creates an 8-bit Register. All bits sample their inputs simultaneously on every clock edge, holding binary numbers and critical machine states.

Load Presets:
Input Data Bus D[7:0]
Dec: 42Hex: 0x2A
8-Bit Parallel Synchronous Register (8 × DFF)Shared Clock: IDLE
DFF7
D=0
Q: 0
DFF6
D=0
Q: 0
DFF5
D=1
Q: 0
DFF4
D=0
Q: 0
DFF3
D=1
Q: 0
DFF2
D=0
Q: 0
DFF1
D=1
Q: 0
DFF0
D=0
Q: 0
Locked Register Output Bus Q[7:0]:
00000000₂
Decimal Value:
0
Hex Word:
0x00
Notice what happens when you modify Input Data Bus D[7:0]: the register output Q[7:0] remains rock-solid and unchanging until the exact moment you pulse the global clock line!
System Architecture: An 8-bit register stores words up to 255. 32-bit and 64-bit CPU registers use the exact same parallel flip-flop topology scaled across the data bus.
Section 4 Architectural Synthesis

The Journey: From Pass-Through Logic to Multi-Bit Registers

1. FEEDBACK
Bistable Ring

Routing output back to input traps electric charge and creates permanent state.

2. LATCHES
SR & Gated D-Latch

Level-sensitive 1-bit memory capturing values while Enable is active.

3. THE CLOCK
Edge Synchronization

Master drumbeat isolating logic stages on instantaneous rising edges (↑).

4. REGISTERS
Multi-Bit Word Store

Parallel flip-flops holding variables, status flags, and machine state.

The Next Conceptual Leap

Now our circuit can calculate and remember...
can it change its behavior over time?

We have built circuits that calculate, and registers that remember. But what happens when the next output of the circuit depends on what it remembered a moment ago?

By combining combinational logic with memory registers, we can build circuits that step through sequences, remember where they are in a process, and execute multi-step algorithms: Finite State Machines (FSMs).

Next Section: Stage 05 — Sequencing & Finite State Machines
Proceed to Stage 05