Flip-flops are the basic memory units in digital circuits - they can store one bit of data.
• D (Data) - The input value to be stored
• CLK (Clock) - Controls WHEN to capture D
• Q - The output (stored value)
• ¬Q - The inverted output (complement of Q)
Rising-edge triggered flip-flop:
| Clock edge | D at edge | Q after edge |
|---|---|---|
| T1 (↑) | 1 | 1 |
| T2 (↑) | 0 | 0 |
| T3 (↑) | 1 | 1 |
| T4 (↑) | 1 | 1 |
| T5 (↑) | 0 | 0 |
• Q takes the value currently on D
• Q then holds that value until the next clock edge
• Changes to D between clock edges are ignored
Key point: The flip-flop only samples D when the clock edge occurs.
• Registers - Store multiple bits (8 flip-flops = 8-bit register)
• Counters - Count clock pulses
• Memory - Building block of RAM
• State machines - Store current state
• Frequency division - Divide clock speed by 2
• "Q takes the value of D on the active clock edge"
• "Q holds that value between edges"
• "Changes on D between edges do not affect Q"