

THE GATED RS NAND LATCH

TRUTH TABLE  

Input  Output  
CLK  S  R  Q  notQ  
0  0  0  Latch  Latch  
0  0  1  Latch  Latch  
0  1  0  Latch  Latch  
0  1  1  Latch  Latch  
1  0  0  Latch  Latch  
1  0  1  0  1  
1  1  0  1  0  
1  1  1  Invalid  Invalid 
The door to our setreset latch is realized with two NAND gates with one of their inputs tied to a controlling signal (Clk). The NAND gates are effective at locking down the circuit because unless both inputs to a NAND gate are asserted, then the output of the NAND gate will not change. Play with the interactive circuit we provide above, and observe that the output of the NAND gates depend not only on the input signals R and S but also on the control signal Clk. Thus when the clock signal is OFF, nothing S or R does can affect the output of the circuit.
The analysis of the Gated SetReset Latch is straightforward. We will first use the circuit diagram to solve for a Boolean function. Then from the Boolean function we will get the state transition table and draw a state diagram. A state transition table is a table that shows how the setreset latch moves from being in one state to being in another state. A state diagram is a picture that uses circles and arrows to show how the circuit moves from state to state.
To solve for the Boolean function, we split the crisscrossed wires from the original circuit diagram into individual inputs and outputs. We keep the outputs as Q and notQ, but we rename the inputs as lowercase q and notq. The signals Q and q are not different from each other. We use distinguishing labels only to make the analysis easy. Figure 1 below shows the new look of the circuit.
In addition, we label the remaining wires going out of the controlling NAND gates X1 and X2 to make the analysis easy for you to follow. See figure 2 below.
At this moment we will proceed to solve for Q in terms of the inputs S, R, and Clk and the given state q. First we will solve for X1, X2, Q, and notQ. Then we will use algebraic substitution to get Q in terms of S,
R, Clk, and q. We have no choice but to solve for Q in terms of q because, as you can see from figure 1, q is one of the inputs to the circuit. We refer to q as the given state of the circuit because it is an input
that we cannot directly control; whereas we can easily control S, R, and Clk by just clicking the switches, the value of q is always given to us by the circuit itself (q is actually what we refer to as the memory of
the circuit). Furthermore, since q and notq are complements, we don't need both of them in our final answer; q will give use all the information we need. You may use pencil and paper to follow along with
us. To keep the notation easy on your eyes, we use C instead of Clk. Also, the symbol for the NAND gate is .
X1 = S C  to get X1 we take the NAND of S and C  
X2 = R C  to get X2 we take the NAND of R and C  
Q = X1 notq  to get Q we take the NAND of X1 and notq  
notQ = T2 q  to get notQ we take the NAND of X2 and q 
Q = X1 notq  
Q = X1 notQ  after substituting for  
Q = X1 (X2 q)  after substituting for  notQ = X2 q  
Q = (S C) (X2 q)  after substituting for  X1 = S C  
Q = (S C) ((R C) q)  after substituting for  X2 = R C 
Presently Q is entirely in terms of the input variables S, R, C and the given state variable q. As such, we are technically done solving for Q. However, we can simplify the expression further to get a minimal cost Boolean function. For your reference, the symbol for the AND gate is the dot • and the symbol for the NOT gate is the superbar ().
Q = (S C) ((R C) q)  
Q = (S • C) • ((R • C) • q)  after rewrite each NAND as ANDNOT  
Q = (S • C) • ((R • C) • q)  after cancelling the double negatives  
Q = (S • C) + ((R + C) • q)  after substituting for the complements  • = +  
Q = (S • C) + (R • q + C • q)  after expanding the q  
Q = S • C + R • q + C • q  after cleaning out the parentheses. 
This time you can celebrate. We are finally done with solving for Q! Our next course of action is to show the state transition table.
To show the state transition table, we simply evaluate Q for all possible combinations of the given state q and the input conditions S, C, R, and then we present the result in a table format. Since this is a Boolean exercise, every variable has two possible values, 0 or 1. In view of that, the Gated SetReset Latch has two given states (q = 0; q = 1) and eight input conditions (CSR = 000; CSR = 001; CSR = 010; CSR = 011; CSR = 100; CSR = 101; CSR = 110; CSR = 111). We will list the given states along the rows of the table and the input conditions along the columns; that way we can clearly show the relationship between the given states and the input conditions, and their combined effect on Q. Table 1 below shows the empty state transition table.
Given state q 


Input Condition CSR 

000  001  010  011  100  101  110  111  
0  
1 
As we mentioned earlier, we will fill the table by evaluating Q = S • C + R • q + C • q for each combination of the given state q and the input condition CSR, and we will place the result in the appropriate cell. For example, when q = 0 and CSR = 000, then Q is
Q  =  S • C + R • q + C • q  
Q  =  0 • 0 + 0 • 0 + 0 • 0  
Q  =  0 • 0 + 1 • 0 + 1 • 0  
Q  =  0 + 0 + 0  
Q  =  0 
Given state q 


Input Condition CSR 

000  001  010  011  100  101  110  111  
0  0  
1 
We fill the rest of the table for you, as shown in Table 3 below. We welcome you to practice your evaluation skills by checking that our valuations are correct.
Given state q 


Input Condition CSR 

000  001  010  011  100  101  110  111  
0  0  0  0  0  0  0  1  1 
1  1  1  1  1  1  0  1  1 
Before we proceed to drawing the state diagram, observe the following patterns in the state transition table. First, whenever C = 0 then Q = q, no matter what S and R happen to be. We expected this result because C is the lock to the door. Remember what we told you at the beginning of this article: "As long as the door is closed, we have certitude that no matter what is happening at the input, the state of our circuit cannot be changed." Because of this observation, we can actually rewrite Table 3 as Table 4 below; replacing the first four columns with CSR = 0xx. The xx means that S and R are irrelevant when C is 0. Many textbooks don't address the analysis of asynchronous feedback sequential circuits (think latches and flipflops). And the ones that do will normally not give you table 3; they will give you table 4.
Given state q 


Input Condition CSR 

0xx  100  101  110  111  
0  0  0  0  1  1 
1  1  1  0  1  1 
At this point we can move on to drawing the state diagram from Table 4. We use table 4 instead of Table 3 because it is less work. Feel free to use table 3 if you want; it makes no difference. We show the state diagram in figure 3 below.
Our final stretch is to mark the unstable state transitions. From the state transition diagram in figure 3 the unstable transitions are easy to spot: they are the arrows that leave one given state to go to another. If you want to use the state transition table (table 4 or table 3), the unstable transitions are the ones where, for a given cell, Q ≠ q. For example, the cell where q = 0 and CSR = 110 shows an unstable transition because Q = 1. In table 4 below the unstable transitions are shown in green.
Given state q 


Input Condition CSR 

0xx  100  101  110  111  
0  0  0  0  1  1 
1  1  1  0  1  1 