🔒
Pro Content
Subscribe to access all 69 OCR H446 A Level lessons.
£7.99/month
or £59/year
Subscribe now →
🔒 Pro · Component 1 · 1.4.3 Boolean Algebra
1.4.3e D-type Flip-Flops
OCR H446 · A Level Computer Science · ~15 min read
Notes
Video
Slides
Worksheet
Quiz

Sequential Logic and Memory

The logic gates studied so far are combinational — the output depends only on the current inputs. Sequential logic circuits have outputs that depend on both current inputs AND the circuit's past state (memory). Flip-flops are the fundamental building blocks of sequential logic.

A flip-flop is a bistable circuit — it has two stable states (0 and 1) and can store one bit of information. It retains its state until a clock pulse or input causes it to change.

The D-type Flip-Flop

The D-type flip-flop (Data flip-flop or Delay flip-flop) is the most commonly examined sequential circuit at A Level. It has:

  • D (Data/Input): The data bit to be stored
  • CLK (Clock): Triggers when the flip-flop samples D
  • Q (Output): The stored bit — the flip-flop's current state
  • Q̄ (Complement Output): Always the inverse of Q (not always shown in exam questions)

Behaviour: On the rising edge of the clock signal (0→1 transition), the flip-flop copies the value of D to Q. Between clock edges, Q holds its last value regardless of changes in D.

Characteristic Table (Truth Table)

CLKDQ (next)Description
↑ (rising edge)00Q becomes 0
↑ (rising edge)11Q becomes 1
No edge (0 or 1)XQ (unchanged)Holds previous value

The key equation: Q(next) = D — the output simply follows the input, but only at the clock edge.

Timing Diagram

This timing diagram shows how Q responds to D and CLK (rising-edge triggered):

CLK: _|‾|_|‾|_|‾|_|‾|_
D: __‾‾‾‾___‾‾___
Q: ____‾‾‾‾___‾‾_

Key observations from the timing diagram:

  • Q changes value only on the rising edge of CLK (indicated by ↑)
  • If D=1 at the rising edge → Q becomes 1
  • If D=0 at the rising edge → Q becomes 0
  • Changes in D between clock edges have no effect on Q

Edge Triggering vs Level Triggering

The D-type flip-flop is edge-triggered — it responds only at the moment of a clock edge (rising or falling). This is in contrast to a latch which is level-triggered (responds whenever the enable signal is high). Edge triggering is more precise and eliminates timing hazards.

  • Rising-edge triggered: Q updates at CLK 0→1 transition (most common in exams)
  • Falling-edge triggered: Q updates at CLK 1→0 transition

Applications of D-type Flip-Flops

1. Registers

A single D-type flip-flop stores 1 bit. An 8-bit register is built from 8 D-type flip-flops sharing the same clock, each holding one bit. The CPU's general-purpose registers, accumulator, program counter, and status register are all built from flip-flops.

2. Counters

D-type flip-flops can be connected in series (with Q̄ fed back to D) to form a binary counter. Each flip-flop divides the clock frequency by 2. A chain of n flip-flops forms an n-bit counter (0 to 2ⁿ−1).

3. Shift Registers

Chaining flip-flops so that the Q output of one feeds the D input of the next creates a shift register. Data moves along the chain one position per clock cycle. Used in serial-to-parallel and parallel-to-serial conversion (e.g. USB to internal bus).

4. Memory Elements

Static RAM (SRAM) cells are built from flip-flop circuits. Each bit of cache memory or a CPU register corresponds to one flip-flop.

Synchronous vs Asynchronous Circuits

When all flip-flops in a circuit share the same clock signal, the circuit is synchronous — all state changes occur simultaneously at each clock edge. This is the standard in modern digital design. An asynchronous circuit has no shared clock — components change state as soon as their inputs change, which can cause timing hazards (glitches).

Exam tip: The most commonly examined question is to complete a timing diagram given CLK and D waveforms. Remember: Q only changes at rising clock edges. If D=1 at the rising edge, Q goes to 1. If D=0 at the rising edge, Q goes to 0. Q stays constant between edges.
Exam tip: Know that Q(next) = D at the clock edge. The D-type flip-flop's key property is that D is "delayed" to the output by one clock cycle — this is why it is called the "Delay" flip-flop. This delay is intentional and used in pipeline stages.
⚠ Common Mistakes
  • Thinking Q changes whenever D changes — it only changes at the clock rising edge. Between edges, Q is constant regardless of D.
  • Confusing edge-triggered (D-type flip-flop) with level-triggered (latch). Examiners distinguish between these.
  • Missing that Q̄ is always the complement of Q — if Q=1 then Q̄=0 and vice versa.
  • Not starting with the initial state of Q — if Q=0 initially and D=0 at the first rising edge, Q stays 0 (doesn't "jump" to 1).
✓ Notes completed!
Video coming soon
Click to advance · Arrow keys also work
Click slide or press arrow keys to navigate

Worksheet — 1.4.3e D-type Flip-Flops

8 questions · 22 marks · instantly marked

Q1Name the four terminals/signals of a D-type flip-flop and state what each does.[4 marks]
✓ Mark scheme
D (Data input): the bit to be stored/sampled [1]. CLK (Clock): triggers the sampling of D — on the rising (or falling) edge, D is copied to Q [1]. Q (Output): the stored state — the current bit held by the flip-flop [1]. Q̄ (Complement output): always the inverse of Q; Q̄ = NOT Q [1].
Q2Explain what is meant by "edge-triggered" in the context of a D-type flip-flop.[3 marks]
✓ Mark scheme
Edge-triggered means the flip-flop only samples and updates its output (Q) at a specific edge of the clock signal [1] — either the rising edge (0→1 transition) or falling edge (1→0 transition) [1]. Between clock edges, the output Q remains constant regardless of changes in D [1]. This is in contrast to a level-triggered latch, which responds throughout the entire time the enable is high.
Q3State the characteristic equation of a D-type flip-flop.[1 mark]
✓ Mark scheme
Q(next) = D [1]. At each rising clock edge, the next state of Q becomes whatever D was at that moment. The flip-flop simply copies D to Q on each clock edge — hence it is also called a "Delay" flip-flop (D delayed by one clock cycle).
Q4A D-type flip-flop has Q=0 initially. Given: CLK rising edges at t=1, t=2, t=3, t=4. D values just before each edge: D=1, D=0, D=1, D=1. Trace the value of Q after each rising edge.[4 marks]
✓ Mark scheme
t=1 (D=1): Q becomes 1 [1]. t=2 (D=0): Q becomes 0 [1]. t=3 (D=1): Q becomes 1 [1]. t=4 (D=1): Q stays 1 [1]. Q̄ values (optional): 0, 1, 0, 0. Key rule: Q(next) = D at the rising edge. Each rising edge captures the current D value.
Q5Explain how D-type flip-flops are used to build a CPU register. How many flip-flops are needed for a 32-bit register?[3 marks]
✓ Mark scheme
Each D-type flip-flop stores 1 bit [1]. To build a 32-bit register, 32 D-type flip-flops are connected in parallel [1], all sharing the same clock signal so all 32 bits are loaded simultaneously on each rising clock edge. The D inputs receive the 32-bit value to be stored; the Q outputs provide the stored value to the data bus [1].
Q6What is a shift register and how is it built from D-type flip-flops?[3 marks]
✓ Mark scheme
A shift register is a circuit that stores a sequence of bits and shifts them one position along the chain on each clock cycle [1]. It is built by connecting D-type flip-flops in series: the Q output of one flip-flop connects to the D input of the next [1]. Each clock edge causes all bits to shift along by one position. Used for serial-to-parallel or parallel-to-serial data conversion, e.g. interfacing serial communications (USB, SPI) with parallel internal buses [1].
Q7Distinguish between combinational logic and sequential logic.[2 marks]
✓ Mark scheme
Combinational logic: output depends only on the current inputs — there is no memory/state [1]. Sequential logic: output depends on both current inputs AND the circuit's history (past state). Sequential circuits include memory elements (flip-flops, registers) and are synchronised by a clock signal [1]. Examples: combinational = adder, multiplexer; sequential = counter, register, state machine.
Q8Explain the difference between a synchronous and an asynchronous circuit. State one advantage of synchronous design.[2 marks]
✓ Mark scheme
Synchronous: all flip-flops share a common clock — all state changes occur at the same time (on the clock edge) [1]. Asynchronous: no shared clock — components respond as soon as inputs change, potentially at different times. Advantage of synchronous: predictable, glitch-free operation — timing hazards are avoided since changes are coordinated; easier to design, test and verify [1].
Topic Quiz
1 of 15
You scored
out of 15
🎯

Mini Test — 1.4.3e D-type Flip-Flops

  • 10 questions · 10 marks · 10 minutes
  • 5 MCQ + 5 short answer
Card 1 of 15
Click to reveal
🎉
Complete!
TermDefinition
← 1.4.3d Adders & ALU 1.4.3 Boolean Algebra Next: 2.1.1a Abstraction →