Difference Between Latch and Flip Flop

Thus, there is an opening window for data sampling when the clock goes low and a closing window when the clock goes high. Now let us add the considerations for setup and hold time into this. Since the circuit elements take a finite time to sample a data in, hence for hold time, the timing requirement is limited with the closing of the latch window (shown in blue in figure 4). This requirement is the same as that in case of a positive edge triggered flip-flop and hence the same setup can be used to measure the hold time. For the case of setup timing, there are two scenarios; setup timing at the opening window and setup timing at the closing window.

The number of arcs required to model can vary within the sequential elements. In this paper we will be discussing about the methodology to find the setup time, hold time or C-Q delay of flip-flops and latches.

There is always a region around the clock edge in which input data should not change at the input of the flip-flop. This is because, if the data changes within this window, we cannot guarantee the output. The output can be the result of either of the previous input, the new input or metastability (as explained in our post ‘metastability’). This window is marked by two boundary lines, one pertaining to the setup time of the flop, the other to the hold time defined as below. If hold slack is positive, it means there is still some margin available before it will start violating for hold.

A negative hold slack means the path is violating hold timing check by the amount represented by hold slack. To get the path met, either data path delay should be increased, or clock skew/hold requirement of capturing flop should be decreased. As we know from the definition of setup time, setup time is a point on time axis which restrains data from changing after it. Data can change only before occurrence of setup timing point. Theoretically, there is no constraint on occurrence of setup time point with respect to clock active edge.

Setup time and hold time basics

So, if both data and clock reach the reference point at the same time, the latch has a setup time of 2 ns. The Q output always takes on the state of the D input at the moment of a rising clock edge.

(or falling edge if the clock input is active low) It is called the D flip-flop for this reason, since the output takes the value of the D input or Data input, and Delays it by one clock count. The D flip-flop can be interpreted as a primitive memory cell, zero-order hold, or delay line. A latch is an example of a bistable multivibrator, that is, a device with exactly two stable states. A latch has a feedback path, so information can be retained by the device.

There are two types of violation that can be caused by clock skew. One problem is caused when the clock travels slower than the data path from one register to another – allowing data to penetrate two registers in the same clock tick, or maybe destroying the integrity of the latched data. This is called a hold violation because the previous data is not held long enough at the destination flip-flop to be properly clocked through. Another problem is caused if the destination flip-flop receives the clock tick earlier than the source flip-flop – the data signal has that much less time to reach the destination flip-flop before the next clock tick.

In this linear program, zero clock skew is merely a feasible point – the solution to the linear program generally gives a clock period that is less than what is achieved by zero skew. In addition, safety margins greater than or equal to the zero skew case can be guaranteed by setting setup and hold times and jitter bound appropriately in the linear program.

In case of a latch, we need to understand the opening and closing windows for data sampling instead of just a simple edge. Let us consider the timing in a negative level triggered latch as shown in figure 4. The latch will remain transparent in case of a low clock signal while the state will be latched otherwise.

A D-type flip-flop is realized using two D-type latches; one of them is positive level-sensitive, the other is negative level-sensitive. A D-type latch, in turn, is realized using transmission gates and inverters. Figure below shows a positive-level sensitive D-type latch. Just inverting the transmission gates’ clock, we get negative-level sensitive D-type latch.

Positive skew and negative skew cannot negatively impact setup and hold timing constraints respectively (see inequalities below). So far all the analysis discussed above has been with a flip-flop or an edge triggered element as a reference. While the definition of setup/hold time and C-Q delay remain same for latches as well, however with the latches being level triggered devices instead of edge triggered, the concept to extract the timing parameters of latch are a bit more tricky.

setup time definition
  • This is called a hold violation because the previous data is not held long enough at the destination flip-flop to be properly clocked through.
  • One problem is caused when the clock travels slower than the data path from one register to another – allowing data to penetrate two registers in the same clock tick, or maybe destroying the integrity of the latched data.
  • There are two types of violation that can be caused by clock skew.

It can either be before, after or at the same time as that of clock edge. Depending upon the relative occurrence of setup time point and clock active edge, setup time is said to be positive, zero or negative. With combinational element concerned only with the propagation delay of the cell, the sequential element are bit more complex in this scenario. With different arcs it is necessary to model setup time, hold time and c-q delay of a flop while modeling it into the library.

“Examples Of Setup and Hold time” : Static Timing Analysis (STA) basic (Part 3c)

Min pulse width is defined as the minimum permissible pulse width values for both high and low levels below which a given sequential element like flip-flop, latch or SRAM cell will fail to work. It signifies the minimum time these cells will take to function and provide the correct output while being operated. Figure 3, shows how high and low min pulse width requirements can be modeled based on flop/latch setup and time.

If setup slack is positive, it means there is still some margin available in the timing path. On the other hand, a negative slack means that the paths violates setup timing check by the amount of setup slack. To get the path met, either data delay should be decreased or clock period should be increased. discuss the origin of setup time and hold time taking an example of D-flip-flop as in VLSI designs, D-type flip-flops are almost always used.

The operation of most digital circuits is synchronized by a periodic signal known as a “clock” that dictates the sequence and pacing of the devices on the circuit. This clock is distributed from a single source to all the memory elements of the circuit, which for example could be registers or flip-flops. Ideally, the input to each memory element reaches its final value in time for the next clock tick so that the behavior of the whole circuit can be predicted exactly. The maximum speed at which a system can run must account for the variance that occurs between the various elements of a circuit due to differences in physical composition, temperature, and path length. In digital designs, each and every flip-flop has some restrictions related to the data with respect to the clock in the form of windows in which data can change or not.

Why setup and hold time are required?

The setup time is the interval before the clock where the data must be held stable. The hold time is the interval after the clock where the data must be held stable. Hold time can be negative, which means the data can change slightly before the clock edge and still be properly captured.

The reason for this check is that unlike a flop, the latch output is not a fixed value during a static clock level. For example, when clock is low, the flop output remains a constant value from the previously captured data, while in case of a negative latch; the output is same as the input data at that instance. Hence, we have a burrow margin which can be given to data path connected at the output of latch, provided we have ensured correct setup timing with the same setup time as at the closing window near the opening edge as shown in figure 3.

Data launches on one rising edge, so it must setup before next rising edge. Timings analysis is more appropriate with flops for FPGA toolsCircuit analysis is complex.

What is the difference between setup time and hold time?

Setup time is defined as the minimum amount of time before the clock’s active edge that the data must be stable for it to be latched correctly. Hold time is defined as the minimum amount of time after the clock’s active edge during which data must be stable.

Delay Characterization for Sequential Cell

The min pulse width requirements as discussed in the previous section are a derivative of setup and hold time itself and hence will be implicitly covered. With prior knowledge of delay characterization for combinational standard cells, where the delay values are dependent on the input slew and the output load, one needs to take in account of the propagation delay in picture. The scenario gets a bit complex when it comes to sequential elements. Modeling setup time, hold time, C-Q delay and various other factors add more complexity to the characterization to sequential elements. This paper discusses the models and methodology that are used commonly for characterizing the timing parameters of various sequential logic cells which are key elements of synchronous design.

If it fails to do so, a setup violation occurs, so-called because the new data was not set up and stable before the next clock tick arrived. A hold violation is more serious than a setup violation because it cannot be fixed by increasing the clock period.

Now, if there is further difference between delays of data and clock from respective reference points to input transmission gate, the hold time will become negative. For example, if data takes 3 ns less than clock to reach input transmission gate, setup time will be -1 ns. Then, to ensure that the data has reached NodeD when clock edge arrives at input transmission gate, data has to be available at the input transmission gate at least 2 ns before.