Clock-triggered Flip-flop

Mar. 31, 2023, edited on Apr. 2, 2023

Clock-Triggered RS Flip-flop

We have discussed the basic RS flip-flop that can remember one bit of information. If we add two NAND gates to it, then we control the on/off state of flip-flop:

Now we have a clock-triggered flip-flop. Here, the $CLK$ is an on/off signal:

We can obtain $Q^{next}$ from basic RS flip-flop when $CLK$ is in the high-level:

$$ \begin{aligned} Q^{next} &= \overline{S_D} + R_D Q^n \\ &= S + \overline{R} Q^n & (S_D=\overline{S}, R_D=\overline{R}) \end{aligned} $$

And its constraint cases:

$$ \begin{aligned} R_D + S_D &= 1 \\ \overline{R} + \overline{S} &= 1 \\ \overline{\overline{R} + \overline{S}} &= \overline{1} \\ RS &= 0 \end{aligned} $$

Thus, we can obtain the state equation of the clock-triggered RS flip-flop:

$$ \begin{cases} Q^{next} = S + \overline{R}Q^n \\ RS = 0 & (Constraint) \end{cases} $$

Then we can write the state transition table from its state equation:

$S$$R$$Q^{next}$Comment
00$Q$Retain
010Reset
101Preset
11$\times$Invalid

Here are the explanations for input signals:

The clock-triggered RS flip-flop can control its on/off state by the $CLK$ signal, but it still requires attention to make the inputs satisfy $RS = 0$.

After adding some extra logical gates on the RS flip-flop, we can satisfy this constraint by default, that is the following flip-flops we will discuss: D flip-flop, T flip-flop and JK-flip-flop.

D Flip-flop

A D flip-flop is constructed by adding a NOT gate to an RS flip-flop and connecting $S$ and $R$ to the input $D$:

We can obtain the inputs of the RS flip-flop as follows: $ \begin{cases} S = D \\ R = \overline{D} \end{cases} $, From this, we know that the D flip-flop satisfies the constraint $RS=\overline{D}D = 0$, We can obtain the state equation of the D flip-flop from the RS flip-flop:

$$ \begin{aligned} Q^{next} &= S + \overline{R}Q^n \\ &= D + \overline{\overline{D}}Q^n \\ &= D \end{aligned} $$

Thus, the state equation of the D flip-flop is $Q^{next} = D$, and its state transition table is:

$D$$Q^{next}$
00
11

The next state of the D flip-flop only depends on its inputs $D$. When the flip-flop is triggered by an edge, it Delays the input $D$ by one clock cycle.

T Flip Flop

A T Flip flop adds two AND gates to an RS flip-flop but is controlled by a single signal $T$, it can used to Toggle the output:

The inputs for the RS flip-flop are now controlled by the signal $T$ as follows: $ \begin{cases} S = T\overline{Q^n} \\ R = TQ^n \end{cases} $, for the inner RS flip-flop, it still satisfies the constraint $RS= TQ\cdot T\overline{Q} = 0$.

We can obtain the state equation of T flip-flop from the inner RS flip-flop:

$$ \begin{aligned} Q^{next} &= S + \overline{R}Q^n \\ &= T\overline{Q^n} + \overline{TQ^n}Q^n \\ &= T\overline{Q^n} + \overline{T}Q^n + \overline{Q^n}Q^n \\ &= T\overline{Q^n} + \overline{T}Q^n \\ &= T \oplus Q^n \end{aligned} $$

We can then list its state transition table from the state equation :

$T$$Q^{next}$Comment
0$Q$Retain
1$\overline{Q}$Toggle

JK Flip Flop

Similar to the T flip-flop, the JK flip-flop add two AND gates on the RS flip-flop, but this time controlled by two input signals, $J$ and $K$:

We can derive the inputs for the inner RS flip-flop as: $ \begin{cases} S = J\overline{Q^n} \\ R = KQ^n \end{cases} $, and it satisfies the constraint $RS= KQ^n\cdot J\overline{Q^n} = 0$.

Let’s derive the state equation of the JK flip-flop from the inner RS flip-flop:

$$ \begin{aligned} Q^{next} &= S + \overline{R}Q^n \\ &= J\overline{Q^n} + \overline{KQ^n}Q^n \\ &= J\overline{Q^n} + \overline{K}Q^n + \overline{Q^n}Q^n \\ &= J\overline{Q^n} + \overline{K}Q^n \end{aligned} $$

The state transition table is as follows:

$J$$K$$Q^{next}$Comment
00$Q^n$Obtain
010Reset
101Preset
11$\overline{Q^n}$Toggle

We can see that the JK flip-flop has all the functions of the D flip-flop, RS flip-flop, and T flip-flop.

Logical Symbols

These are the common symbols for flip-flops triggered by a clock:

For flip-flops that are triggered by a low-level clock signal, a circle is added to the input $CLK$:

The flip-flop will only update $Q^{next}$ when the clock is effective.

If the flip-flop is triggered at the edge of the clock signal, a triangle is added to the input $CLK$:

The flip-flop will only update $Q^{next}$ at the edge of the $CLK$ signal.

Asynchronous Flip-Flop Signals

The flip-flops discussed so far compute the $Q^{next}$ when the $CLK$ signal is effective. By adding two input signals, we can control $Q^{next}$ without relying on the $CLK$ signal.

The $PRE$ and $CLS$ are asynchronous signals that have higher priority than other inputs and are not controlled by the clock signal. These signal can ignore other inputs to flip-flop and update $Q^{next}$ forcibly.

A Possible implement

We can modify the flip-flop circuit by adding extra gates on the last level of the flip-flop as shown below:

After analyzing the function, we can design a combinational circuit that satisfies the following conditions:

We can use the truth table to derive the boolean expression for the $S_D$ signal from the above discussion:

$PRE$$CLS$$S_{D}^{’}$$S_D$Comment
0000Invalid
0010Invalid
0100Preset
0110Preset
1001Reset
1011Reset
1100Working
1111Working

The boolean expression for $S_D$ is:

$$ \begin{aligned} S_D &= PRE \cdot \overline{CLS} \cdot \overline{S_D^{’}} + PRE \cdot \overline{CLS} \cdot S_D^{’} + PRE \cdot CLS \cdot S_D^{’} \\ &= PRE \cdot \overline{CLS} \cdot \overline{S_D^{’}} + PRE \cdot \overline{CLS} \cdot S_D^{’} + PRE \cdot \overline{CLS} \cdot S_D^{’} + PRE \cdot CLS \cdot S_D^{’} \\ &= (PRE \cdot \overline{CLS} \cdot \overline{S_D^{’}} + PRE \cdot \overline{CLS} \cdot S_D^{’}) + (PRE \cdot \overline{CLS} \cdot S_D^{’} + PRE \cdot CLS \cdot S_D^{’}) \\ &= PRE \cdot \overline{CLS} + PRE \cdot S_D^{’} \end{aligned} $$

Similarly, we can derive the boolean expression for the $R_D$ signal using the truth table below:

$PRE$$CLS$$R_{D}^{’}$$R_D$Comment
0000Invalid
0010Invalid
0101Preset
0111Preset
1000Reset
1010Reset
1100Working
1111Working

The boolean expression for $R_D$ is:

$$ \begin{aligned} R_D &= \overline{PRE} \cdot CLS \cdot \overline{R_D^{’}} + \overline{PRE} \cdot CLS \cdot R_D^{’} + PRE \cdot CLS \cdot R_D^{’} \\ &= \overline{PRE} \cdot CLS \cdot \overline{R_D^{’}} + \overline{PRE} \cdot CLS \cdot R_D^{’} + \overline{PRE} \cdot CLS \cdot R_D^{’} + PRE \cdot CLS \cdot R_D^{’} \\ &= (\overline{PRE} \cdot CLS \cdot \overline{R_D^{’}} + \overline{PRE} \cdot CLS \cdot R_D^{’}) + (\overline{PRE} \cdot CLS \cdot R_D^{’} + PRE \cdot CLS \cdot R_D^{’}) \\ &= \overline{PRE} \cdot CLS + CLS \cdot R^{’}_D \end{aligned} $$