CSC 284 · Introduction to Logic Design
Our notes
2 min readSequential circuits
The output depends on the present inputs and on what happened before: the circuit has memory, called its state. A computer is a large state machine: each clock tick moves it from one state to the next.
SR latch
Two cross-coupled NOR gates (or NAND gates).
- S = 1, R = 0: set (Q = 1).
- S = 0, R = 1: reset (Q = 0).
- S = 0, R = 0: hold the last value.
- S = 1, R = 1: not allowed (both outputs forced the same).
A latch is level-sensitive: with a gated latch it follows the inputs while the enable is high.
Clocks and edges
A clock is a square wave that sets the pace. An edge-triggered flip-flop changes only at the rising (or falling) edge, so the whole system changes together and races are avoided.
The four flip-flops
- SR flip-flop: as the latch, but clocked.
- D flip-flop: Q(next) = D. Stores one bit; the basic cell of registers.
- JK flip-flop: like SR but J = K = 1 toggles the output. Q(next) = JQ' + K'Q.
- T flip-flop: T = 1 toggles, T = 0 holds. Q(next) = T ⊕ Q.
Excitation tables
To design a circuit we need the input that causes a given change. For the JK flip-flop:
- 0 → 0: J = 0, K = X.
- 0 → 1: J = 1, K = X.
- 1 → 0: J = X, K = 1.
- 1 → 1: J = X, K = 0.
Worked example
A JK flip-flop starts at Q = 0. On four clock edges the inputs are (J, K) = (1, 0), (0, 0), (1, 1), (1, 1). The outputs are 1 (set), 1 (hold), 0 (toggle), 1 (toggle).
Timing
- Setup time: D must be steady for a short time before the clock edge.
- Hold time: and for a short time after it.
- Breaking these rules can leave the flip-flop metastable (undecided) for a while.
Asynchronous inputs
PRESET and CLEAR force Q to 1 or 0 at once, ignoring the clock: used to start a circuit in a known state.
Analysing a sequential circuit
- Write the flip-flop input equations from the gates.
- Build a state table: present state, inputs, next state, outputs.
- Draw the state diagram (circles for states, arrows for changes).
Exams usually ask
- Draw an SR latch and explain the forbidden state.
- Give characteristic and excitation tables; complete timing diagrams.
Common mistake
Thinking a latch and a flip-flop are the same: the latch follows its inputs while enabled, the flip-flop changes only on the clock edge.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
The S-R Latch | Multivibrators | Electronics Textbook
(opens allaboutcircuits.com in a new tab)
-
The J-K Flip-Flop | Multivibrators | Electronics Textbook
(opens allaboutcircuits.com in a new tab)
-
Flip-flop (electronics)
(opens en.wikipedia.org in a new tab)
Wikipedia, Flip-flop (electronics), CC BY-SA 4.0 · licence
-
MIT OpenCourseWare: 6.004 Computation Structures (Spring 2017)
Whole course: short lecture videos and worksheets on digital logic and computer design.
(opens ocw.mit.edu in a new tab)
MIT OpenCourseWare, MIT OpenCourseWare: 6.004 Computation Structures (Spring 2017), CC BY-NC-SA 4.0 · licence
-
NPTEL: Digital Circuits and Systems (IIT Madras, Prof. Shankar Balachandran)
Video lectures, many hours in all: watch on Wi-Fi where you can.
(opens nptel.ac.in in a new tab)
NPTEL, NPTEL: Digital Circuits and Systems (IIT Madras, Prof. Shankar Balachandran), CC BY-NC-SA 4.0 · licence
Watch
-
Best pick SR Latch | NOR and NAND SR Latch
17 min · ≈ 77 MB · about ₦43
(opens youtube.com in a new tab)
-
Latch and Flip-Flop Explained | Difference between the Latch and Flip-Flop
10 min · ≈ 45 MB · about ₦25
(opens youtube.com in a new tab)
-
How Flip Flops Work - The Learning Circuit
9 min · ≈ 41 MB · about ₦23
(opens youtube.com in a new tab)
-
SR latch
13 min · ≈ 59 MB · about ₦33
(opens youtube.com in a new tab)
-
Lecture 17 - S-R,J-K and D Flip Flops
53 min · ≈ 239 MB · about ₦134
(opens youtube.com in a new tab)
Practise
-
Latch Circuits Worksheet (All About Circuits)
Questions with the answer under each one (tap "Reveal answer").
(opens allaboutcircuits.com in a new tab)
-
Flip-Flop Circuits Worksheet (All About Circuits)
Questions with the answer under each one (tap "Reveal answer").
(opens allaboutcircuits.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.