Hubbry Logo
Flip-flop (electronics)Flip-flop (electronics)Main
Open search
Flip-flop (electronics)
Community hub
Flip-flop (electronics)
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Flip-flop (electronics)
Flip-flop (electronics)
from Wikipedia
A SR latch (R1, R2 = 1 kΩ; R3, R4 = 10 kΩ)

In electronics, flip-flops and latches are circuits that have two stable states that can store state information – a bistable multivibrator. The circuit can be made to change state by signals applied to one or more control inputs and will output its state (often along with its logical complement too). It is the basic storage element in sequential logic. Flip-flops and latches are fundamental building blocks of digital electronics systems used in computers, communications, and many other types of systems.

Flip-flops and latches are used as data storage elements to store a single bit (binary digit) of data; one of its two states represents a "one" and the other represents a "zero". Such data storage can be used for storage of state, and such a circuit is described as sequential logic in electronics. When used in a finite-state machine, the output and next state depend not only on its current input, but also on its current state (and hence, previous inputs). It can also be used for counting of pulses, and for synchronizing variably-timed input signals to some reference timing signal.

The term flip-flop has historically referred generically to both level-triggered (asynchronous, transparent, or opaque) and edge-triggered (synchronous, or clocked) circuits that store a single bit of data using gates.[1][2] Modern authors reserve the term flip-flop exclusively for edge-triggered storage elements and latches for level-triggered ones.[3][4] The terms "edge-triggered", and "level-triggered" may be used to avoid ambiguity.[5]

When a level-triggered latch is enabled it becomes transparent, but an edge-triggered flip-flop's output only changes on a clock edge (either positive going or negative going).

Different types of flip-flops and latches are available as integrated circuits, usually with multiple elements per chip. For example, 74HC75 is a quadruple transparent latch in the 7400 series.

History

[edit]
Schematics from the Eccles and Jordan trigger relay patent filed 1918, one drawn as a cascade of amplifiers with a positive feedback path, and the other as a symmetric cross-coupled pair

The first electronic latch was invented in 1918 by the British physicists William Eccles and F. W. Jordan.[6][7] It was initially called the Eccles–Jordan trigger circuit and consisted of two active elements (vacuum tubes).[8] The design was used in the 1943 British Colossus codebreaking computer[9] and such circuits and their transistorized versions were common in computers even after the introduction of integrated circuits, though latches and flip-flops made from logic gates are also common now.[10][11] Early latches were known variously as trigger circuits or multivibrators.

According to P. L. Lindley, an engineer at the US Jet Propulsion Laboratory, the flip-flop types detailed below (SR, D, T, JK) were first discussed in a 1954 UCLA course on computer design by Montgomery Phister, and then appeared in his book Logical Design of Digital Computers.[12][13] Lindley was at the time working at Hughes Aircraft under Eldred Nelson, who had coined the term JK for a flip-flop which changed states when both inputs were on (a logical "one"). The other names were coined by Phister. They differ slightly from some of the definitions given below. Lindley explains that he heard the story of the JK flip-flop from Eldred Nelson, who is responsible for coining the term while working at Hughes Aircraft. Flip-flops in use at Hughes at the time were all of the type that came to be known as J-K. In designing a logical system, Nelson assigned letters to flip-flop inputs as follows: #1: A & B, #2: C & D, #3: E & F, #4: G & H, #5: J & K. Nelson used the notations "j-input" and "k-input" in a patent application filed in 1953.[14]

Implementation

[edit]
A transparent latch circuit based on bipolar junction transistors

Transparent or asynchronous latches can be built around a single pair of cross-coupled inverting elements: vacuum tubes, bipolar transistors, field-effect transistors, inverters, and inverting logic gates have all been used in practical circuits.

Clocked flip-flops are specially designed for synchronous systems; such devices ignore their inputs except at the transition of a dedicated clock signal (known as clocking, pulsing, or strobing). Clocking causes the flip-flop either to change or to retain its output signal based upon the values of the input signals at the transition. Some flip-flops change output on the rising edge of the clock, others on the falling edge.

Since the elementary amplifying stages are inverting, two stages can be connected in succession (as a cascade) to form the needed non-inverting amplifier. In this configuration, each amplifier may be considered as an active inverting feedback network for the other inverting amplifier. Thus the two stages are connected in a non-inverting loop although the circuit diagram is usually drawn as a symmetric cross-coupled pair (both the drawings are initially introduced in the Eccles–Jordan patent).

Types

[edit]

Flip-flops and latches can be divided into common types: SR ("set-reset"), D ("data"), T ("toggle"), and JK (see History section above). The behavior of a particular type can be described by the characteristic equation that derives the "next" output (Qnext) in terms of the input signal(s) and/or the current output, .

Asynchronous set-reset latches

[edit]

When using static gates as building blocks, the most fundamental latch is the asynchronous Set-Reset (SR) latch.

Its two inputs S and R can set the internal state to 1 using the combination S=1 and R=0, and can reset the internal state to 0 using the combination S=0 and R=1.[note 1]

The SR latch can be constructed from a pair of cross-coupled NOR or NAND logic gates. The stored bit is present on the output marked Q.

It is convenient to think of NAND, NOR, AND and OR as controlled operations, where one input is chosen as the control input set and the other bit as the input to be processed depending on the state of the control. Then, all of these gates have one control value that ignores the input (x) and outputs a constant value, while the other control value lets the input pass (maybe complemented):

Essentially, they can all be used as switches that either set a specific value or let an input value pass.

SR NOR latch

[edit]
An animation of a SR latch, constructed from a pair of cross-coupled NOR gates. Red and black mean logical '1' and '0', respectively.
An animated SR latch. Black and white mean logical '1' and '0', respectively.
  1. S = 1, R = 0: Set
  2. S = 0, R = 0: Hold
  3. S = 0, R = 1: Reset
  4. S = 1, R = 1: Not allowed
Transitioning from the restricted combination (D) to (A) leads to an unstable state.

The SR NOR latch consists of two parallel NOR gates where the output of each NOR is also fanned out into one input of the other NOR, as shown in the figure. We call these output-to-input connections feedback inputs, or simply feedbacks. The remaining inputs we will use as control inputs as explained above. Notice that at this point, because everything is symmetric, it does not matter to which inputs the outputs are connected. We now break the symmetry by choosing which of the remaining control inputs will be our set and reset and we can call "set NOR" the NOR gate with the set control and "reset NOR" the NOR with the reset control; in the figures the set NOR is the bottom one and the reset NOR is the top one. The output of the reset NOR will be our stored bit Q, while we will see that the output of the set NOR stores its complement Q.

To derive the behavior of the SR NOR latch, consider S and R as control inputs and remember that, from the equations above, set and reset NOR with control 1 will fix their outputs to 0, while set and reset NOR with control 0 will act as a NOT gate. With this it is now possible to derive the behavior of the SR latch as simple conditions (instead of, for example, assigning values to each line see how they propagate):

  • While the R and S are both zero, both R NOR and S NOR simply impose the feedback being the complement of the output, this is satisfied as long as the outputs are the complement of each other. Thus the outputs Q and Q are maintained in a constant state, whether Q=0 or Q=1.
  • If S=1 while R=0, then the set NOR will fix Q=0, while the reset NOR will adapt and set Q=1. Once S is set back to zero the values are maintained as explained above.
  • Similarly, if R=1 while S=0, then the reset NOR fixes Q=0 while the set NOR with adapt Q=1. Again the state is maintained if R is set back to 0.
  • If R=S=1, the NORs will fix both outputs to 0, which is not a valid state storing complementary values.
SR latch operation[5]
Characteristic table Excitation table
S R Qnext Action Q Qnext S R
0 0 Q Hold state 0 0 0 X
0 1 0 Reset 0 1 1 0
1 0 1 Set 1 0 0 1
1 1 X Not allowed 1 1 X 0

Note: X means don't care, that is, either 0 or 1 is a valid value.

The R = S = 1 combination is called a restricted combination or a forbidden state because, as both NOR gates then output zeros, it breaks the logical equation Q = not Q. The combination is also inappropriate in circuits where both inputs may go low simultaneously (i.e. a transition from restricted to hold). The output could remain in a metastable state and may eventually lock at either 1 or 0 depending on the propagation time relations between the gates (a race condition).

How an SR NOR latch works

To overcome the restricted combination, one can add gates to the inputs that would convert (S, R) = (1, 1) to one of the non-restricted combinations. That can be:

  • Q = 1 (1, 0) – referred to as an S (dominated)-latch
  • Q = 0 (0, 1) – referred to as an R (dominated)-latch

This is done in nearly every programmable logic controller.

  • Hold state (0, 0) – referred to as an E-latch

Alternatively, the restricted combination can be made to toggle the output. The result is the JK latch.

The characteristic equation for the SR latch is:

or [15]

where A + B means (A or B), AB means (A and B)

Another expression is:

with [16]

SR NAND latch

[edit]
An SR latch constructed from cross-coupled NAND gates

The circuit shown below is a basic NAND latch. The inputs are also generally designated S and R for Set and Reset respectively. Because the NAND inputs must normally be logic 1 to avoid affecting the latching action, the inputs are considered to be inverted in this circuit (or active low).

The circuit uses the same feedback as SR NOR, just replacing NOR gates with NAND gates, to "remember" and retain its logical state even after the controlling input signals have changed. Again, recall that a 1-controlled NAND always outputs 0, while a 0-controlled NAND acts as a NOT gate. When the S and R inputs are both high, feedback maintains the Q outputs to the previous state. When either is zero, they fix their output bits to 0 while to other adapts to the complement. S=R=0 produces the invalid state.

SR latch operation
S R Action
0 0 Q = 1, Q = 1; not allowed
0 1 Q = 1
1 0 Q = 0
1 1 No change; random initial
Symbol for an SR NAND latch

SR AND-OR latch

[edit]
An SR AND-OR latch. Light green means logical '1' and dark green means logical '0'. The latch is currently in hold mode (no change).

From a teaching point of view, SR latches drawn as a pair of cross-coupled components (transistors, gates, tubes, etc.) are often hard to understand for beginners. A didactically easier explanation is to draw the latch as a single feedback loop instead of the cross-coupling. The following is an SR latch built with an AND gate with one inverted input and an OR gate. Note that the inverter is not needed for the latch functionality, but rather to make both inputs High-active.

SR AND-OR latch operation
S R Action
0 0 No change; random initial
1 0 Q = 1
X 1 Q = 0

Note that the SR AND-OR latch has the benefit that S = 1, R = 1 is well defined. In above version of the SR AND-OR latch it gives priority to the R signal over the S signal. If priority of S over R is needed, this can be achieved by connecting output Q to the output of the OR gate instead of the output of the AND gate.

The SR AND-OR latch is easier to understand, because both gates can be explained in isolation, again with the control view of AND and OR from above. When neither S or R is set, then both the OR gate and the AND gate are in "hold mode", i.e., they let the input through, their output is the input from the feedback loop. When input S = 1, then the OR gate outputs 1, regardless of the other input from the feedback loop ("set mode"). When input R = 1 then the AND gate outputs 0, regardless of the other input from the feedback loop ("reset mode"). And since the AND gate takes the output of the OR gate as input, R has priority over S. Latches drawn as cross-coupled gates may look less intuitive, as the behavior of one gate appears to be intertwined with the other gate. The standard NOR or NAND latches could also be re-drawn with the feedback loop, but in their case the feedback loop does not show the same signal value throughout the whole feedback loop. However, the SR AND-OR latch has the drawback that it would need an extra inverter, if an inverted Q output is needed.

Note that the SR AND-OR latch can be transformed into the SR NOR latch using logic transformations: inverting the output of the OR gate and also the 2nd input of the AND gate and connecting the inverted Q output between these two added inverters; with the AND gate with both inputs inverted being equivalent to a NOR gate according to De Morgan's laws.

JK latch

[edit]

The JK latch is much less frequently used than the JK flip-flop. The JK latch follows the following state table:

JK latch truth table
J K Qnext Comment
0 0 Q No change
0 1 0 Reset
1 0 1 Set
1 1 Q Toggle

Hence, the JK latch is an SR latch that is made to toggle its output (oscillate between 0 and 1) when passed the input combination of 11.[17] Unlike the JK flip-flop, the 11 input combination for the JK latch is not very useful because there is no clock that directs toggling.[18]

Gated latches and conditional transparency

[edit]

Latches are designed to be transparent. That is, input signal changes cause immediate changes in output. Additional logic can be added to a transparent latch to make it non-transparent or opaque when another input (an "enable" input) is not asserted. When several transparent latches follow each other, if they are all transparent at the same time, signals will propagate through them all. However, following a transparent-high latch by a transparent-low latch (or vice-versa) causes the state and output to only change on clock edges, forming what is called a master–slave flip-flop.

Gated SR latch

[edit]
NAND Gated SR Latch (Clocked SR flip-flop). Note the inverted inputs.
A gated SR latch circuit diagram constructed from AND gates (on left) and NOR gates (on right)

A gated SR latch can be made by adding a second level of NAND gates to an inverted SR latch. The extra NAND gates further invert the inputs so a SR latch becomes a gated SR latch (a SR latch would transform into a gated SR latch with inverted enable).

Alternatively, a gated SR latch (with non-inverting enable) can be made by adding a second level of AND gates to a SR latch.

With E high (enable true), the signals can pass through the input gates to the encapsulated latch; all signal combinations except for (0, 0) = hold then immediately reproduce on the (Q, Q) output, i.e. the latch is transparent.

With E low (enable false) the latch is closed (opaque) and remains in the state it was left the last time E was high.

A periodic enable input signal may be called a write strobe. When the enable input is a clock signal, the latch is said to be level-sensitive (to the level of the clock signal), as opposed to edge-sensitive like flip-flops below.

Gated SR latch operation
E/C Action
0 No action (hold state)
1 The same as non-gated SR latch
Symbol for a gated SR latch

Gated D latch

[edit]

This latch exploits the fact that, in the two active input combinations (01 and 10) of a gated SR latch, R is the complement of S. The input NAND stage converts the two D input states (0 and 1) to these two input combinations for the next SR latch by inverting the data input signal. The low state of the enable signal produces the inactive "11" combination. Thus a gated D-latch may be considered as a one-input synchronous SR latch. This configuration prevents application of the restricted input combination. It is also known as transparent latch, data latch, or simply gated latch. It has a data input and an enable signal (sometimes named clock, or control). The word transparent comes from the fact that, when the enable input is on, the signal propagates directly through the circuit, from the input D to the output Q. Gated D-latches are also level-sensitive with respect to the level of the clock or enable signal.

Transparent latches are typically used as I/O ports or in asynchronous systems, or in synchronous two-phase systems (synchronous systems that use a two-phase clock), where two latches operating on different clock phases prevent data transparency as in a master–slave flip-flop.

The truth table below shows that when the enable/clock input is 0, the D input has no effect on the output. When E/C is high, the output equals D.

Gated D latch truth table
E/C D Q Q Comment
0 X Qprev Qprev No change
1 0 0 1 Reset
1 1 1 0 Set
Symbol for a gated D latch

Earle latch

[edit]

The classic gated latch designs have some undesirable characteristics.[19] They require dual-rail logic or an inverter. The input-to-output propagation may take up to three gate delays. The input-to-output propagation is not constant – some outputs take two gate delays while others take three.

Designers looked for alternatives.[20] A successful alternative is the Earle latch. It requires only a single data input, and its output takes a constant two gate delays. In addition, the two gate levels of the Earle latch can, in some cases, be merged with the last two gate levels of the circuits driving the latch because many common computational circuits have an OR layer followed by an AND layer as their last two levels. Merging the latch function can implement the latch with no additional gate delays.[19] The merge is commonly exploited in the design of pipelined computers, and, in fact, was originally developed by John G. Earle to be used in the IBM System/360 Model 91 for that purpose.[21]

The Earle latch is hazard free.[22] If the middle NAND gate is omitted, then one gets the polarity hold latch, which is commonly used because it demands less logic.[22][23] However, it is susceptible to logic hazard. Intentionally skewing the clock signal can avoid the hazard.[23]

D flip-flop

[edit]
D flip-flop symbol

The D flip-flop is widely used, and known as a "data" flip-flop. The D flip-flop captures the value of the D-input at a definite portion of the clock cycle (such as the rising edge of the clock). That captured value becomes the Q output. At other times, the output Q does not change.[24][25] The D flip-flop can be viewed as a memory cell, a zero-order hold, or a delay line.[26]

Truth table:

Clock D Qnext
Rising edge 0 0
Rising edge 1 1
Non-rising X Q

(X denotes a don't care condition, meaning the signal is irrelevant)

Most D-type flip-flops in ICs have the capability to be forced to the set or reset state (which ignores the D and clock inputs), much like an SR flip-flop. Usually, the illegal S = R = 1 condition is resolved in D-type flip-flops. Setting S = R = 0 makes the flip-flop behave as described above. Here is the truth table for the other possible S and R configurations:

Inputs Outputs
S R D > Q Q
0 1 X X 0 1
1 0 X X 1 0
1 1 X X 1 1
4-bit serial-in, parallel-out (SIPO) shift register

These flip-flops are very useful, as they form the basis for shift registers, which are an essential part of many electronic devices. The advantage of the D flip-flop over the D-type "transparent latch" is that the signal on the D input pin is captured the moment the flip-flop is clocked, and subsequent changes on the D input will be ignored until the next clock event. An exception is that some flip-flops have a "reset" signal input, which will reset Q (to zero), and may be either asynchronous or synchronous with the clock.

The above circuit shifts the contents of the register to the right, one bit position on each active transition of the clock. The input X is shifted into the leftmost bit position.

Classical positive-edge-triggered D flip-flop

[edit]
A few different types of edge triggered D flip‑flops
A positive-edge-triggered D flip-flop
A positive-edge-triggered D flip-flop
A positive-edge-triggered D flip-flop with set and reset
A positive-edge-triggered D flip-flop with set and reset

This circuit[27] consists of two stages implemented by SR NAND latches. The input stage (the two latches on the left) processes the clock and data signals to ensure correct input signals for the output stage (the single latch on the right). If the clock is low, both the output signals of the input stage are high regardless of the data input; the output latch is unaffected and it stores the previous state. When the clock signal changes from low to high, only one of the output voltages (depending on the data signal) goes low and sets/resets the output latch: if D = 0, the lower output becomes low; if D = 1, the upper output becomes low. As long as the clock signal stays high, these input-stage outputs keep their states regardless of the data input and force the output latch to stay in the corresponding state, as the input logical zero (of the output stage) remains active while the clock is high. Any change of the data input while the clock is high will not change the states of the two input-stage latches. Hence the role of the output latch is to store the data only while the clock is low.

The circuit is closely related to the gated D latch as both the circuits convert the two D input states (0 and 1) to two input combinations (01 and 10) for the output SR latch by inverting the data input signal (both the circuits split the single D signal in two complementary S and R signals). The difference is that NAND logical gates are used in the gated D latch, while SR NAND latches are used in the positive-edge-triggered D flip-flop. The role of these latches is to "lock" the active output producing low voltage (a logical zero); thus the positive-edge-triggered D flip-flop can also be thought of as a gated D latch with latched input gates.

Master–slave edge-triggered D flip-flop

[edit]
A master–slave D flip-flop. It responds on the falling edge of the enable input (usually a clock).
An implementation of a master–slave D flip-flop that is triggered on the rising edge of the clock

A master–slave D flip-flop is created by connecting two gated D latches in series, and inverting the enable input to one of them. It is called master–slave because the master latch controls the slave latch's output value Q and forces the slave latch to hold its value whenever the slave latch is enabled, as the slave latch always copies its new value from the master latch and changes its value only in response to a change in the value of the master latch and clock signal.

For a positive-edge triggered master–slave D flip-flop, when the clock signal is low (logical 0) the "enable" seen by the first or "master" D latch (the inverted clock signal) is high (logical 1). This allows the "master" latch to store the input value when the clock signal transitions from low to high. As the clock signal goes high (0 to 1) the inverted "enable" of the first latch goes low (1 to 0) and the value seen at the input to the master latch is "locked". Nearly simultaneously, the twice inverted "enable" of the second or "slave" D latch transitions from low to high (0 to 1) with the clock signal. This allows the signal captured at the rising edge of the clock by the now "locked" master latch to pass through the "slave" latch. When the clock signal returns to low (1 to 0), the output of the "slave" latch is "locked", and the value seen at the last rising edge of the clock is held while the "master" latch begins to accept new values in preparation for the next rising clock edge.

Removing the leftmost inverter in the circuit creates a D-type flip-flop that strobes on the falling edge of a clock signal. This has a truth table like this:

D Q > Qnext
0 X Falling 0
1 X Falling 1

Dual-edge-triggered D flip-flop

[edit]
An implementation of a dual-edge-triggered D flip-flop

Flip-Flops that read in a new value on the rising and the falling edge of the clock are called dual-edge-triggered flip-flops. Such a flip-flop may be built using two single-edge-triggered D-type flip-flops and a multiplexer, or by using two single-edge triggered D-type flip-flops and three XOR gates.

Circuit symbol of a dual-edge-triggered D flip-flop
A dual-edge triggered D flip-flop implemented using XOR gates, and no multiplexer

Edge-triggered dynamic D storage element

[edit]
A CMOS IC implementation of a dynamic edge-triggered flip-flop with reset

An efficient functional alternative to a D flip-flop can be made with dynamic circuits (where information is stored in a capacitance) as long as it is clocked often enough; while not a true flip-flop, it is still called a flip-flop for its functional role. While the master–slave D element is triggered on the edge of a clock, its components are each triggered by clock levels. The "edge-triggered D flip-flop", as it is called even though it is not a true flip-flop, does not have the master–slave properties.

Edge-triggered D flip-flops are often implemented in integrated high-speed operations using dynamic logic. This means that the digital output is stored on parasitic device capacitance while the device is not transitioning. This design facilitates resetting by simply discharging one or more internal nodes. A common dynamic flip-flop variety is the true single-phase clock (TSPC) type which performs the flip-flop operation with little power and at high speeds. However, dynamic flip-flops will typically not work at static or low clock speeds: given enough time, leakage paths may discharge the parasitic capacitance enough to cause the flip-flop to enter invalid states.

T flip-flop

[edit]
A circuit symbol for a T-type flip-flop

If the T input is high, the T flip-flop changes state ("toggles") whenever the clock input is strobed. If the T input is low, the flip-flop holds the previous value. This behavior is described by the characteristic equation:

(expanding the XOR operator)

and can be described in a truth table:

T flip-flop operation[28]
Characteristic table Excitation table
Comment Comment
0 0 0 Hold state (no clock) 0 0 0 No change
0 1 1 Hold state (no clock) 1 1 0 No change
1 0 1 Toggle 0 1 1 Complement
1 1 0 Toggle 1 0 1 Complement

When T is held high, the toggle flip-flop divides the clock frequency by two; that is, if clock frequency is 4 MHz, the output frequency obtained from the flip-flop will be 2 MHz. This "divide by" feature has application in various types of digital counters. A T flip-flop can also be built using a JK flip-flop (J & K pins are connected together and act as T) or a D flip-flop (T input XOR Qprevious drives the D input).

JK flip-flop

[edit]
A circuit symbol for a positive-edge-triggered JK flip-flop
JK flip-flop timing diagram

The JK flip-flop augments the behavior of the SR flip-flop (J: Set, K: Reset) by interpreting the J = K = 1 condition as a "flip" or toggle command. Specifically, the combination J = 1, K = 0 is a command to set the flip-flop; the combination J = 0, K = 1 is a command to reset the flip-flop; and the combination J = K = 1 is a command to toggle the flip-flop, i.e., change its output to the logical complement of its current value. Setting J = K = 0 maintains the current state. To synthesize a D flip-flop, simply set K equal to the complement of J (input J will act as input D). Similarly, to synthesize a T flip-flop, set K equal to J. The JK flip-flop is therefore a universal flip-flop, because it can be configured to work as an SR flip-flop, a D flip-flop, or a T flip-flop.

The characteristic equation of the JK flip-flop is:

and the corresponding truth table is:

JK flip-flop operation[28]
Characteristic table Excitation table
J K Comment Qnext Q Qnext Comment J K
0 0 Hold state Q 0 0 No change 0 X
0 1 Reset 0 0 1 Set 1 X
1 0 Set 1 1 0 Reset X 1
1 1 Toggle Q 1 1 No change X 0

Timing considerations

[edit]

Timing parameters

[edit]
Flip-flop setup, hold and clock-to-output timing parameters

The input must be held steady in a period around the rising edge of the clock known as the aperture. Imagine taking a picture of a frog on a lily-pad.[29] Suppose the frog then jumps into the water. If you take a picture of the frog as it jumps into the water, you will get a blurry picture of the frog jumping into the water—it's not clear which state the frog was in. But if you take a picture while the frog sits steadily on the pad (or is steadily in the water), you will get a clear picture. In the same way, the input to a flip-flop must be held steady during the aperture of the flip-flop.

Setup time is the minimum amount of time the data input should be held steady before the clock event, so that the data is reliably sampled by the clock.

Hold time is the minimum amount of time the data input should be held steady after the clock event, so that the data is reliably sampled by the clock.

Aperture is the sum of setup and hold time. The data input should be held steady throughout this time period.[29]

Recovery time is the minimum amount of time the asynchronous set or reset input should be inactive before the clock event, so that the data is reliably sampled by the clock. The recovery time for the asynchronous set or reset input is thereby similar to the setup time for the data input.

Removal time is the minimum amount of time the asynchronous set or reset input should be inactive after the clock event, so that the data is reliably sampled by the clock. The removal time for the asynchronous set or reset input is thereby similar to the hold time for the data input.

Short impulses applied to asynchronous inputs (set, reset) should not be applied completely within the recovery-removal period, or else it becomes entirely indeterminable whether the flip-flop will transition to the appropriate state. In another case, where an asynchronous signal simply makes one transition that happens to fall between the recovery/removal time, eventually the flip-flop will transition to the appropriate state, but a very short glitch may or may not appear on the output, dependent on the synchronous input signal. This second situation may or may not have significance to a circuit design.

Set and Reset (and other) signals may be either synchronous or asynchronous and therefore may be characterized with either Setup/Hold or Recovery/Removal times, and synchronicity is very dependent on the design of the flip-flop.

Differentiation between Setup/Hold and Recovery/Removal times is often necessary when verifying the timing of larger circuits because asynchronous signals may be found to be less critical than synchronous signals. The differentiation offers circuit designers the ability to define the verification conditions for these types of signals independently.

Metastability

[edit]

Flip-flops are subject to a problem called metastability, which can happen when two inputs, such as data and clock or clock and reset, are changing at about the same time. When the order is not clear, within appropriate timing constraints, the result is that the output may behave unpredictably, taking many times longer than normal to settle to one state or the other, or even oscillating several times before settling. Theoretically, the time to settle down is not bounded. In a computer system, this metastability can cause corruption of data or a program crash if the state is not stable before another circuit uses its value; in particular, if two different logical paths use the output of a flip-flop, one path can interpret it as a 0 and the other as a 1 when it has not resolved to stable state, putting the machine into an inconsistent state.[30]

The metastability in flip-flops can be avoided by ensuring that the data and control inputs are held valid and constant for specified periods before and after the clock pulse, called the setup time (tsu) and the hold time (th) respectively. These times are specified in the data sheet for the device, and are typically between a few nanoseconds and a few hundred picoseconds for modern devices. Depending upon the flip-flop's internal organization, it is possible to build a device with a zero (or even negative) setup or hold time requirement but not both simultaneously.

Unfortunately, it is not always possible to meet the setup and hold criteria, because the flip-flop may be connected to a real-time signal that could change at any time, outside the control of the designer. In this case, the best the designer can do is to reduce the probability of error to a certain level, depending on the required reliability of the circuit. One technique for suppressing metastability is to connect two or more flip-flops in a chain, so that the output of each one feeds the data input of the next, and all devices share a common clock. With this method, the probability of a metastable event can be reduced to a negligible value, but never to zero. The probability of metastability gets closer and closer to zero as the number of flip-flops connected in series is increased. The number of flip-flops being cascaded is referred to as the "ranking"; "dual-ranked" flip flops (two flip-flops in series) is a common situation.

So-called metastable-hardened flip-flops are available, which work by reducing the setup and hold times as much as possible, but even these cannot eliminate the problem entirely. This is because metastability is more than simply a matter of circuit design. When the transitions in the clock and the data are close together in time, the flip-flop is forced to decide which event happened first. However fast the device is made, there is always the possibility that the input events will be so close together that it cannot detect which one happened first. It is therefore logically impossible to build a perfectly metastable-proof flip-flop. Flip-flops are sometimes characterized for a maximum settling time (the maximum time they will remain metastable under specified conditions). In this case, dual-ranked flip-flops that are clocked slower than the maximum allowed metastability time will provide proper conditioning for asynchronous (e.g., external) signals.

Propagation delay

[edit]

Another important timing value for a flip-flop is the clock-to-output delay (common symbol in data sheets: tCO) or propagation delay (tP), which is the time a flip-flop takes to change its output after the clock edge. The time for a high-to-low transition (tPHL) is sometimes different from the time for a low-to-high transition (tPLH).

When cascading flip-flops which share the same clock (as in a shift register), it is important to ensure that the tCO of a preceding flip-flop is longer than the hold time (th) of the following flip-flop, so data present at the input of the succeeding flip-flop is properly "shifted in" following the active edge of the clock. This relationship between tCO and th is normally guaranteed if the flip-flops are physically identical. Furthermore, for correct operation, it is easy to verify that the clock period has to be greater than the sum tsu + th.

Generalizations

[edit]

Flip-flops can be generalized in at least two ways: by making them 1-of-N instead of 1-of-2, and by adapting them to logic with more than two states. In the special cases of 1-of-3 encoding, or multi-valued ternary logic, such an element may be referred to as a flip-flap-flop.[31]

In a conventional flip-flop, exactly one of the two complementary outputs is high. This can be generalized to a memory element with N outputs, exactly one of which is high (alternatively, where exactly one of N is low). The output is therefore always a one-hot (respectively one-cold) representation. The construction is similar to a conventional cross-coupled flip-flop; each output, when high, inhibits all the other outputs.[32] Alternatively, more or less conventional flip-flops can be used, one per output, with additional circuitry to make sure only one at a time can be true.[33]

Another generalization of the conventional flip-flop is a memory element for multi-valued logic. In this case the memory element retains exactly one of the logic states until the control inputs induce a change.[34] In addition, a multiple-valued clock can also be used, leading to new possible clock transitions.[35]

Notes

[edit]

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
In , a flip-flop is a bistable circuit that stores one bit of binary , maintaining one of two stable states (representing logic 0 or 1) until directed to switch by specific input signals. These circuits form the basic memory elements in systems, enabling the storage and synchronization of data in digital devices. The first electronic flip-flop, known as the Eccles-Jordan trigger circuit, was invented in 1918 by British physicists William Eccles and Frank Wilfred Jordan as a vacuum-tube-based bistable device for use in radio trigger relays. Initially popularized through a 1919 article in The Radio Review, it laid the groundwork for modern digital memory despite predating widespread transistor technology. Over time, flip-flops evolved from discrete components to integrated circuits, becoming essential in the development of computers and microprocessors. Common types of flip-flops include the SR (Set-Reset), (Data), JK, and T (Toggle) variants, each designed for specific behaviors in response to inputs and clock signals. The SR flip-flop uses Set and Reset inputs to control state changes but has a forbidden input combination; the flip-flop captures the input value on a clock edge for straightforward ; the JK flip-flop resolves the SR issue with toggling capability when both inputs are active; and the T flip-flop toggles its state only when its input is asserted, often derived from other types. These types typically feature complementary outputs (Q and \overline{Q}) and operate on clock edges to ensure synchronous behavior in larger systems. Flip-flops are widely applied in digital electronics for constructing registers, counters, shift registers, and finite state machines, where they provide the temporal sequencing necessary for operations like latching and division. In synchronous designs, arrays of flip-flops form the core of processor pipelines and units, enabling reliable state retention amid clock-driven logic propagation. Their role extends to edge-triggered applications in modern VLSI chips, where timing constraints like setup and hold times ensure glitch-free performance.

Fundamentals

Definition and purpose

A flip-flop is a bistable multivibrator circuit in digital electronics that maintains one of two stable states, representing binary values 0 or 1, until an external input triggers a change to the other state. This arises from a feedback loop where the output reinforces itself, indicating the state persists without further input. Flip-flops serve as fundamental memory elements in circuits, enabling the storage and synchronization of data for applications such as counters, shift registers, and finite state machines. Unlike , which produces outputs solely from current inputs, flip-flops incorporate of prior states, allowing circuits to process information over time. In a , a flip-flop typically features inputs such as (D), set (S), reset (R), clock (CLK), or others depending on the type, with outputs Q (the stored state) and Q\overline{Q} (its complement). These components form the core of processors and units, where arrays of flip-flops store instructions and . While flip-flops are edge-triggered for precise timing, they differ from level-sensitive latches in their response to control signals.

Latches versus flip-flops

Latches are level-triggered storage elements in digital electronics that remain transparent to their input signals while the enable signal is active, allowing the output to continuously follow the input, and hold their state when the enable signal is inactive. This level-sensitive behavior makes latches suitable for asynchronous or simple temporary storage applications. In contrast, flip-flops are edge-triggered devices that update their output state only at the transition of a , such as the rising or falling edge, regardless of the clock's level duration. This ensures precise synchronization in sequential circuits, where state changes are confined to specific instants. The operational differences between latches and flip-flops are summarized in the following comparison:
AspectFlip-Flop
TransparencyContinuous during enable signal activeInstantaneous only at clock edge
Susceptibility to glitchesHigher, due to ongoing input propagation while enabledLower, with proper and design to isolate inputs
For instance, a D latch can serve as a simple buffer in digital systems, passing through when enabled to isolate or delay signals temporarily. Flip-flops, however, are commonly employed in synchronized pipelines to register between processing stages, ensuring timed propagation without intermediate disturbances. Advanced latches, such as gated variants, incorporate conditional transparency, where the enable signal determines periods of pass-through versus state retention, bridging basic ing with more controlled .

Historical Development

Invention of the bistable circuit

The bistable circuit, foundational to the flip-flop, was first invented in 1918 by British physicists William Henry Eccles and Frank Wilfred Jordan as the Eccles-Jordan trigger circuit, a using vacuum tubes. This device employed two vacuum tubes cross-coupled such that of one tube connected through a to the plate of the other, enabling the circuit to maintain one of two stable states after an initial trigger pulse. The invention was patented on June 21, 1918, under the title "Improvements in Ionic Relays" (British Patent 148,582, granted 1920), and detailed in their seminal one-page paper "A trigger relay utilizing three-electrode thermionic vacuum tubes," published in The Electrician on September 19, 1919. The basic Eccles-Jordan circuit diagram features two triode tubes (V1 and V2), each with a cathode grounded via a common resistor, an anode load resistor connected to a positive supply (e.g., +B), and cross-coupling where the anode of V1 connects to the grid of V2 via resistor R1, and the anode of V2 connects to the grid of V1 via resistor R2, with grid leak resistors to bias the non-conducting tube negatively. In operation, one tube conducts while the other is cut off, holding the state until a positive input pulse to the non-conducting tube's grid or a negative pulse to the conducting tube's grid triggers a switch, with regenerative feedback ensuring rapid transition. Initially applied in the and , the Eccles-Jordan circuit served as a core element in electronic counters for scaling pulses and in oscillators for generating stable signals in and systems. Its bistable nature allowed reliable pulse division in early scaling circuits, though practical implementations were constrained by limitations. A landmark digital computing application came in 1943 with ' design of the at , where Eccles-Jordan triggers formed the memory and elements for codebreaking the during . Due to the slow switching times and in vacuum tubes, these early circuits operated at low speeds, approximately 5 kHz, restricting their use to non-real-time processing tasks.

Evolution to modern forms

Following , the development of transistors in the late 1940s and early 1950s marked a pivotal shift in flip-flop technology, replacing bulky and power-hungry vacuum tubes with more compact, reliable, and faster alternatives. Transistors enabled bistable circuits to operate at higher speeds and lower voltages, reducing size and heat dissipation in digital systems. For instance, announced the first commercial silicon transistors in 1954, which offered superior temperature stability and performance compared to earlier types, facilitating the transition to transistorized flip-flops in early computers like the U.S. Air Force's system completed in 1954. By the 1960s, the advent of integrated circuits standardized flip-flop implementations through logic families such as resistor-transistor logic (RTL) and diode-transistor logic (DTL). Fairchild Semiconductor introduced the first commercial RTL integrated circuits in 1961 under the μLogic brand, including JK flip-flops like the Type 923, which integrated multiple transistors on a single chip for improved reliability and cost-effectiveness in applications like the Apollo Guidance Computer. DTL followed soon after, with Fairchild's 930 series in 1964 providing better noise immunity via diode inputs, further refining standardized flip-flop designs for broader adoption in minicomputers and data processing equipment. The 1970s brought a focus on power efficiency with the rise of technology, which minimized static power consumption while maintaining compatibility with TTL voltage levels. This era saw the development of low-power flip-flop ICs, exemplified by the 74HC series, including the 74HC74 dual D-type flip-flop introduced in 1978 by manufacturers like Signetics and , enabling battery-operated and portable digital devices. A significant milestone occurred in 1971 with the , the first commercial , which incorporated D flip-flops to form its 4-bit registers and , integrating thousands of transistors on a single chip for programmable computing. Moore's Law, articulated by in 1965, profoundly influenced flip-flop evolution by predicting the doubling of density on integrated circuits approximately every two years, directly scaling the number and complexity of flip-flops in very large scale integration (VLSI) designs. This allowed VLSI chips in the late 1970s and beyond to pack millions of flip-flops for advanced processors and memory systems, enhancing performance while reducing costs per function.

Implementation

Gate-level configurations

The basic bistable circuits underlying flip-flops, known as latches, are constructed at the gate level using cross-coupled logic gates to create a feedback loop that maintains , allowing the circuit to store one bit of in one of two stable states. This configuration typically involves two gates—such as NOR or NAND—where the output of each gate serves as an input to the other, forming a mechanism that reinforces the current state until external inputs alter it. The general features two inputs (commonly labeled S for set and R for reset), two complementary outputs (Q and \overline{Q}), and the feedback loop ensures that in valid states, the outputs are always opposite: one high and one low, preventing both from being high or both low simultaneously. Common configurations employ either cross-coupled NOR gates or cross-coupled NAND gates, each suited to different input polarities. The NOR-based configuration operates with active-high inputs, where a high signal on S sets Q to 1 and a high on R resets Q to 0, making it suitable for positive logic systems. In contrast, the NAND-based configuration uses active-low inputs, requiring a low signal on S to set Q to 1 and a low on R to reset Q to 0, which aligns with negative logic conventions and is often preferred in implementations for its compatibility with pull-up networks. These setups achieve through the inherent inverting nature of the gates, where small perturbations are amplified to drive the outputs to full rail levels. To create synchronous flip-flops from these basic latches, additional logic gates are used to incorporate a , enabling edge-triggered operation. For example, a clocked SR flip-flop adds AND gates to the S and R inputs, allowing state changes only when the clock is high (for level-sensitive) or using more complex master-slave configurations for true edge-triggering. This ensures controlled transitions synchronized to the clock, forming the foundation for types like D and JK flip-flops described elsewhere. In asynchronous designs, such as basic SR latches built from these cross-coupled gates, forbidden states arise when both inputs are asserted simultaneously, leading to invalid output conditions. For the NOR configuration, applying S=1 and R=1 forces both Q and \overline{Q} to 0, creating a metastable or undefined state upon release. Similarly, in the NAND configuration, S=0 and R=0 drives both outputs to 1, again resulting in an indeterminate condition. Race conditions can also occur if S and R change nearly simultaneously, causing temporary oscillations or unpredictable transitions due to differing gate propagation delays in the feedback loop. The set-reset behavior of these gate-level configurations follows a generic , illustrated below for the NOR-based SR (active-high inputs), where the hold state preserves the previous output when both inputs are deasserted:
SRQ (next)\overline{Q} (next)Description
00Q (prev)\overline{Q} (prev)Hold
1010Set
0101Reset
1100Forbidden
This table demonstrates the core functionality, with the forbidden combination avoided in practice to ensure reliable operation. For the NAND-based variant, the inputs are inverted in polarity, but the logical outcomes remain analogous after accounting for the active-low signaling.

Characteristic representations

Characteristic equations provide a mathematical description of a flip-flop's next-state behavior, typically expressed in the general form Qn+1=f(inputs,Qn,clock)Q_{n+1} = f(\text{inputs}, Q_n, \text{clock}), where Qn+1Q_{n+1} is the output state after the clock edge, QnQ_n is the current state, and the function depends on the specific inputs and clock transition. These equations abstract the flip-flop's response, enabling analysis without detailed circuit implementation, and are derived from the logic gates' truth tables. For instance, in edge-triggered designs, the clock input synchronizes the transition, ensuring the next state is evaluated only at the active edge. Excitation tables complement characteristic equations by specifying the input combinations required to drive a flip-flop from its current state QnQ_n to a desired next state Qn+1Q_{n+1}. These tables are essential for , as they reverse the characteristic table to determine necessary inputs for specific transitions like hold (no change), set (to 1), reset (to 0), or toggle (invert). For example, to achieve a toggle transition in a configuration, the input must be set to 1 regardless of the current state, while a hold requires the input to be 0.
Current State QnQ_nNext State Qn+1Q_{n+1}T Input (for toggle example)
00 (hold)0
01 (toggle)1
11 (hold)0
10 (toggle)1
This table illustrates the excitation requirements for toggling, highlighting how inputs are selected to enforce state changes on the clock edge. State diagrams offer a graphical representation of a flip-flop's stable states and transitions, depicting the two primary states (typically labeled as 0 and 1) as nodes connected by directed arcs that indicate input conditions triggering changes. Arcs are labeled with input values or clock events, showing paths for holding the state or transitioning between states, which aids in visualizing sequential behavior at a high level. These diagrams are particularly useful for analyzing multi-flip-flop systems, where combined states form cycles or conditional paths based on external inputs. Timing waveforms illustrate flip-flop operation through traces of clock, input, and output signals over time, emphasizing synchronous without quantifying . In a typical positive edge-triggered setup, the clock appears as periodic pulses, with inputs applied just before rising edges; the output then captures and holds the input value until the next edge, producing a stepped that mirrors sampled inputs. For negative edge-triggered variants, transitions occur at falling edges, but the generic pattern remains: outputs change abruptly at clock edges and remain stable between them, demonstrating the device's role in . Karnaugh maps simplify the excitation logic for custom flip-flop designs by minimizing expressions derived from excitation tables, treating current states and inputs as map variables to group adjacent 1s for reduced gate count. In counter applications, for example, maps plot next-state functions for each flip-flop input, yielding compact equations like Y=wyY = w \oplus y for a basic toggle, which optimizes the driving the flip-flops. This method ensures efficient implementation while preserving the desired state transitions outlined in the excitation tables.

Types

Asynchronous set-reset latches

Asynchronous set-reset latches, also known as SR latches, are fundamental bistable circuits in digital that store one bit of information and respond immediately to asynchronous set (S) and reset (R) inputs without requiring a for operation. These latches maintain their state until an input changes it, providing the basic building block for more complex . They operate in a level-sensitive manner, where the outputs (the stored value) and \bar{Q} (its complement) are determined directly by the logic levels of S and R. The SR NOR latch is implemented using two cross-coupled NOR gates, forming a feedback loop that ensures bistability. The set input S is applied to one input of the first NOR gate, whose output is Q, while the second input of this gate receives \bar{Q} from the second NOR gate. The reset input R is applied to one input of the second NOR gate, whose output is \bar{Q}, with Q fed back to its second input. This configuration uses active-high inputs, where asserting S=1 sets Q=1 (and \bar{Q}=0), asserting R=1 resets Q=0 (and \bar{Q}=1), and deasserting both (S=0, R=0) holds the previous state. However, the state S=1 and R=1 is forbidden, as it forces both Q=0 and \bar{Q}=0, leading to unpredictable recovery upon release. The for the SR NOR latch is as follows:
SRQ^{+}\bar{Q}^{+}Description
00Q\bar{Q}Hold (no change)
0101Reset
1010Set
11??Forbidden
The characteristic equation, derived by treating the forbidden state as a don't care in a minimization, is Q+=S+RˉQQ^{+} = S + \bar{R} Q. This equation captures the next-state behavior Q^{+} based on current inputs S, R and state Q, assuming valid input combinations. In the circuit diagram, the two NOR gates are arranged such that the output of each drives one input of the other, creating the cross-coupling, with S and R as external inputs. Waveforms for the SR NOR latch illustrate direct response: when S pulses high while R is low, Q transitions high immediately and remains high after S returns low; similarly, pulsing R high while S is low drives Q low persistently; with both low, Q holds steady regardless of prior state; the forbidden case shows both outputs low during assertion, with potential or race upon deassertion. The SR NAND latch serves as the dual implementation using two cross-coupled NAND gates, providing bistable operation with active-low inputs. The set input S connects to one input of the first NAND gate (output Q), with \bar{Q} fed back to its other input; R connects to one input of the second NAND gate (output \bar{Q}), with Q fed back. Asserting S=0 and R=1 sets Q=1; S=1 and R=0 resets Q=0; S=1 and R=1 holds the state. The forbidden state S=0 and R=0 results in both outputs high (Q=1, \bar{Q}=1), causing instability upon release. The for the SR NAND is:
SRQ^{+}\bar{Q}^{+}Description
11Q\bar{Q}Hold (no change)
1001Reset
0110Set
0011Forbidden
The characteristic equation is Q+=Sˉ+RQQ^{+} = \bar{S} + R Q, obtained via similar minimization techniques for valid states. The circuit diagram mirrors the NOR version but with NAND gates, emphasizing the feedback paths. Waveforms demonstrate immediate transitions: S low with R high sets Q high, holding after deassertion; R low with S high resets Q low; both high maintains the state; the forbidden assertion (both low) shows both outputs high, with possible race conditions on release. The SR AND-OR latch offers an alternative gate-level design using AND-OR-INVERT (AOI) logic to mitigate race conditions in certain asynchronous applications, though it still exhibits undefined behavior for S=1 and R=1. It consists of two AND gates (one for S and feedback from \bar{Q}, the other for R and feedback from Q) whose outputs feed an OR gate, followed by an inverter to produce Q, with \bar{Q} derived accordingly. This structure avoids direct cross-coupling of basic inverters, potentially reducing glitches in noisy environments. The aligns with standard SR behavior:
SRQ^{+}Description
00QHold
010Reset
101Set
11?Undefined (race possible)
No simplified characteristic equation is typically emphasized beyond the basic SR form, as the focus is on practical avoidance of simultaneous assertions. The shows the AND gates combining inputs with feedback, OR combining their outputs, and inverter for Q. Waveforms highlight set/reset transitions and hold, with emphasis on the risk of or metastable states during forbidden input overlap, which the AOI structure helps bound in some implementations. The asynchronous JK latch extends the SR latch to eliminate the forbidden state by incorporating additional logic, typically using NAND or AND-OR gates with J (set-like) and K (reset-like) inputs. For J=1 and K=0, it sets Q=1; J=0 and K=1 resets Q=0; J=0 and K=0 holds the state; J=1 and K=1 toggles Q to \bar{Q}, resolving the SR ambiguity without instability. This makes it suitable for asynchronous toggle operations in simple counters or state machines. The for the asynchronous JK is:
JKQ^{+}Description
00QHold
010Reset
101Set
11\bar{Q}Toggle
The circuit often builds on an SR NAND base with extra AND gates to detect J=K=1 and force toggle via feedback. Waveforms show direct responses: J high/K low sets Q; J low/K high resets; both low holds; both high inverts Q instantly, demonstrating the toggle without the SR forbidden race.

Gated latches and conditional transparency

Gated latches, also known as level-sensitive latches, incorporate an enable signal (often denoted as E or CLK) that controls the timing of state changes, allowing the latch to be conditionally transparent to its inputs. When the enable is active (typically high), the latch output follows the input values, enabling data to propagate through; when inactive (low), the latch holds its previous state, preventing changes. This mechanism provides controlled access to the bistable storage of the underlying SR latch while avoiding constant asynchronous behavior. The gated SR latch extends the basic SR latch by adding AND gates to the set (S) and reset (R) inputs, gating them with the enable signal E. It functions transparently when E=1, where the next state follows the SR latch equation Q+=S+RˉQQ^{+} = S + \bar{R} Q; when E=0, it latches the current state regardless of S and R. The full characteristic equation is Q+=SE+Q(RˉE+Eˉ)Q^{+} = S E + Q (\bar{R} E + \bar{E}), ensuring no state change during disable. A truth table illustrates this behavior:
ESRQ^{+}
0XXQ (no change)
100Q (hold)
1010 (reset)
1101 (set)
111Invalid
This configuration mitigates race conditions in larger systems by synchronizing input effects to the enable pulse, though the S=R=1 condition remains forbidden. The gated D simplifies the input structure to a single data line D, with E controlling transparency, eliminating the invalid state of the SR variant. Constructed by routing D to S and Dˉ\bar{D} to R in a gated SR , it sets Q+=DQ^{+} = D when E=1 and holds Q+=QQ^{+} = Q when E=0, with the characteristic equation Q+=DE+EˉQQ^{+} = D E + \bar{E} Q. Its is:
EDQ^{+}
0XQ (no change)
100
111
This design ensures unambiguous operation, making it widely used for temporary in registers and pipelines. The Earle latch, developed for efficient arithmetic processing, integrates four data inputs (A, B, C, D) with enable E to compute a sum-of-products function during transparency. It operates as Q+=(AB+CD)E+QEˉQ^{+} = (A B + C D) E + Q \bar{E}, allowing two levels of logic (AND-OR) to be embedded within the for reduced delay in adders and multipliers. This hazard-free design, using NAND gates in implementations, supports pipelined arithmetic by merging computation and storage. Waveforms for gated latches show a transparency window during the high enable period, where output Q tracks input changes dynamically; however, if inputs toggle mid-window, glitches may occur due to propagation delays, potentially causing momentary invalid states. In contrast to edge-triggered flip-flops, which sample only at the enable transition for discrete updates, gated latches exhibit continuous transparency throughout the enable assertion, enabling higher throughput in level-sensitive pipelines but requiring stable inputs during the active phase to avoid errors.

D flip-flop

The D flip-flop, also known as the or delay flip-flop, is a fundamental synchronous sequential circuit element that captures the value of its data input (D) and transfers it to the output (Q) on the active clock edge, with the characteristic equation Q+=[D](/page/D)Q^{+} = [D](/page/D*). This behavior ensures that the output reflects the input present at the clock transition, making it ideal for and in digital systems. The classical positive-edge-triggered D flip-flop operates by sampling the D input on the rising edge of the clock signal, ignoring input changes at other times. It is typically implemented using a master-slave configuration consisting of two gated D latches, where the master latch is transparent (allows data to pass through) when the clock is low and latched when the clock is high, while the slave latch operates in the opposite phases to capture the master's state on the rising edge. This arrangement prevents data races and ensures edge-triggered operation. At the gate level, the circuit can be realized with six NAND gates: the master stage uses three NAND gates forming an SR latch with clocked inputs, and the slave stage mirrors this but with inverted clock polarity, connected such that the master's outputs drive the slave's inputs. This compact design reduces transistor count compared to other configurations while maintaining reliable positive-edge triggering. A variant, the dual-edge-triggered D flip-flop, responds to both rising and falling clock edges, effectively doubling the data rate for a given clock . It achieves this by generating edge-detection pulses using an between the clock and a delayed version of itself, which then drives two latches in a configuration that alternates sampling on each edge. This approach is particularly useful in high-speed applications like serializers/deserializers, though it introduces additional considerations. For power- and area-sensitive designs, the edge-triggered dynamic D flip-flop employs capacitors for charge-based storage rather than static feedback loops. In this master-slave structure, dynamic nodes (parasitic , junction, and overlap capacitances) hold the state as charge during the evaluation phase, with the master precharging on clock low and evaluating on clock high, followed by the slave capturing on the opposite transition; the characteristic equation remains Q+=DQ^{+} = D, but the stored charge must be refreshed periodically due to leakage currents, limiting hold times to milliseconds. The circuit uses fewer transistors (typically eight in ) than static versions, enabling higher speed and lower power at the cost of refresh overhead. The characteristic table for a D flip-flop illustrates its operation, where only the D input and clock edge determine the next state Q+Q^{+}, with no dependency on the current state Q for excitation—the input D directly sets Q+Q^{+}.
DQQ+Q^{+}Operation
000No change (reset)
010Reset
101Set
111No change (set)

T flip-flop

The T flip-flop, also known as the toggle flip-flop, is a bistable sequential logic device that stores one bit of information and changes its output state in response to a clock signal based on a single toggle input, denoted as T. It operates such that if the T input is logic 0, the next state of the output Q (denoted Q^{+}) remains the same as the current state Q on the active clock edge; if T is logic 1, Q^{+} inverts from Q. The behavior is captured by the characteristic equation Q+=QTQ^{+} = Q \oplus T, where \oplus denotes the exclusive-OR operation. A T flip-flop is typically implemented using a D flip-flop with feedback logic to achieve the toggle functionality. The D input of the underlying D flip-flop is connected to the output of an whose inputs are the T signal and the current Q output, ensuring D = Q \oplus T; this configuration leverages the D flip-flop's data-latching property to produce the toggle effect when T=1. For edge-triggered operation, a master-slave arrangement is employed, where the master captures the input during one clock phase and the slave transfers it on the edge, preventing race conditions during state transitions. The operation of a T flip-flop is summarized in its characteristic truth table, which shows the next output state Q(t+1) based on the current state Q(t) and input T:
TQ(t)Q(t+1)
000
011
101
110
The excitation table specifies the T input required to achieve desired state transitions from Q(t) to Q(t+1):
Q(t)Q(t+1)T
000
011
101
110
In binary counters, T flip-flops are widely applied due to their natural toggle behavior, enabling efficient frequency division and state sequencing. Each stage of a ripple counter uses a T flip-flop with T held at 1, where the Q output of one stage drives the clock input of the next; this causes successive toggling, with the output frequency halving at each stage relative to the input clock, allowing the counter to represent binary values from 0 to 2^n - 1 for n stages. The for a T flip-flop with T=1 illustrates its frequency division capability: the input clock pulses alternate the Q output between high and low states, resulting in an output with a exactly half that of the clock, which is fundamental for counter applications and scaling in digital systems.

JK flip-flop

The JK flip-flop is a versatile device that builds upon the basic principles of the SR latch, providing defined behavior for all input combinations, including the previously forbidden state where both inputs are asserted. It features two inputs, J and K, along with a clock input in its synchronous form, enabling set, reset, hold, and toggle operations. The device's characteristic equation, which defines the next state Q+Q^+ based on current state QQ and inputs, is given by: Q+=JQ+KQQ^+ = J \overline{Q} + \overline{K} Q This equation ensures that when J=1 and K=0, the output sets to 1; when J=0 and K=1, it resets to 0; when J=K=1, it toggles to the complement of the current state; and when J=K=0, it holds the current state. Unlike the SR latch, the JK configuration eliminates undefined states, making it suitable for reliable sequential circuits. The asynchronous JK latch consists of a cross-coupled pair of NOR or NAND gates with additional AND gates incorporating feedback from the outputs to the inputs. In this basic form, the J input is ANDed with the complement of before feeding into the set path, and the K input is ANDed with before the reset path, preventing the that occurs in the SR when both inputs are high by instead causing a toggle if the inputs remain asserted long enough. This design allows the latch to respond directly to input changes without a clock, maintaining while avoiding metastable or oscillatory behavior in the invalid input case. For synchronous operation, the clocked JK flip-flop typically employs a master-slave configuration, where two JK latches are cascaded such that the master latch is enabled during one clock phase and the slave during the other, ensuring edge-triggered behavior. This arrangement resolves potential race conditions during the toggle mode (J=K=1) by isolating the input sampling from output propagation, preventing feedback from affecting the master while the slave transfers the state on the clock edge. The result is a positive edge-triggered device that updates only on the rising clock transition, commonly implemented with NAND or gates. The behavior of the JK flip-flop is summarized in its characteristic table, which shows the next state Q+Q^+ for all combinations of J, K, and current Q (assuming a clock edge occurs):
JKQQ⁺
0000
0011
0100
0110
1001
1011
1101
1110
The specifies the required J and K inputs to achieve a desired transition from current Q to next state Q⁺:
QQ⁺JK
000X
011X
10X1
11X0
Here, X denotes a "don't care" condition. A representative integrated circuit implementation is the 74LS76 dual JK flip-flop, which contains two independent negative-edge-triggered JK flip-flops with complementary outputs, asynchronous preset, and clear inputs. The pinout for the 16-pin DIP package is as follows (pins 1-8 for the first flip-flop, 9-16 for the second, with shared power):
PinFunctionDescription
1CLK₁Clock input for flip-flop 1 (negative edge)
2J₁J input for flip-flop 1
3K₁K input for flip-flop 1
4PRE̅₁Asynchronous preset (active low) for flip-flop 1
5Q₁Q output for flip-flop 1
6Q̅₁Complementary output for flip-flop 1
7CLR̅₁Asynchronous clear (active low) for flip-flop 1
8GNDGround
9CLK₂Clock input for flip-flop 2
10J₂J input for flip-flop 2
11K₂K input for flip-flop 2
12Q̅₂Complementary output for flip-flop 2
13Q₂Q output for flip-flop 2
14PRE̅₂Asynchronous preset (active low) for flip-flop 2
15CLR̅₂Asynchronous clear (active low) for flip-flop 2
16V_{CC}Positive supply (5V)
In toggle mode (J=1, K=1), the output Q alternates between 0 and 1 with each negative clock edge, producing a square wave at half the clock ; for example, starting from Q=0, the sequence on successive edges would be Q=1, then Q=0, then Q=1, demonstrating frequency division useful in counters. When J and K are tied together, the JK flip-flop operates as a T flip-flop, limiting to toggle and hold functions.

Timing Considerations

Timing parameters

Timing parameters are critical specifications that dictate the reliable operation of flip-flops in synchronous digital circuits, ensuring that are properly captured and outputs are generated without errors during clock transitions. These parameters define the windows around clock edges where signals must meet stability requirements, primarily for edge-triggered devices like the D flip-flop. Violations of these timings can lead to incorrect latching or, in severe cases, metastable states, though the focus here is on the definitional specs rather than . The setup time, denoted tsut_{su}, represents the minimum duration the data input (D) must be held stable prior to the active edge of the to guarantee that the flip-flop correctly samples the input value. For a positive edge-triggered flip-flop, this stability is required before the rising clock . Typical values for commercial devices vary with supply voltage and , but they establish the constraint on the maximum delay between flip-flops in a clock domain. The hold time, tht_h, is the minimum time the data input must remain stable following the active clock edge to prevent the flip-flop from inadvertently capturing a subsequent input change. Unlike setup time, hold time is often zero or negative in modern CMOS flip-flops, meaning the input can change immediately after the clock edge without issue, which simplifies downstream logic timing. This parameter ensures that race conditions do not corrupt the latched value due to fast signal transitions. The clock-to-output delay, commonly tcqt_{cq} or tpdt_{pd} (CLK to Q), measures the time elapsed from the active clock edge until the output (Q or \overline{Q}) becomes valid and stable with the new value. This delay includes internal propagation through the flip-flop's gates and is influenced by load and voltage; it directly impacts the minimum clock period in pipelined systems by limiting the available time for logic evaluation. Maximum values are used in timing analysis to avoid setup violations in the receiving flip-flop. For flip-flops with asynchronous inputs such as preset (set) or clear (reset), the recovery time trect_{rec} is the minimum duration these inputs must be inactive (deasserted) before the active clock edge to allow the flip-flop to respond correctly to the clock without interference from the async signal. The removal time tremt_{rem}, conversely, is the minimum time the async input must remain inactive after the clock edge to ensure the synchronous operation proceeds without the async input affecting the output. These parameters are essential for designs using async resets, preventing glitches or incomplete recovery. The following table summarizes timing parameters for the SN74HC74 dual D flip-flop at VCC=5V_{CC} = 5 V (tested at 4.5 V conditions) and 25°C, based on manufacturer specifications; values can vary slightly across vendors and operating temperatures from -40°C to 85°C. Note that setup, hold, recovery, and removal times are minimum requirements; clock-to-output has typical and maximum values. Conditions: 50 pF load.
ParameterSymbolMinimum (ns)Typical (ns)Maximum (ns)
Setup time (data)tsut_{su}20--
Hold time (data)tht_h0--
Clock-to-output delaytcqt_{cq}-1530
Recovery time (async)trect_{rec}5--
Removal time (async)tremt_{rem}6--
These values are derived from switching characteristics and timing requirements for a 50 pF load, highlighting the scale for high-speed logic families.

Metastability

Metastability in flip-flops arises when the data input changes too close to the clock edge, violating setup or hold time requirements, causing the output to enter an unstable intermediate voltage level between logic 0 and 1. This indeterminate state occurs because the internal nodes, such as those in a cross-coupled inverter pair, balance at approximately V_DD/2, leading to indecision in the output transition. The resolution of metastability follows an exponential decay process, where the small voltage difference between the nodes amplifies over time due to positive feedback in the storage elements. The resolution time trt_r, the duration required for the output to settle to a stable logic level, is given by tr=τln(V1V0ΔV)t_r = \tau \ln\left(\frac{V_1 - V_0}{\Delta V}\right), with τ\tau as the time constant determined by the circuit's capacitance CC and transconductance gain gmg_m via τ=C/gm\tau = C / g_m, V1V_1 and V0V_0 as supply rails, and ΔV\Delta V as the initial voltage offset. Higher inverter gain reduces τ\tau, accelerating resolution, while factors like process variations, low supply voltage, or temperature extremes increase τ\tau and prolong metastability. Clock skew between domains can exacerbate the issue by misaligning sampling edges, increasing the likelihood of critical timing. The (MTBF) quantifies the reliability of a flip-flop against metastable events, calculated as MTBF=etr/τfclkfdataT0,\text{MTBF} = \frac{e^{t_r / \tau}}{f_{\text{clk}} \cdot f_{\text{data}} \cdot T_0}, where fclkf_{\text{clk}} is the clock , fdataf_{\text{data}} is the data arrival rate, and T0T_0 is the metastability window (a small timing interval around the clock edge where violations occur, typically on the order of picoseconds). This formula, derived from statistical models of asynchronous input timing, shows MTBF improves exponentially with additional resolution time trt_r, but decreases linearly with higher frequencies or larger windows. Waveforms during typically show the input data toggling near the clock edge, with internal nodes briefly at an intermediate voltage before the output voltage exponentially ramps to either 0 or 1 after a delay exceeding the nominal time. In a double-flop synchronizer, the first stage may exhibit this , but the second stage samples the resolved output, stabilizing within one or two clock cycles. To mitigate in asynchronous interfaces, synchronizers such as two-stage flip-flop chains are employed, providing sufficient resolution time (one clock period) to achieve acceptable MTBF, often exceeding thousands of years in practical designs. These circuits filter metastable outputs before they propagate to the rest of the system, ensuring reliable .

Propagation delay

Propagation delay in flip-flops refers to the time interval required for a change at the input to propagate through the circuit and result in a stable change at the output, typically measured from the 50% transition point of the input signal to the 50% transition point of the output signal. In edge-triggered flip-flops, this is commonly the clock-to-output (t_{CQ}) delay, denoting the time from the active clock edge to the output (Q or \overline{Q}) reaching its new logic level, either high-to-low (t_{PHL}) or low-to-high (t_{PLH}). For asynchronous inputs like set or reset, it measures the delay from the input assertion to output stabilization. Several factors influence propagation delay in CMOS flip-flops, including process variations, supply voltage, temperature, capacitive loading from , and internal gate that affect charging/discharging times. Higher supply voltage reduces delay by increasing drive current, while increased temperature and load extend it due to slower switching. In low-voltage families like LVC, these effects are pronounced, with delay scaling inversely with voltage and linearly with temperature in typical operating ranges. Typical propagation delays for CMOS flip-flops vary by technology node; in standard 3.3 V LVC logic, clock-to-Q delays are around 8-13 ns under nominal conditions with 50 pF loads, while advanced sub-micron processes achieve 50-100 ps. These values establish the baseline speed for digital circuits, with older CMOS series like 74HC exhibiting 15-30 ns delays. In sequential circuits like ripple counters or shift registers, propagation delays accumulate across stages, limiting the maximum operating frequency. For an N-stage ripple counter, where each flip-flop's output clocks the next, the total delay for a full transition is approximately N \times t_{pd}, requiring the clock period to exceed this to avoid glitches or skipped states. fmax1Ntpdf_{\max} \approx \frac{1}{N \cdot t_{pd}} For example, with 5 ns per stage in an 8-bit counter, f_{\max} is roughly 25 MHz. Shift registers face similar constraints, as data ripples through each element, with cumulative delay dictating throughput. To measure propagation delay, oscilloscopes capture timing from the clock edge (or async input) to the 50% point on Q, often under controlled load and voltage; datasheets specify max/min values across PVT corners. Timing waveforms for ripple counters illustrate this: a clock pulse triggers the first stage after t_{pd}, its output then delays the second by another t_{pd}, creating a staggered ripple effect visible as transient glitches on intermediate outputs before all settle.

Advanced Topics

Generalizations

Flip-flops can be extended to multi-bit configurations to store and manipulate wider data words, forming the basis of registers in digital systems. A register consists of multiple D flip-flops connected in parallel, where each flip-flop holds one bit of the overall value, and all share a common clock signal for synchronous operation. For instance, an n-bit register captures the input data vector on the clock edge, updating all bits simultaneously as described by the relation Qi+=DiQ_i^+ = D_i for each bit position i=1i = 1 to nn, where Qi+Q_i^+ denotes the next state of the ii-th flip-flop. Shift registers, another multi-bit generalization, connect flip-flops in series to enable serial data shifting, such as right or left shifts for operations like data alignment or serial-to-parallel conversion. To realize devices with nn distinct states, multiple flip-flops are combined into counters, where the state transitions follow a predefined sequence, typically binary counting. An NN-bit binary counter, built from NN interconnected flip-flops (often T or JK types), cycles through 2N2^N states, providing a scalable way to track counts or generate timing sequences; for example, a 4-bit counter achieves 16 states. More complex behaviors are achieved by integrating flip-flops with to form finite state machines (FSMs), which model arbitrary sequential processes through state storage and next-state logic. In an FSM, flip-flops retain the current state, while combinational circuits compute the next state and outputs based on inputs and the present state. State encoding schemes, such as encoding, assign a unique flip-flop to each state (active high for the current state), simplifying decoding logic but requiring one flip-flop per state, which suits environments with abundant storage like FPGAs. For enhanced robustness in noisy environments, generalized flip-flop designs incorporate Schmitt trigger inputs, which provide to prevent false triggering from signal glitches or slow transitions. This feature, often applied to clock or data inputs, ensures reliable operation by defining distinct high and low thresholds, thereby improving noise immunity without altering the core storage mechanism.

Modern implementations and applications

In modern CMOS implementations, the transmission gate D flip-flop serves as a fundamental building block due to its efficiency in edge-triggered operation. This design typically employs six transistors per latch (master and slave stages) in the master-slave configuration, utilizing complementary NMOS and PMOS pairs to form s that control data flow with minimal clock loading. The dynamic power consumption in such CMOS flip-flops is governed by the equation P=CV2fP = C V^2 f, where CC represents the load , VV is the supply voltage, and ff is the clock frequency, highlighting the quadratic dependence on voltage that drives low-power optimizations. Advancements in process nodes have shifted toward FinFET and gate-all-around (GAA) architectures for sub-5 nm scales, enabling propagation delays below 1 ns in flip-flop circuits while enhancing drive current and electrostatic control. For instance, FinFET-based designs demonstrate substantial delay reductions compared to older planar processes, such as a 94% decrease in propagation delay for a when comparing 15 nm FinFET to 180 nm planar implementations in libraries. However, these scaled nodes introduce increased process variability, including fluctuations and fin/channel imperfections, affecting timing in GAA structures due to nanoscale effects. Flip-flops find widespread application in field-programmable gate arrays (FPGAs), where they pair with look-up tables (LUTs) to form configurable logic blocks that store state and enable sequential operations. In CPU , such as those in Cortex-M3 cores, master-slave D flip-flops act as pipeline registers to synchronize data across stages, ensuring reliable throughput in embedded systems. Similarly, in DRAM controllers, flip-flops serve as memory elements for state machines that manage refresh cycles, address decoding, and command sequencing, providing stable storage for control signals in high-speed memory interfaces. To address power constraints in battery-operated and high-density devices, low-power variants incorporate clock-gating and power-gating techniques that target dynamic power reduction. Clock-gating deactivates the to idle flip-flops, preventing unnecessary toggling and yielding up to 38% power savings in counter circuits, while power-gating isolates supply voltage to unused blocks, minimizing leakage in standby modes. These methods are particularly effective in flip-flops, where gating at the master-slave latches avoids glitches without compromising timing integrity. Trends in radiation-hardened designs include redundancy encoding, such as dual interlocked cells, to detect and mitigate soft errors in flip-flops used in radiation-prone applications. Classical implementations remain dominant for such hardening techniques.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.