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 MASTER SLAVE D FLIPFLOP
by Isai Damier (Let's connect on twitter @isaidamier )

The interactive Master Slave Data Flip-flop digital logic circuit, with Boolean function and truth table.

Introduction to the Master Slave Design

Because latches are so straightforward in their operations, it may be unclear why we would need master-slave counterparts. For example, during the active period of the clock signal (i.e. Clk = 1) the output Q of the data latch is supposed to simply reflect the input signal D. And while the clock signal is not asserted (i.e. Clk = 0), the output Q is supposed to ignore changes in the input D. This is simple enough.

TRUTH TABLE
Input Output
CLK D Q not-Q
X 0 no change no change
X 1 no change no change
0 0 1
1 1 0

A problem with the latches’ simple design, however, is that latches are too sensitive to input conditions. During a single clock cycle, the state of a latch may experience multiple changes depending on the behavior of the input signal during the period when Clk = 1. While for some applications such sensitivity bears no relevancy or are often beneficial; there are applications where it is necessary that the output of a latch change only once during a single clock cycle. For such systems, the master slave flipflop provides the appropriate depth of defense and reliability.

Ckt 1 below is a packaged version of the Presentation Interactive Circuit above. It is also interactive so play around with it to see that it works exactly as the one above. The first data latch is the master, and it changes state when the clock signal is not asserted (Clk = 0); notice that the master is directly controlled by the input signal D. The second data latch is the slave latch. It changes state only at the rising edge of the clock. When the clock signal is changing from 0 to 1, the output Qs of the slave latch takes the value of the output Qm of the master latch. Because by the time the slave gate is opened the master latch has already captured a signal and is blocked from receiving further inputs, the output Qs can only change state at most once during a single clock cycle.

The interactive Master Slave Data Flip-flop digital logic circuit, with Boolean function and truth table.
Ckt 1: Master Slave D Flipflop – Play around with the circuit

Hence by placing two redundant latches in series, we get a reliable D flipflop. This version of the master slave D flipflop is also known as a positive edge triggered D flipflop because the slave output Qs can only change at the positive edge of the clock.

Analysis and Verification

The analysis of the D Master-Slave Flipflop involves exposing four aspects of the circuit. As with all circuits, we want to know a Boolean function that defines the behavior of the circuit. From the Boolean expression, it will be obvious how many states the circuit can be in. Third, we want to see what input conditions will cause the circuit to move between states. And finally we want to know which states are unstable.

The Boolean Function

Because the D Master-Slave Flipflop is constituted of two D Latches connected in series, getting its Boolean function is as easy as combining two D Latch Boolean expressions. Seeing as the expression for the D Latch is Q = D • C + D • q + C • q, we will distinguish the master latch as Qm and the slave latch as Qs. In addition, we account for the NOT gates by inverting the Clock variable C of the master latch.

Qm = D • C + D • qm + C • qm
Qs = qm • C + qm • qs + C • qs
At this point no further work is necessary concerning the Boolean function. The system of equations is the switching expression; no matrix algebra is necessary for simplification. So we proceed to drawing the state transition table.

As evidenced by the Boolean expression we just derived, the master-slave flipflop has two state variables qm and qs and two input variables C and D. As such, the flipflop has four states and four different input conditions. We show the resulting state transition table below.

Given state
qmqs
Input Condition
CD=00 CD=01 CD=10 CD=11
00
01
10
11

Table 1

To fill the table, we will evaluate the system of equations for Qs. For example, the value of Qs when qmqs = 00 and CD = 00 is


Qm = D • C + D • qm - C•qm = 0 • 0 + 0 • 0 + 0 • 0 = 0 • 1 + 0 + 0 = 0
Qs = qm • C + qm • qs + C • qs = 0 • 0 + 0 • 0 + 1 • 0 = 0

In accordance with our value for Qs when qmqs = 00 and CD = 00, we put 0 in the first cell of the transition table, as we show in Table 2. Actually, we put 00 to reflect that both Qm and Qs are 0.

Given state
qmqs
Input Condition
CD=00 CD=01 CD=10 CD=11
00 00
01
10
11

Table 2


Without showing all the evaluations, we fill the state transition table for you in Table 3. In filling the table, we use the system of equations to solve for Qm and Qs. However, you can use the interactive circuits to fill the table. But if you do decide to use the circuits, you must adhere to the convention of assuming that the clock signal always comes in before the D input signal. Such convention hides the fact that in reality critical race conditions may occur; as in qmqs = 00 & CD = 11, and in qmqs = 01 & CD = 11. In both of these examples, the value of QmQs may end up being 00 or 11 depending on which of the signals C and D came in first. (Test the examples using Ckt 1). The phrase critical race condition means exactly what the examples show: the circuit may end up in two or more different states depending on the order in which the inputs changed.

Given state
qmqs
Input Condition
CD=00 CD=01 CD=10 CD=11
00 00 10 00 00
01 01 11 00 00
10 00 10 11 11
11 01 11 11 11

Table 3

Although the table sufficiently shows how the D Master-Slave Flipflop transitions from state to state, it is necessary to represent the operation of the circuit in a state diagram (for people who don’t like tables, if you will).

Master Slave D Flipflop diagram

Figure 1

Finally, we identify the unstable transitions either from the transition table or the state diagram. From Table 3 the unstable transitions are the cells where QmQs &ne qmqs. From Figure 2, the unstable transitions are the arrows pointing from one ellipse to another; as distinguished from the looping arrows. Table 4 below marks the unstable transitions in green.

Given state
qmqs
Input Condition
CD=00 CD=01 CD=10 CD=11
00 00 10 00 00
01 01 11 00 00
10 00 10 11 11
11 01 11 11 11

Table 4: Unstable Transitions in Green

The Negative Edge Triggered Counterpart

Although the article presented and analyzed the positive edge triggered version of the master-slave D flipflop, below we show you the negative edge triggered counterpart. The only difference between the two circuits is the complementation of the clock signal. Since the circuits are essentially the same, we leave the analysis of the circuit below for the reader.

The interactive Master Slave Data Flip flop digital logic circuit, with Boolean function and truth table.
Ckt 2: Master Slave D Flipflop – Play around with the circuit