14. The D flip-flop¶
The D flip-flop (Data or Delay) is a basic sequential circuit that, like the RS flip-flop, allows one bit of information to be stored. The difference between the D flip-flop and the RS flip-flop lies in the different way they store that bit with their inputs.
The D flip-flop has an input D (data), which can be high (logic 1) or low (logic 0). This data is stored inside the flip-flop when another input called Clock or CLK (Clock) is activated, on the rising edge or change from low level (logical 0) to high level (logical 1).
The D flip-flop is mainly used to store binary data and to synchronize signals.
Truth table¶
The truth table of the D flip flop is the following:
| D | CLK | Q | /Q |
|---|---|---|---|
| 0 | 0 | Q | /Q |
| 1 | 0 | Q | /Q |
| 0 | _↑¯ | 0 | 1 |
| 1 | _↑¯ | 1 | 0 |
| 0 | 1 | Q | /Q |
| 1 | 1 | Q | /Q |
- Rising edge
- State changes of this flip-flop occur only when the CLK input changes from inactive (logic 0) to active (logic 1). They do not occur while the signal remains stable, but exclusively at the moment of the value change from logic 0 to logic 1. This change is called "rising edge" and is represented by the symbol "_↑¯".
When input CLK presents a rising edge, the value of input D is copied inside the flip-flop and reflected at output Q.
Once the CLK input remains high, even if the D input changes, the value of the flip-flop will not change, since a new rising edge has not occurred.
The output /Q will always have the opposite value to the output Q. Since this flip-flop does not have prohibited or indeterminate states, this condition is met at all times.
Exercises¶
- What is a D flip-flop and what is it for?
- How many inputs does a D flip-flop have and what function does each one perform?
- How many outputs does a D flip-flop have and what function does each one fulfill?
- Draw the circuit of a D flip-flop with the name of its inputs and outputs.
- Draw the truth table of a D flip-flop and briefly explain its normal operation.
- Can the D flip-flop have a forbidden or undetermined input? What consequences does this operation have?
- Simulate all states of the D flip-flop with the simulator on this page.