No more secrets Part F: Circuits to remember
The trick which gives a circuit the ability to store a bit, i.e. to remember its value, is a cycle named latch.
As long as the two inputs are both set to one the latch can stay in one of the two possible stable states:
- if the output of the upper NAND is one, the output of the lower is zero
- vicecersa, if the lower has output one, the upper one gives one.
When one (only one) of the inputs is temporarily reset to zero, the latch is forced to one or the other state (depending upon witch one has been put to zero).
Let us build a simple memory cell. The following circuit is named Data-Clock Flip-FLop (DCFF). It has two inputs, the data to be stored in the memory cell IN, the write command input Ck (or W) and the output.
in -> A w(ck) -> AB A -> BC B -> D out D -> C
This flip flop remember the latest value wrote on it. When w is zero the output is stable, either 1 or 0. The value of the input pin (in) is ignored. When w is one, the output converges to have the same value of the input. This memory cell retains then the value of in when the value of w drops to zero.