Memory and clock ticks
An ordinary gate depends on its inputs right now. Memory retains a previous value. Understanding a memory circuit requires its current state as well as its inputs.
Theory
What a tick does
A tick is a moment when a new state is stored. A digital circuit often stores it when its clock signal changes from 0 to 1. Here, Tick performs exactly one such update. You can change inputs between ticks: the stored value Q does not change.
All bits update together: first compute the next state from the old one, then store the whole result. After the tick is a preview, not an update that has already happened.
A truth table lists input combinations. This is a different table: a history. Each row records one completed tick. The next row starts from the previous row’s result.
D flip-flop: remember one bit
D is the bit we want to store. Q is the bit already stored. A D flip-flop copies D into Q only on a tick, then holds Q. This is memory, not an ordinary wire.
Set D = 1 and tick. Then turn D off without ticking: Q stays 1. The next tick stores 0.
After a tick, Q = D.
D = 1
Inputs can change between ticks. Memory holds the value most recently stored, not the input most recently selected.
Register: store two bits together
Two D flip-flops sharing a clock make a two-bit register. D1 is the high bit; D0 is the low bit. Load enables both bits to be written. R is a synchronous reset: it stores 00 on the next tick even when Load is off.
Choose D1 D0 = 10. Turn Load off and tick: memory is held. Turn Load on and tick again. Both bits update together.
R: store 00; otherwise Load: store D1 D0; otherwise hold Q.
D1 D0 = 01 · Load = 1 · R = 0
Load = 0 holds the old number; Load = 1 stores the data. Reset R = 1 takes priority, but still waits for a tick.
Toggle bit: every other tick
Feeding NOT Q into D makes memory invert its bit on every enabled tick: 0 → 1 → 0. Two states alternate. Two input ticks make one full cycle of Q.
Tick four times and inspect the history. Then turn E off and tick again: alternation stops. R returns to 0 on a tick.
R: 0; otherwise E: invert Q; otherwise hold Q.
E = 1 · R = 0
This divides frequency by two: Q’s period is twice the clock’s period. We step manually here; the time between clicks does not matter.
Counter: 00 → 01 → 10 → 11
A counter is a register whose circuit computes the next number. Two bits represent 0, 1, 2 and 3; after 3 comes 0 again. The high bit has weight 2 and the low bit has weight 1.
Complete the cycle in four ticks. Try E = 0, then R = 1: holding and resetting are different actions, both applied on a tick.
R: 00; otherwise E: Q + 1, wrapping through 0–3; otherwise hold Q.
E = 1 · R = 0
A counter counts events, not seconds. It becomes a clock only when ticks arrive at known time intervals.
State machine: three traffic-light states
A finite state machine stores one of a fixed set of states and changes it by a rule. This simplified light cycles red → green → yellow → red. It is a teaching sequence without real timers or sensors.
Complete the cycle. Turn E off to hold a colour. Turn R on and tick: the machine returns to red from any state.
R: red; otherwise E: red → green → yellow → red; otherwise hold the colour.
E = 1 · R = 0
These are not just lamps: memory determines what happens next. The colours use codes 00, 01 and 10; this teaching machine does not need code 11.
Practice
Operate the memory
Choose a device. Change inputs and tick one step at a time. Try predicting the result first; the preview on the right lets you check before storing it.
After a tick, Q = D.
D = 1