CS355 Sylabus

# The SR-latch

• Let us consider the following very interesting circuit:

• This circuit is called an SR-latch
• The inputs of the circuit are: S (set) and R (reset)
• The outputs of the circuit are: Q (the one we are interested in) and Q-bar (which will happen to be the inverse of Q)

• Let us study the behavior of this circuit for a moment....

The following figure shows the outputs of the SR-latch for two different sets of input values:

• When S = 1 and R = 0, the outputs Q = 1 and Q-bar = 0
• When S = 0 and R = 1, the outputs Q = 0 and Q-bar = 1

You can find the output values by starting with the input signal that is 1 (do not start with the input signal that is equal to 0, since you don't know what value the other signal is). That signal has been highlighted in red in the figure above.

The fact is: Nor(1, 0) = 0 and Nor(1, 1) = 0 (see: click here), so Nor(1, x) = 0, regardless what value x is.

Use the fact that Nor(1, x) = 0 to determine the output that is 0, and use that value in the other input to compute the second output value. (It's a lot easier to show that in class than writing it down...)

• Now here comes the surprise... Let us try to compute the outputs Q and Q-bar for input S = 0 and R = 0.

• Case 1: starting from S = 1 and R = 0, we change S to 0

The figure on the left shows the signal before we change S from 1 to 0. You can see in the left figure that:

• Q-bar = Nor(1, 1) = 0
• Q = Nor(0, 0) = 1

In the right figure, we can again compute Q and Q-bar (with S = 0):

• Q-bar = Nor(0, 1) = 0
• Q = Nor(0, 0) = 1

Conclusion: S = 0, R = 0 ---> Q = 1, Q-bar = 0

• Case 2: starting from S = 0 and R = 1, we change R to 0

The figure on the left shows the signal before we change R from 1 to 0. You can see in the left figure that:

• Q-bar = Nor(0, 0) = 1
• Q = Nor(1, 1) = 0

In the right figure, we can again compute Q and Q-bar (now with R = 0):

• Q-bar = Nor(0, 0) = 1
• Q = Nor(0, 1) = 0

Conclusion: S = 0, R = 0 ---> Q = 0, Q-bar = 1

• HEY..., wait a minute... didn't you just say that S = 0, R = 0 ---> Q = 1, Q-bar = 0 ???

So for S = 0 and R = 0, is Q = 0 or is Q = 1 ???

Did we make a mistake here ?

No, this is a case where the output of a circuit does not only depends on its inputs, but also on the state:

• When we change from (S=1,R=0) to (S=0,R=0), the circuit was in a state where Q = 1.
• When we change from (S=0,R=1) to (S=0,R=0), the circuit was in a state where Q = 0.
• So the output Q depends on the state that the circuit was in when the input changes to (S=0,R=0)....

You have just seen your first sequential circuit !

• We can draw the following properties for the SR-latch circuit:

• If inputs S = 1 and R = 0, then the output is always 1
• If inputs S = 0 and R = 1, then the output is always 0
• If inputs S = 0 and R = 0, then the output will remember its current value.

Note: we will not bother with the input S = 1 and R = 1, because we will not use that input at all.

• Here is a logic-sim circuit program that let you get a hands on experience with the SR latch: click here

The file contains 2 SR-latches. The top one shows the Q-bar output for completeness and the bottom one shows only the Q output, which is the output that really matters. The file contains some comments on what to do.

• We see see next how the SR-latch can be used to construct memory circuits for computers...