Flip Flops

concept
The flip flop is our first example of a synchronous device. This means it only changes its value at specific points in time controlled by an input called the "clock".
fact
The clock is a signal that alternates between 0 and 1 at a predefined frequency.
A synchronous device will only check its inputs and change its output either when the clock goes form 0 to 1 (the rising edge) or when it goes from 1 to 0 (the falling edge).
fact
The clock input signal on a device is given a triangle symbol called the "dynamic input indicator"
So for a device that is "triggered" on the rising edge it will check its inputs whenever the clock input signal goes from 0 to 1 and set its outputs to their proper value. Then it does nothing until the clock hits the next rising edge. This operation is similar to the gated latches we saw before which only updated their outputs when their EN input signal was high.
fact
A synchronous device which is triggered on the rising edge is also called "positive edge triggered" and has no bubble on its clock input. A synchronous device which is triggered on the falling edge is also called "negative edge triggered" and DOES have a bubble on its clock input.
The two flip flops we'll look at in this topic are the D Flip Flop and the J-K Flip Flop

D Flip Flop

fact
The symbol for the D Flip Flop is:
fact
The D Flip Flop has two inputs, D and Clock, and two outputs, Q and \(\overline{Q}\). When the flip flop is triggered by the clock Q will be set to D's current value (and \(\overline{Q}\ will be the opposite).
example

Determine the output of the positive edge triggered D Flip Flop given the inputs:

Because the flip flop is positive edge triggered its output will update on the rising edge of the clock. Whenever the clock has a rising edge \(Q\) becomes whatever \(D\) is in that moment. Otherwise \(Q\) remains the same.

J-K Flip Flops

The J-K flip flop is similar to the D flip flop in that it is edge triggered by a clock input signal. However it has two other inputs, the J and K which are similar to the S and R inputs of the S-R latch but also allow the user to set them both to 1 which will "toggle" the output (if Q is 1 it becomes 0 and if Q is 0 it becomes 1).
fact
The symbol for the J-K Flip Flop is:
fact
When the J-K Flip Flop is triggered and J is 1 but K is 0 then Q becomes 1. If J is 0 and K is 1 then Q becomes 0. If both J and K are 1 then Q will toggle (change its value). If both J and K are 0 nothing happens.

Preset and Clear

Most devices that operate on a clock also have some other inputs that work independently of the clock (asynchronously). Commonly you will have a preset input (which sets your output to 1 no matter what the clock is doing) and a clear input (which sets the output to 0 no matter what the clock is doing).
fact
An asynchronous input allows us to change a synchronous device in between edge triggerings. This means we can change the output of a device without waiting for a clock edge.
fact
An asynchronous preset sets the output Q to 1 (and \(\overline{Q}\) to 0). An asynchronous clear sets the output Q to 0 (and \(\overline{Q}\) to 1).
Asynchronous inputs are regularly active low so usually preset and clear will be \(\overline{\text{PRE}}\) and \(\overline{\text{CLR}}\)
practice problems