Unit 3 of 4 · BCA Sem 1

Unit 3: Sequential logic circuits

Computer Architecture notes · PTU syllabus (UGCC2502)

4 min read5 topics16 exam questions
On this page
  1. Unit summary
  2. Sequential circuits, latches and flip-flops
  3. R-S flip-flop
  4. J-K flip-flop and the race-around condition
  5. D and T flip-flops
  6. Applications of flip-flops
  7. Key terms
  8. Quick revision
  9. Important questions

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
1

Topic 1

Sequential circuits, latches and flip-flops

ComparisonLatch vs flip-flop
Latch
Flip-flop

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

ProcessBlock diagram of a sequential circuit
  1. 1

    External inputs

  2. 2

    Combinational logic

  3. 3

    Memory elements (flip-flops) store the present state

  4. 4

    Next-state and output

  5. 5

    Feedback of the state to the combinational logic

  6. 6

    Clock controls when the state changes

ClassificationClassification of sequential circuits
Sequential circuits
  • 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

Logic circuitS-R latch using NOR gates (active-high inputs)
SRN1N2QQ′

The cross-coupled outputs feed back to the inputs of the other gate (dashed feedback wires)

SRQ (next)Action
00No changeMemory — holds the previous state
010Reset
101Set
11InvalidBoth outputs forced to 0 — forbidden
Logic circuitS-R latch using NAND gates (active-low inputs)
S′R′N1N2QQ′
S′R′Q (next)Action
11No changeMemory
011Set
100Reset
00InvalidBoth outputs 1 — forbidden
Key termsUses of the SR latch
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).

2

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.

Logic circuitClocked R-S flip-flop
SRCLKG1G2G3G4QQ′
CLKSRQ(t+1)State
0XXQ(t)No change
100Q(t)No change
1010Reset
1101Set
111?Invalid
Key formulasR-S flip-flop
  • 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

Key termsDrawback
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.

3

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.

Logic circuitJ-K flip-flop (block symbol)
JKCLKJ-K FFJKCLKQQ′QQ′
JKQ(t+1)Action
00Q(t)No change
010Reset
101Set
11Q′(t)Toggle
Key formulasJ-K flip-flop
  • 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.

GraphRace-around condition (J = K = 1, clock pulse longer than propagation delay)
TimeOCLKQQ toggles every tp

Q changes again and again while CLK is high — the output at the end of the pulse is unpredictable

ComparisonMethods to remove the race-around condition
How it works
Result

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

Logic circuitMaster-slave J-K flip-flop (master and slave latches, inverted clock for the slave)
JKCLKNCMasterJKCLKQmQm′SlaveQmQm′NCQQ′QQ′

Q and Q′ are also fed back to the master's J and K gates, which is how toggling works without a race

ProcessWorking of the master-slave flip-flop
  1. 1

    Clock = 1: master is enabled and follows J and K

  2. 2

    Slave is disabled, so the output Q does not change

  3. 3

    Clock falls to 0: master is disabled and holds its state

  4. 4

    Slave is enabled and copies the master

  5. 5

    Q changes once, at the falling clock edge

  6. 6

    Race-around is impossible because the output is isolated from the input during the pulse

ComparisonMaster vs slave
Master
Slave

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.

4

Topic 4

D and T flip-flops

D (data) flip-flop

Logic circuitD flip-flop (block symbol)
DCLKD FFDCLKQQ′QQ′
DQ(t+1)Action
00Reset
11Set
Key formulasD flip-flop
  • 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′

GraphEdge-triggered D flip-flop timing (rising-edge triggered)
TimeOCLKDQ

Q copies D only at the rising edge of the clock; changes of D between edges are ignored

Key termsD flip-flop points
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

Logic circuitT flip-flop obtained from a J-K flip-flop (J = K = T)
TCLKJ-K FFTTCLKQQ′QQ′
TQ(t+1)Action
0Q(t)No change
1Q′(t)Toggle
Key formulasT flip-flop
  • 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

ComparisonCharacteristic tables of the four flip-flops
Characteristic equation
Inputs

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

ProcessConverting one flip-flop into another
  1. 1Write the truth table of the required flip-flop with the present state Q
  2. 2Add the next state Q(t+1)
  3. 3Write the excitation inputs of the given flip-flop from its excitation table
  4. 4Simplify the inputs with K-maps
  5. 5Connect the gates before the given flip-flop

Excitation table (Q → Q+)

SRJKDT
0 → 0S = 0, R = XJ = 0, K = XD = 0T = 0
0 → 1S = 1, R = 0J = 1, K = XD = 1T = 1
1 → 0S = 0, R = 1J = X, K = 1D = 0T = 1
1 → 1S = X, R = 0J = X, K = 0D = 1T = 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.

5

Topic 5

Applications of flip-flops

ClassificationApplications of flip-flops
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

Logic circuit4-bit serial-in shift register using D flip-flops
DinCLKD FF 0DinCLKQ0D FF 1Q0CLKQ1D FF 2Q1CLKQ2D FF 3Q2CLKQ3Q0Q1Q2Q3

On each clock pulse every bit moves one place to the right; the serial input enters at the left

ComparisonTypes of shift registers
Input
Output

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.

Logic circuit3-bit asynchronous (ripple) up counter using T flip-flops (T = 1)
CLKVccT FF 0VccCLKQ0Q0′T FF 1VccQ0′Q1Q1′T FF 2VccQ1′Q2Q2′Q0Q1Q2

The output of each flip-flop clocks the next, so the change ripples along the chain

Clock pulseQ2Q1Q0Decimal
00000
10011
20102
30113
41004
51015
61106
71117
GraphCounter as a frequency divider (each stage halves the frequency)
TimeOCLKQ0 (÷2)Q1 (÷4)Q2 (÷8)

Each stage toggles on the falling edge of the previous signal, so Q0, Q1 and Q2 run at ½, ¼ and ⅛ of the clock frequency

ComparisonSynchronous vs asynchronous counters
Asynchronous (ripple) counter
Synchronous counter

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

Key termsOther uses
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

  1. Q1.Differentiate between a latch and a flip-flop.
  2. Q2.What is the invalid state of an S-R flip-flop?
  3. Q3.Write the characteristic equation of a JK flip-flop.
  4. Q4.What is the race-around condition?
  5. Q5.How does a master-slave flip-flop avoid it?
  6. Q6.What does a D flip-flop do?
  7. Q7.Write the characteristic equation of a T flip-flop.
  8. Q8.How can a JK flip-flop be converted into a T flip-flop?
  9. Q9.What are setup time and hold time?
  10. Q10.Name four applications of flip-flops.

Long-answer questions

  1. Q1.Explain the S-R latch using NOR gates with its truth table.
  2. Q2.Explain the clocked R-S flip-flop with circuit, truth table and characteristic equation.
  3. Q3.Explain the J-K flip-flop and the race-around condition with a timing diagram.
  4. Q4.Explain the master-slave J-K flip-flop with its working.
  5. Q5.Explain the D and T flip-flops with truth tables and timing.
  6. 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.

WhatsApp us