SR Latch

Every circuit you have met so far in this course is combinational: its output depends only on the present inputs. To build memory, a circuit must remember what happened in the past. The simplest circuit that does this is the SR latch, made from two gates whose outputs feed back into each other. It stores exactly one bit, and it is the building block from which flip-flops, registers and memories are made.

Learning objectives

By the end of this lesson you will be able to:

  • Explain how cross-coupled gates store a bit.
  • Use the set, reset and hold conditions of the NOR and NAND SR latch.
  • Identify the forbidden input condition and explain why it is a problem.
  • Write the characteristic equation and excitation table of the SR latch.
  • Describe how a gated SR latch adds an enable input.

What makes a circuit remember

In a combinational circuit, signals flow forward only. In a latch, the output of each gate is connected back to the input of the other. This is called feedback. With the right gates, the feedback holds the circuit in one of two stable states, and it stays there until an input pushes it to the other.

Because the circuit has two stable states, it stores one bit. The output is called Q, and its complement is Q'. Under normal operation Q and Q' are always opposite.

The NOR SR latch

The NOR version uses two cross-coupled NOR gates:

  • Q = (R + Q')'
  • Q' = (S + Q)'

The inputs are S (set) and R (reset). Both are active high.

S R Result Q Q'
0 0 Hold (no change) unchanged unchanged
1 0 Set 1 0
0 1 Reset 0 1
1 1 Forbidden 0 0

With S = R = 0 the latch keeps whatever it stored. Setting S to 1 forces Q to 1. Setting R to 1 forces Q to 0. Both at once is the forbidden case, because it makes Q and Q' equal, which breaks the rule that they are opposites.

Why S = R = 1 is a problem

When S = R = 1, both NOR outputs are forced to 0. That is not a stable memory state, and the real trouble comes when you release the inputs. If S and R both return to 0 at the same moment, both gates see two 0 inputs and try to go to 1 at the same time. Then each gate sees a 1 and tries to go to 0, and so on. With perfectly equal gate delays the outputs would swing back and forth between 11 and 00. In practice one gate is slightly faster, so the latch settles into Set or Reset, but which one is unpredictable. Designers therefore avoid S = R = 1 completely.

Characteristic equation and excitation table

For the allowed inputs (S and R never both 1), the next state Q+ follows

Q+ = S + R'Q

If S = 1, the next state is 1. If R = 1, S is 0 and the next state is 0. If both are 0, the next state equals Q.

The excitation table answers the opposite question: which inputs are needed to move from the present state Q to the next state Q+?

Q Q+ S R
0 0 0 X
0 1 1 0
1 0 0 1
1 1 X 0

An X means don't care. For example, to keep Q at 0 you may leave R at either value as long as S is 0.

Worked example 1: Tracing a NOR latch

The latch starts with Q = 0. The inputs change through the sequence below. Find Q after each step.

Step S R Action Q Q'
1 0 0 Hold 0 1
2 1 0 Set 1 0
3 0 0 Hold 1 0
4 0 1 Reset 0 1
5 0 0 Hold 0 1

Step 3 shows memory: the set pulse is gone, S is 0 again, and Q still holds the 1. Without feedback Q would have fallen back to 0.

Worked example 2: The NAND SR latch

Two cross-coupled NAND gates also make a latch, but the inputs are active low, written S' and R':

  • Q = (S' . Q')'
  • Q' = (R' . Q)'
S' R' Result Q Q'
1 1 Hold unchanged unchanged
0 1 Set 1 0
1 0 Reset 0 1
0 0 Forbidden 1 1

The idle state is both inputs at 1, and you pulse one input low to set or reset. This version is common because NAND gates are widely available, and a switch contact that pulls a line to ground can drive it directly. A classic use is switch debouncing: a mechanical switch bounces, but the latch changes state only once.

Compare the two latches: the NOR latch holds when both inputs are 0 and is forbidden when both are 1, while the NAND latch is exactly the opposite.

Worked example 3: The gated SR latch

A plain SR latch reacts as soon as S or R changes. A gated latch adds an enable input E. Two extra AND gates in front of the NOR latch combine the inputs with E:

  • S_internal = S . E
  • R_internal = R . E
E S R Result
0 X X Hold (inputs ignored)
1 0 0 Hold
1 1 0 Set, Q = 1
1 0 1 Reset, Q = 0
1 1 1 Forbidden

When E = 0 the AND gates force both internal inputs to 0, so the latch holds regardless of S and R. This lets a clock-like signal decide when the latch may change. The forbidden condition is still possible when E = 1, and removing it is the reason the D latch and the flip-flops in the next lessons were invented.

Latch versus flip-flop

A latch is level-sensitive: while its enable is active, the output can change at any moment. A flip-flop is edge-triggered: it samples its input only at a clock edge. Latches are simple and fast, but their transparency makes timing harder to control. You will see how flip-flops solve this in the D Flip-Flop lesson.

Common mistakes

  • Mixing active-high and active-low inputs. The NOR latch uses S and R, and the NAND latch uses S' and R'. Their forbidden and hold states are opposite.
  • Applying S = R = 1 (NOR) or S' = R' = 0 (NAND). Always design so this can never happen.
  • Thinking Q' is an independent output. Q' is only the complement of Q when the inputs are legal.
  • Expecting a latch to be clocked. A basic SR latch has no clock. It responds to its inputs immediately.
  • Forgetting the initial state. At power-up an unclocked latch can start in either state.

Practice problems

Problem 1. A NOR SR latch has Q = 1. The inputs become S = 0 and R = 1. What is Q?

Answer: Q = 0. This is the reset condition.

Problem 2. A NAND SR latch receives S' = 0 and R' = 1. What are Q and Q'?

Answer: Q = 1 and Q' = 0, which is the set condition.

Problem 3. Which input combination is forbidden in a NOR latch, and which in a NAND latch?

Answer: NOR: S = 1 and R = 1. NAND: S' = 0 and R' = 0.

Problem 4. What S and R values change Q from 1 to 0?

Answer: S = 0 and R = 1, from the excitation table.

Frequently asked questions

Why is the SR latch called a latch? Because it latches onto a value and holds it after the input pulse ends, much like a door latch stays closed.

Can an SR latch be built from other gates? Yes. NOR and NAND are the usual choices because they can be cross-coupled directly, but any pair of inverting gates connected in a loop gives the same behaviour.

Where are SR latches used today? Directly, in switch debouncing and in simple control logic. Indirectly, they form the core of flip-flops and static memory cells.

Next lesson: continue with D Flip-Flop to see how a clock edge and a single data input remove the forbidden state.