In a digital circuit, a latch is defined as a device that passes data from input to output when the clock is high (low) and holds the output fixed when the clock is low (high). When the latch is passing data, it is said to be transparent. Transparent-high latches and transparent-low latches are typically combined to make edge-triggered registers, which are the fundamental timing elements of most complex digital circuits.
There are several different types of latches; the clocked JK flip-flop is one example that has already been noded. Here I will give two simple examples of latches. The first is the pass transistor latch and the second is the C2MOS (clocked CMOS) latch.
Pass transistor latch
This latch is about as simple as it gets.
CLK
|
|
--------
--------
| | |\
input------| |-------|/°----output
The single NMOS transistor is called a pass transistor. When CLK is high, the input passes to the output (inverted). When CLK is low, the output remains fairly constant. However, the output gradually decays as charge on the inverter leaks away. For this reason, the pass transistor latch is called a dynamic latch. Since as-drawn the latch is being clocked continuously, loss of charge is not a serious problem. However if the clock were turned off to this portion of the circuit to save power (not common in most microprocessors), data would be lost after perhaps 1ms.
If a PMOS transistor were used, the latch would work the same except the latch would be transparent when the clock is low. As you might know (and if you don't, don't worry about it), PMOS transistors pass weak 1s, and NMOS transistors pass weak 0s. For this reason, the two are often put in parallel with eachother, and the resultant latch is called a transmission gate latch.
The inverter has two purposes. Its input gates act as capacitors that store charge (data) when the latch is closed. Also, since it is tied to the power supply, it can pull up or pull down its output nodes. This is critically important if two such latches are combined to make a register.
C2MOS latch
Although it might not be obvious, this latch is quite similar to the transmission gate latch. As just a latch, it's actually a bit inferior to the transmission gate latch. However, it has certain advantages when combined with another latch to make a register.
Vdd
|
_|
input | |
----- o| |
| |_
|
___ _|
CLK | |
------o| |
| |_
|
|--------output
_|
CLK | |
-------| |
| |_
|
_|
input | |
-------| |
| |_
|
|
GND
When the clock is high, the input basically goes through an inverter (with some extra resistance due to the clock transistors). When the clock is low, the output remains fixed since the clock transistors are off. If the CLK and inverse CLK signals are switched, then the new latch becomes transparent when the clock is low.
The C2MOS latch is also dynamic. Static latches require feedback. Flip-flops are used to construct static latches.