Unit 3: Sequential logic circuits
Computer Architecture notes · PTU syllabus (UGCC2502)
On this page
Unit summary
Sequential circuits remember their past: their output depends on the present inputs and on the stored state. The basic memory elements are latches and flip-flops, and they form registers, counters and memory. This unit covers latches, the R-S, J-K (with the race-around condition and its removal), master-slave J-K, D and T flip-flops, and the applications of flip-flops.
After this unit you can
- Explain how sequential circuits differ from combinational circuits
- Describe SR latches and the R-S flip-flop with truth tables and characteristic equations
- Explain the J-K flip-flop, the race-around condition and the master-slave solution
- Explain D and T flip-flops and convert between them
- Describe applications of flip-flops: registers, shift registers, counters and frequency division
PTU syllabus topics
- Latches
- flip-flops — R-S
- J-K (including race-around condition and its removal)
- Master-Slave J-K
- D flip-flop
- T flip-flop
- applications of flip-flops
Topic 1
Sequential circuits, latches and flip-flops
Triggering
Level — responds while the enable is active
Edge — responds only at the clock edge
Clock
Enable or none
Clock signal
Speed and stability
Can change many times in a pulse
Changes once per clock edge
Use
Simple storage, debouncing
Registers, counters, state machines
- 1
External inputs
- 2
Combinational logic
- 3
Memory elements (flip-flops) store the present state
- 4
Next-state and output
- 5
Feedback of the state to the combinational logic
- 6
Clock controls when the state changes
Synchronous
State changes at clock pulses — flip-flops
Asynchronous
State changes as soon as inputs change — latches
Clocked flip-flops
SR, JK, D, T
Triggering
Level, positive edge, negative edge, pulse
The S-R latch
The cross-coupled outputs feed back to the inputs of the other gate (dashed feedback wires)
| S | R | Q (next) | Action |
|---|---|---|---|
| 0 | 0 | No change | Memory — holds the previous state |
| 0 | 1 | 0 | Reset |
| 1 | 0 | 1 | Set |
| 1 | 1 | Invalid | Both outputs forced to 0 — forbidden |
| S′ | R′ | Q (next) | Action |
|---|---|---|---|
| 1 | 1 | No change | Memory |
| 0 | 1 | 1 | Set |
| 1 | 0 | 0 | Reset |
| 0 | 0 | Invalid | Both outputs 1 — forbidden |
- Switch debouncing
- Removes contact bounce of a mechanical switch
- Alarm memory
- Stays on after a sensor trips
- Building block
- Core of every flip-flop
- Gated SR latch
- Adds an enable (clock) input so changes occur only when enabled
Example
NOR S-R latch: S = 1, R = 0 sets Q to 1. S = 0, R = 1 resets Q to 0. S = 0, R = 0 keeps the previous value, which is the memory. S = 1, R = 1 is not allowed, because both outputs become 0.
Exam tip
A latch changes whenever its inputs change (level-triggered). A flip-flop changes only at the clock edge (edge-triggered).
Topic 2
R-S flip-flop
A clocked R-S flip-flop is an SR latch with two NAND gates in front that pass S and R only when the clock is high.
| CLK | S | R | Q(t+1) | State |
|---|---|---|---|---|
| 0 | X | X | Q(t) | No change |
| 1 | 0 | 0 | Q(t) | No change |
| 1 | 0 | 1 | 0 | Reset |
| 1 | 1 | 0 | 1 | Set |
| 1 | 1 | 1 | ? | Invalid |
Characteristic equation
Q(t+1) = S + R′Q with the condition S·R = 0
Excitation 0 → 0
S = 0, R = X
Excitation 0 → 1
S = 1, R = 0
Excitation 1 → 0
S = 0, R = 1
Excitation 1 → 1
S = X, R = 0
- Invalid state
- S = R = 1 makes both outputs equal and the next state unpredictable
- Remedy
- The J-K flip-flop uses the same idea but turns the forbidden input into toggling
Example
Tracing the output: start with Q = 0. Clock pulse 1 with S = 1, R = 0: Q becomes 1. Pulse 2 with S = 0, R = 0: Q stays 1. Pulse 3 with S = 0, R = 1: Q becomes 0. With the clock low, the inputs have no effect.
Topic 3
J-K flip-flop and the race-around condition
The J-K flip-flop removes the invalid state of the R-S flip-flop: J = K = 1 makes the output toggle.
| J | K | Q(t+1) | Action |
|---|---|---|---|
| 0 | 0 | Q(t) | No change |
| 0 | 1 | 0 | Reset |
| 1 | 0 | 1 | Set |
| 1 | 1 | Q′(t) | Toggle |
Characteristic equation
Q(t+1) = J Q′ + K′ Q
Excitation 0 → 0
J = 0, K = X
Excitation 0 → 1
J = 1, K = X
Excitation 1 → 0
J = X, K = 1
Excitation 1 → 1
J = X, K = 0
Race-around condition
With J = K = 1 and a level-triggered clock that stays high longer than the gate propagation delay, the output keeps toggling during the clock pulse and the final state is uncertain.
Q changes again and again while CLK is high — the output at the end of the pulse is unpredictable
Narrow clock pulse
Make the pulse width shorter than the propagation delay
Hard to control reliably
Edge triggering
Respond only at the rising or falling edge
One change per clock
Master-slave
Two latches working on opposite clock levels
No race — output changes once
Pulse-triggered
Master captures on the leading edge, slave on the trailing
Used in JK ICs
Master-slave J-K flip-flop
Q and Q′ are also fed back to the master's J and K gates, which is how toggling works without a race
- 1
Clock = 1: master is enabled and follows J and K
- 2
Slave is disabled, so the output Q does not change
- 3
Clock falls to 0: master is disabled and holds its state
- 4
Slave is enabled and copies the master
- 5
Q changes once, at the falling clock edge
- 6
Race-around is impossible because the output is isolated from the input during the pulse
Clock
Active when CLK = 1
Active when CLK = 0
Input
J, K and feedback
Outputs of the master
Role
Captures the data
Transfers it to the output
Example
Toggling: with J = K = 1 and Q = 0, successive clock pulses give Q = 1, 0, 1, 0. With J = 1, K = 0, Q is set to 1. With J = 0, K = 1, Q is reset to 0. With J = K = 0, Q does not change.
Exam tip
Race-around happens when J = K = 1 and the clock pulse is wider than the flip-flop's delay. The master–slave J-K flip-flop or edge triggering removes it.
Topic 4
D and T flip-flops
D (data) flip-flop
| D | Q(t+1) | Action |
|---|---|---|
| 0 | 0 | Reset |
| 1 | 1 | Set |
Characteristic equation
Q(t+1) = D
Excitation
D = Q(t+1)
Built from
JK with J = D, K = D′; or SR with S = D, R = D′
Q copies D only at the rising edge of the clock; changes of D between edges are ignored
- Delay element
- Q follows D one clock later
- Setup time
- D must be stable before the clock edge
- Hold time
- D must stay stable just after the edge
- Use
- Registers, shift registers, data synchronisation
- No invalid state
- Only one data input
T (toggle) flip-flop
| T | Q(t+1) | Action |
|---|---|---|
| 0 | Q(t) | No change |
| 1 | Q′(t) | Toggle |
Characteristic equation
Q(t+1) = T ⊕ Q
Excitation
T = Q(t) ⊕ Q(t+1)
Frequency
With T = 1 the output frequency is half the clock frequency
Flip-flop conversions and comparison
SR
Q+ = S + R′Q
S, R (S·R = 0)
JK
Q+ = JQ′ + K′Q
J, K
D
Q+ = D
D
T
Q+ = T ⊕ Q
T
- 1Write the truth table of the required flip-flop with the present state Q
- 2Add the next state Q(t+1)
- 3Write the excitation inputs of the given flip-flop from its excitation table
- 4Simplify the inputs with K-maps
- 5Connect the gates before the given flip-flop
Excitation table (Q → Q+)
| SR | JK | D | T | |
|---|---|---|---|---|
| 0 → 0 | S = 0, R = X | J = 0, K = X | D = 0 | T = 0 |
| 0 → 1 | S = 1, R = 0 | J = 1, K = X | D = 1 | T = 1 |
| 1 → 0 | S = 0, R = 1 | J = X, K = 1 | D = 0 | T = 1 |
| 1 → 1 | S = X, R = 0 | J = X, K = 0 | D = 1 | T = 0 |
Exam tip
Examples of conversion: JK → T: connect J = K = T; JK → D: J = D, K = D′; D → T: D = T ⊕ Q.
Example
D and T in action: a D flip-flop copies its input at the clock edge: D = 1 gives Q = 1, D = 0 gives Q = 0, so it stores one bit. A T flip-flop with T = 1 toggles on every pulse, so its output has half the clock frequency: a 1 kHz clock gives 500 Hz.
Topic 5
Applications of flip-flops
Storage
1-bit memory cell, registers, SRAM
Counters
Binary, decade, up/down
Shift registers
Serial to parallel conversion, delay lines
Frequency division
÷2 per flip-flop
Synchronisation
Cleaning asynchronous signals
Control
State machines and sequence generators
Registers and shift registers
On each clock pulse every bit moves one place to the right; the serial input enters at the left
SISO
Serial
Serial — a delay line
SIPO
Serial
Parallel — serial to parallel converter
PISO
Parallel
Serial — parallel to serial converter
PIPO
Parallel
Parallel — a storage register
Counters
A counter is a register that goes through a prescribed sequence of states on clock pulses.
The output of each flip-flop clocks the next, so the change ripples along the chain
| Clock pulse | Q2 | Q1 | Q0 | Decimal |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 |
| 2 | 0 | 1 | 0 | 2 |
| 3 | 0 | 1 | 1 | 3 |
| 4 | 1 | 0 | 0 | 4 |
| 5 | 1 | 0 | 1 | 5 |
| 6 | 1 | 1 | 0 | 6 |
| 7 | 1 | 1 | 1 | 7 |
Each stage toggles on the falling edge of the previous signal, so Q0, Q1 and Q2 run at ½, ¼ and ⅛ of the clock frequency
Clock
Output of one flip-flop clocks the next
All flip-flops get the same clock
Speed
Slower — delays add up
Faster
Design
Simple
More gates
Glitches
Present
Absent
- Frequency division
- n flip-flops divide the clock by 2ⁿ
- Digital clocks and timers
- Divide 50 Hz or crystal frequency
- Parallel register
- Hold a data word
- Ring and Johnson counters
- Sequence generators
- Memory
- Each flip-flop stores one bit
Example
Counter and shift register: a 3-bit counter uses 3 flip-flops and counts 000 to 111, which is 8 states (mod-8). A decade (mod-10) counter needs 4 flip-flops, because 2³ = 8 is too few. A shift register holding 0101 (5) shifted left once becomes 1010 (10): a left shift multiplies by 2.
Exam tip
n flip-flops give 2ⁿ states. The number of flip-flops for a mod-N counter is the smallest n with 2ⁿ ≥ N.
Key terms
- Sequential circuit
- Circuit whose output depends on present inputs and stored state
- Latch
- Level-triggered 1-bit memory
- Flip-flop
- Edge-triggered 1-bit memory element
- Race-around condition
- Repeated toggling of a level-triggered JK flip-flop when J = K = 1
- Master-slave flip-flop
- Two cascaded latches working on opposite clock levels
- Characteristic equation
- Q(t+1) expressed in terms of the inputs and Q(t)
- Setup and hold time
- Time data must be stable before and after the clock edge
- Counter
- Register that steps through a sequence of states
- Shift register
- Register that moves bits one place per clock pulse
Quick revision
- SR: S = R = 1 is invalid; Q+ = S + R′Q.
- JK: Q+ = JQ′ + K′Q; J = K = 1 toggles; race-around cured by master-slave or edge triggering.
- D: Q+ = D; T: Q+ = T ⊕ Q.
- Master-slave: master active when CLK = 1, slave when CLK = 0.
- Excitation tables help convert one flip-flop to another.
- Applications: registers, shift registers (SISO, SIPO, PISO, PIPO), counters, frequency divider.
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.Differentiate between a latch and a flip-flop.
- Q2.What is the invalid state of an S-R flip-flop?
- Q3.Write the characteristic equation of a JK flip-flop.
- Q4.What is the race-around condition?
- Q5.How does a master-slave flip-flop avoid it?
- Q6.What does a D flip-flop do?
- Q7.Write the characteristic equation of a T flip-flop.
- Q8.How can a JK flip-flop be converted into a T flip-flop?
- Q9.What are setup time and hold time?
- Q10.Name four applications of flip-flops.
Long-answer questions
- Q1.Explain the S-R latch using NOR gates with its truth table.
- Q2.Explain the clocked R-S flip-flop with circuit, truth table and characteristic equation.
- Q3.Explain the J-K flip-flop and the race-around condition with a timing diagram.
- Q4.Explain the master-slave J-K flip-flop with its working.
- Q5.Explain the D and T flip-flops with truth tables and timing.
- Q6.Explain applications of flip-flops with a shift register and a ripple counter.
Stuck on this unit?
Message SBS on WhatsApp for help with Computer Architecture, or to ask about studying BCA at Synetic.
