

THE GATED D LATCH NAND BASE

TRUTH TABLE  

Input  Output  
CLK  D  Q  notQ  
0  0  Latch  Latch  
0  1  Latch  latch  
1  0  0  1  
1  1  1  0 
We will analyze this Gated Data Latch for four properties: its switching function; the number of states it can be in; how it transitions from state to state; its stable transitions.
To obtain a switching (or Boolean) function for our interactive Gated Data Latch above, we simply analyze the circuit. A simple analysis method is to begin by labeling the inputs and the outputs of every NAND gate in the circuit. We accomplish this by labeling every wire in the circuit. Figure 1 below shows the circuit with every wire labeled.
Before we proceed, you need to be aware of two details: First, during the analysis we do not ever treat Q and notQ as complements (two signals are complementary if it is 100% guaranteed that their value will always be opposite of each other; we can't assure that). Second, since the output Q also feeds back into the circuit, we will relabel the feedback signal q and then solve for Q in terms of q. q as an input is referred to as the given condition or the given state of the circuit. Figure 2 below should help clarify these two provisions.
Now that we have labeled every wire in the circuit, we will algebraically solve for the output Q in terms of the inputs D and CLK and the given state q. To make the algebra easy on the eye we will use C instead of CLK and we will use for NAND. We attach a number to each NAND gate just to help you follow along; you do not need to number the gates in your own analysis.
Q = A notQ  NAND # 1  
notQ = q B  NAND # 2  
A = D C  NAND # 3  
B = A C  NAND # 4 
Q = A notQ  
Q = A (q B)  after substituting for  notQ = q B  
Q = A (q (A C))  after substituting for  B = A C  
Q = (D C) (q ((D C) C))  after substituting for  A = D C 
At this point we have Q in terms of D, C, and q; hence we could stop here. However, we will simplify the expression to get a more cost effective switching function. We will use the superbar () for NOT and the dot • for AND.
Q = (D • C) • (q • ((D • C) • C))  after rewriting each NAND as ANDNOT  
Q = (D • C) • (q • ((D • C) • C ))  after cancelling the double negatives  
Q = (D • C) + (q • ((D • C) + C))  after substituting for the complements  • = +  
Q = D • C + q • (D • C + C )  after cleaning out some parentheses.  
Q = D • C + q • D • C + q • C  after expanding  q  
Q = D • C • (1 + q) + q • C  after factoring out  D • C  
Q = D • C + q • C  after substituting  (1 + q) = 1 
From the switching function Q = D • C + q • C we see that the output Q depends on the state variable q and the two input variables D and C. We call q a state variable because it is an input variable that is not under our direct control. We may directly change the value of D or C by just clicking on a switch, but we cannot directly change the value of q by clicking on a switch.
Since in Boolean algebra each variable can have two possible values, 0 or 1, the circuit has two possible states (q = 0; q = 1) and four possible input conditions (CD = 00; CD = 01; CD = 10; CD = 11). And since the final state Q is a function of the inputs and of the initial state variable, we can create a table showing how Q changes based on the values of D, C and q. Such a table, Table 1, is shown below. We call the table a state transition table because it shows the final state Q as a function of the input conditions D and C and the initial state q.
Given state q 


Input Condition  
CD=00  CD=01  CD=10  CD=11  
0  
1 
To fill the table we simple evaluate Q at the indicated values for CD and q. For example, at C = 1, D = 0, q = 1:
Q = D • C + q • C  = 0 • 1 + 1 • 1 = 0 + 0 = 0. 
Given state q 


Input Condition  
CD=00  CD=01  CD=10  CD=11  
0  
1  0 
We complete the evaluation of Q and fill the state transition table as shown in Table 3. Feel free to check that our work is correct.
Given state q 


Input Condition  
CD=00  CD=01  CD=10  CD=11  
0  0  0  0  1 
1  1  1  0  1 
Now that we have a complete state transition table, we can use the information to create a state transition diagram. A state transition diagram is a picture showing how the circuit moves from state to state. Figure 3 below shows our state transition diagram.
At this point all that's left is to identify the stable and unstable transitions. In the state transition diagram, the arrows that point from one oval to another oval represent unstable transitions; the arrows that loop back represent stable states. In the table the unstable transitions are the cells where Q ≠ q. Table 4 below shows the unstable transitions in green.
Given state q 


Input Condition  
CD=00  CD=01  CD=10  CD=11  
0  0  0  0  1 
1  1  1  0  1 