Java Circuit Simulation Workaround ▾

Due to recent changes by Oracle, java applets have become difficult to run in the browser. To mitigate the troubles, Oracle has provided the following websites to help users troubleshoot: http://java.com/en/download/help/enable_browser.xml and https://www.java.com/en/download/mac_download.jsp

Even after following the above instructions, loading applets may still show warning concerning “unsigned application” and “unknown publisher”. For Teahlab in particular, these warnings are due to the fact that we have opted not to pay a third party such as Verisign to sign our applets. Any warning that comes up when you try to run our applets should emphasize that our applets will always run with “limited access”, which is Oracle’s way of letting you know that teahlab doesn’t do anything on your computer except running the circuits you see: in other words, our applets are safe to run.

Sincerely,

The Teahlab Team

THE DATA LATCH R/S BASE
by Isai Damier (Let's connect on twitter @isaidamier )

The interactive Data Latch Reset Set Base digital logic circuit, with Boolean function and truth table.

Introduction

Perhaps the simplest memory device in real applications, the Data Latch is really a Clocked Set-Reset Latch with the inputs R and S tied together through an inverter. There are other designs, but essentially they are all the same. One Data Latch can only store one bit of information: a 0 or a 1. Consequently, you will not likely find a Data Latch in a computer. However, you will find the shift register, which is constituted of a group of Data Latches arranged in series. Other applications of the Data Latch abound. For example, most designers — especially students — design omnifarious sequential logic circuits using Data Latches.

TRUTH TABLE
Input Output
C D Q not-Q
1 0 0 1
1 1 1 0
0 X last Q last not-Q

If you played with the interactive Data Latch circuit at the top of this page, then you saw that the value of the input (D) is reflected in the output (Q) when the clock (Clk) is asserted. In other words, when the clock signal is unasserted the output is locked and cannot be changed; however, when the clock signal is HIGH then the output follows the input. (Note: in this article, we use C and Clk interchangeably for the clock input signal).

Boolean Function Derivation

The analysis of the Data Latch is as simple as its operation. First we will solve for the switching (Boolean) function using a nice little technique. Then from the Boolean expression we will write the state transition table and draw the state diagram.

To get the Boolean function, we rename (q) the feedback wire coming from the output Q. We do the same for the feedback wire coming from not-Q, renaming it not-q. See figure 1 below.

Data Latch image

Figure 1

Using the circuit diagram in figure 1, we just solve for the output Q in terms of little q and the inputs D and C. To make things easy for you to see, before we start solving, we also label the output of the inverter X and the intermediate NAND gates T1 and T2, as shown in figure 2 below.

Data Latch image

Figure 2

Now we solve: The symbol for the NAND gate is (nand pic) and the symbol for the NOT gate is the super-bar (an overhead bar).

X = D to get X we take the complement of D
T1 = D nand pic Clk to get T1 we take the NAND of D and Clk
T2 = X nand pic Clk to get T2 we take the NAND of X and Clk
Q = T1 nand pic not-q to get Q we take the NAND of T1 and not-q
not-Q = T2 nand pic q to get Q we take the NAND of T1 and not-q

Now that we have expressed the outputs of the five gates as algebraic equations, our next job is to combine them to solve for Q in terms of q and the inputs D and Clk.

Q = T1 nand pic not-q
Q = T1 nand pic not-Q after substituting for not-q = not-Q (it's the same wire we split!)
Q = T1 nand pic (T2 nand pic q) after substituting for not-Q = T2 nand pic q
Q = (D nand pic Clk) nand pic (T2 nand pic q) after substituting for T1 = D nand pic Clk
Q = (D nand pic Clk) nand pic ((X nand pic Clk) nand pic q) after substituting for T2 = X nand pic Clk
Q = (D nand pic Clk) nand pic ((D nand pic Clk) nand pic q) after substituting for X = D

At this point we are done solving for Q. However, best practice says we should simplify the equation to get a minimal cost expression that defines the circuit; minimal cost means as few gates and as few inputs as possible. If you don't get the simplification process below the first time, don't worry about it. With enough practice you will get there. Here goes:

Q = (D nand pic Clk) nand pic ((D nand pic Clk) nand pic q)
Q = (D • Clk) • (( D • Clk ) • q) after rewrite each NAND as AND-NOT
Q = (D • Clk) ((D • Clk) • q) after cancelling the double negatives
Q = (D • Clk) + ((D + Clk) • q) after substituting for the complements = +
Q = (D • Clk) + ((D + Clk) • q) after cancelling the double negatives
Q = (D • Clk) + (D • q + Clk • q) after expanding the q
Q = D • Clk + D • q + Clk • q after cleaning out the parentheses.

Now we are really done solving for Q. Some textbooks will have the answer as Q = D• Clk+ Clk• q. However, I prefer our answer because our answer expresses a more stable Data Latch circuit. They got their answer using a K-map. Later, at the end of this article, I will show you how they got theirs. But for now let's proceed to the state transition table.


Getting the State Transition Table and the State Diagram

A state transition table shows how the given state and the input condition of a circuit interact to produce the output of the circuit. As such, the table’s rows are labeled by state and the table’s columns are labeled by input condition. From the Boolean expression we just derived, we can see that the circuit is defined by one state variable q and two input variables D and Clk. Consequently, the state transition table will have two states/rows (q = 0 and q = 1) and four input conditions/columns (D Clk = 00, D Clk = 01, D Clk = 10, D Clk = 11). We show the table in table 1 below, using C for Clk.

Given state
q
Input Condition
CD=00 CD=01 CD=10 CD=11
0
1

Table 1

Next, to fill the table, evaluate the equation Q = D • Clk + D • q + Clk • q for Q by substituting the values q, C, and D. For example, to fill the cell where q = 0 intersect CD = 00, we evaluate Q at those values:

Q = D • Clk + D • q + Clk • q
Q = 0 • 0 + 0 • 0 + 0 • 0
Q = 0 • 0 + 0 • 0 + 1 • 0
Q = 0 + 0 + 0
Q = 0

As a result, we place a 0 in the first cell as shown in table 2.
Given state
q
Input Condition
CD=00 CD=01 CD=10 CD=11
0 0
1

Table 2


In table 3, we fill the remaining Q values for you. Feel free to double check our work for practice.

Given state
q
Input Condition
CD=00 CD=01 CD=10 CD=11
0 0 0 0 1
1 1 1 0 1

Table 3

Table 3 is pretty easy to understand. However, we are often required to show an even easier to understand representation of the circuit: a state diagram. We will show you the state diagram first; then we will use our words.

a state diagram image

Figure 3

Each circle in the state diagram represents a state, as the labels indicate, and the curved arrows represent movement between states resulting from the input conditions.

Our final step in the analysis is to indicate which transitions are unstable. There are two ways to tell where a circuit is unstable: there is an easy way, and then there is an easier way. The easy way is to look at the state transition table (table 3) and mark as unstable every cell where Q ≠ q. For example, when q = 0, if CD = 11, then Q = 1. Therefore mark that cell as unstable since Q ≠ q. The easier way is to just look at the state diagram and select as unstable the arrows that show movement from one state to another; the arrows that loop back to the same state are stable.

A Promise Kept

Okay. Earlier I promised to show you how those textbooks get Q = D • Clk + Clk • q. Here it is. Change the state transition table (table 3) into a K-map, by just swapping the column where CD = 10 with the column where CD = 11, and then solve the K-map for a switching function

Given state
q
Input Condition
CD=00 CD=01 CD=10 CD=11
0 0 0 0
1
1
1
1
0
1

Table 4: Karnaugh Map


From the K-map you should get Q = C • D + C • q. So which one is correct? Well, let’s see. We created the Kmap using a state transition table that we got from Q = D • Clk + D • q + Clk • q. Consequently, the two expressions are equivalent.