Unit 3: Multiplexers, decoders and sequential circuits
Digital Circuits & Logic Design notes · PTU syllabus (BSIT204/BSBC303)
On this page
Unit summary
Multiplexers route data, decoders select outputs, and flip-flops remember. This unit covers multiplexers and demultiplexers, encoders and decoders, latches, R-S, J-K, master–slave J-K, D and T flip-flops, the race condition and its removal, and applications of flip-flops.
After this unit you can
- Explain multiplexers, demultiplexers, encoders and decoders
- Explain latches and flip-flops
- Explain the race-around condition and its removal
- Identify applications of flip-flops
PTU syllabus topics
- Multiplexers and demultiplexers
- encoders and decoders
- latches
- R-S/J-K/Master-Slave J-K/D/T flip-flops
- race condition and its removal
- flip-flop applications
SR
Set, Reset
S = R = 1 is invalid
JK
J, K
J = K = 1 toggles
D
Data
Output follows D on the clock
T
Toggle
T = 1 toggles the output
Topic 1
Multiplexers and demultiplexers
A multiplexer (MUX) is a data selector: it has 2ⁿ data inputs, n select lines and one output. The select lines decide which input reaches the output. A demultiplexer (DEMUX) does the reverse: one input is routed to one of 2ⁿ outputs chosen by the select lines.
Inputs
2ⁿ data inputs
1 data input
Outputs
1
2ⁿ
Job
Many-to-one data selector
One-to-many data distributor
Example
4:1 MUX with 2 select lines
1:4 DEMUX with 2 select lines
- 4:1 MUX output: Y = S₁'S₀'I₀ + S₁'S₀I₁ + S₁S₀'I₂ + S₁S₀I₃
- Implementing a function with a MUX: connect the function's variables to the select lines and tie each data input to 0 or 1 according to the truth table. An n-variable function needs a 2ⁿ:1 MUX (or a 2ⁿ⁻¹:1 MUX with one variable on the data inputs).
Topic 2
Encoders and decoders
- A decoder converts n input lines into up to 2ⁿ output lines, activating exactly one output for each input combination. A 3-to-8 decoder is used for selecting memory chips. Decoders can also implement functions: each output is a minterm.
- An encoder does the opposite: 2ⁿ input lines to n output lines. An 8-to-3 (octal-to-binary) encoder outputs the binary code of the active input.
- A priority encoder gives the code of the highest-priority input when several inputs are active at once.
Topic 3
Latches and flip-flops
Output depends on
Present inputs only
Present inputs and past state
Memory
None
Yes, flip-flops
Clock
Not needed
Usually needed
Examples
Adder, MUX, decoder
Flip-flop, register, counter
A latch is a 1-bit memory element that responds to its inputs whenever it is enabled (level-triggered). A flip-flop is a clocked latch that changes state only at the clock edge (edge-triggered), which makes timing predictable.
Topic 4
R-S flip-flop
The S-R (Set-Reset) flip-flop has inputs S and R and outputs Q and Q'.
| S | R | Q(next) | Action |
|---|---|---|---|
| 0 | 0 | Q | No change |
| 0 | 1 | 0 | Reset |
| 1 | 0 | 1 | Set |
| 1 | 1 | ? | Invalid (forbidden) |
The S = R = 1 condition is not allowed because both outputs try to become equal, breaking the rule that Q and Q' are complements.
Topic 5
J-K flip-flop and the race condition
The J-K flip-flop removes the invalid state of S-R: when J = K = 1 the output toggles (Q becomes Q').
| J | K | Q(next) |
|---|---|---|
| 0 | 0 | Q (no change) |
| 0 | 1 | 0 (reset) |
| 1 | 0 | 1 (set) |
| 1 | 1 | Q' (toggle) |
Characteristic equation: Q(next) = JQ' + K'Q. Race-around condition: in a level-triggered J-K flip-flop with J = K = 1, if the clock pulse stays high longer than the gate delay, the output keeps toggling many times during one pulse, so the final state is unpredictable. Ways to remove it: keep the clock pulse width shorter than the propagation delay, use edge triggering, or use a Master-Slave J-K flip-flop.
Topic 6
Master–slave J-K flip-flop: removing the race
It is two J-K flip-flops in series. The master is enabled when the clock is high; the slave is enabled when the clock is low (through an inverted clock).
- 1Clock goes high
Master reads J and K; slave is locked
- 2Clock goes low
Master is locked; slave copies the master
- 3Output changes once per clock cycle
Race-around is removed
Because the output can change only once per clock cycle, the race-around problem disappears.
Topic 7
D and T flip-flops
- D (Data/Delay) flip-flop: one input D; the output takes the value of D at the clock edge: Q(next) = D. It is made from an S-R or J-K flip-flop with S = D and R = D'. It removes the invalid state and is used in registers.
- T (Toggle) flip-flop: one input T; if T = 0 the output stays the same, if T = 1 it toggles: Q(next) = T ⊕ Q. It is made from a J-K flip-flop with J = K = T and is used in counters.
- S-R
- Q(next) = S + R'Q, with SR = 0
- J-K
- Q(next) = JQ' + K'Q
- D
- Q(next) = D
- T
- Q(next) = T ⊕ Q
Topic 8
Applications of flip-flops
- Registers: a group of flip-flops stores a binary word (an 8-bit register uses 8 flip-flops).
- Shift registers: move data left or right for serial-parallel conversion.
- Counters: count clock pulses (T or J-K flip-flops).
- Frequency division: a T flip-flop divides the clock frequency by 2.
- Memory: static RAM cells are flip-flops.
- Debouncing switches and storing status flags in a CPU.
Key terms
- Multiplexer
- Selects one of many inputs to a single output
- Decoder
- Converts n inputs to one of 2ⁿ outputs
- Flip-flop
- One-bit memory element triggered by a clock
- Race-around condition
- Repeated toggling of a J-K flip-flop during a long clock pulse
- Master–slave
- Two-stage flip-flop removing the race condition
Quick revision
- MUX (2ⁿ inputs, n select lines), DEMUX, encoder, priority encoder, decoder.
- Latch vs flip-flop; level vs edge triggering.
- SR, JK, D, T truth tables and characteristic equations.
- Race-around and master–slave solution.
- Registers, counters, memory, frequency division.
Important exam questions
Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).
Short-answer questions
- Q1.How many select lines does an 8:1 MUX need?
- Q2.Distinguish an encoder and a decoder.
- Q3.Distinguish a latch and a flip-flop.
- Q4.What is the invalid state of an SR flip-flop?
- Q5.What is the race-around condition?
- Q6.State the characteristic equation of a T flip-flop.
Long-answer questions
- Q1.Explain multiplexers and demultiplexers with diagrams.
- Q2.Explain encoders and decoders.
- Q3.Explain SR, JK, D and T flip-flops with truth tables.
- Q4.Explain the race-around condition and the master–slave J-K flip-flop.
Stuck on this unit?
Message SBS on WhatsApp for help with Digital Circuits & Logic Design, or to ask about studying B.Sc IT at Synetic.
