Combinational logic functions are available in prefabricated MSI (medium-scale integration) chips; one chip can have more than 100 gates. Here are some digital animals in the MSI zoo.
When SEL is LOW (L), A inputs are passed to the outputs; when SEL is HIGH B inputs are passed. When $\overline{ENABLE}$ ($\overline{E}$) is HIGH (H), the device is disabled and we don’t care about the inputs.
Designator: ‘157: quad 2-input select chip. ‘158: ‘157 with inverted output. ‘257: three-state outputs.'1G157: single-section MUX without EN’.
Two CMOS switches in parallel, one NMOS and one PMOS. Their drains and sources are interconnected and provide the input or output, nY or nZ. And their gates are connected to the ENABLE pin nE (1E to 4E).
When nE is HIGH, either the NMOS or the PMOS is enabled and take the I to O.
When nE is LOW, both are disabled and the switch is open and no current flows.
In order to make an 8-input MUX, take transmission gates and replace the ENABLE option with a 3-input SELECT. The eight inputs can selected with 3 bits.
Typical sequential tasks: converting bits from serial to parallel, counting the number of 1s, recognizing pattern, controlling the state of a system with time. The output depends on both the present and past input states. Cannot be created from gates alone; some sort of memory (flip-flop) is needed.
This is the most basic flip-flop, simply called latch.
Let us see how this works:
A | B | X | Y | Comments |
---|---|---|---|---|
0 | 0 | 1 | 1 | Invalid condition |
0 | 1 | 1 | 0 | Latch SET |
1 | 0 | 0 | 1 | Latch RESET |
1 | 1 | NC | NC | No change |
S-R Latch SN74LS279ADR can be used as a switch debouncer.
S | R | $Q_{n+1}$ |
---|---|---|
0 | 0 | $Q_n$ |
0 | 1 | 0 |
1 | 0 | 1 |
1 | 1 | indeterminate |
Here $Q_{n+1}$ is the output after the clock pulse and $Q_n$ that before the pulse.
By far the most popular kind of flip-flops.
When D is 1, Q is 1 and vice versa.
While CLK is HIGH, gates 1 and 2 are enabled, forcing master to have same output as D; the slave is disabled so it retains its previous state.
When the CLK goes LOW, inputs to the master are disconnected and the slave gets its inputs from the outputs of the master. This is negative edge triggered.
A positive edge triggered J-K flip-flop.
J | K | $Q_{n+1}$ |
---|---|---|
0 | 0 | $Q_n$ |
0 | 1 | 0 |
1 | 0 | 1 |
1 | 1 | $Q'_n$ |
If J and K are complements, Q will get J input at the next clock edge.
Parallel data storage
Frequency divider
Counter
The classic sequential state machine. A set of clocked flip-flops and combinational logic.
An example of a 3-state machine. First define the three states of the Q outputs.
$Q_1$ | $Q_2$ |
---|---|
0 | 0 |
0 | 1 |
1 | 0 |
Figure out what the D inputs have to be for these outputs.
$Q_1$ | $Q_2$ | $D_1$ | $D_2$ |
---|---|---|---|
0 | 0 | 0 | 1 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 0 |
Now figure out the combinational logic needed. Here $D_1=Q_2$ and $D_2=(Q_1+Q_2)'$. So we need a NOR gate.
But what happens if somehow you get $(Q_,Q_2)=(1,1)$? The divider will be stuck. So these invalid states have to be excluded. We can use state diagrams for this purpose.
A 3-bit ripple counter / divide by $2^n$:
And its timing diagram:
A 3-bit synchronous binary counter:
And the timing diagram:
Serial in Serial Out:
Serial in Parallel out:
Parallel in Serial out:
Parallel in Parallel out: