Google+ VLSI QnA: Setup slack
Showing posts with label Setup slack. Show all posts
Showing posts with label Setup slack. Show all posts

Saturday, 26 April 2014

Clock Skew

Clock skew

The operation of most digital circuit systems, such as computer systems, is synchronized by a "clock" that dictates the sequence and pacing of the devices on the circuit. Ideally, the input to each element has reached its final value before the next clock movement occurs so that the behaviour 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 circuit designs, clock skew (sometimes timing skew) is a phenomenon in synchronous circuits in which the clock signal (sent from the clock circuit) arrives at different components at different times. Clock skew can be positive or negative. If the clock signals are in complete synchronicity, then the clock skew observed at the registers is zero.

Reasons for clock skew:

This can be caused by many different things, such as wire-interconnect length, temperature variations, variation in intermediate devices, capacitive coupling, material imperfections, and differences in input capacitance on the clock inputs of devices using the clock. As the clock rate of a circuit increases, timing becomes more critical and less variation can be tolerated if the circuit is to function properly.

Two types of skews are defined: Local skew and Global skew.

Local skew

Local skew is the difference in the arrival of clock signal at the clock pin of related flops.

Global skew

Global skew is the difference in the arrival of clock signal at the clock pin of non related flops. This is also defined as the difference between shortest clock path delay and longest clock path delay reaching two sequential elements.

Why clock skew is a problem?

Two types of violation can be caused by clock skew. One problem is caused when the clock travels slower than the 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. If it fails to do so, a setup violation occurs, 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.

Positive Skew
When the source flop is clocked first than the destination flop, the clock skew is called as positive skew.

Positive skew diagram

From the below waveform, we can see that the hold slack reduces, when there is a positive skew. Hence, we can infer that the positive skew increases the chances of hold violation.

Positive skew waveform

Negative Skew
When the destination is clocked before the source, the clock skew is called as negative skew.

From the waveform below, we can see that the setup slack decreases in case of negative skew. So, the negative skew increases the chances of setup violation.

Negative skew

Uncertainty
Clock uncertainty is the time difference between the arrivals of clock signals at registers in one clock domain or between domains.

ALSO READ : Clock Jiiter

Setup and Hold time for flip flops - Part 2

This post is in continuation to our previous post on Setup and Hold time for flip flops.

Q.1) Calculate the setup slack for the below example :


Setup slack example

         tclk-q = 300ps ; tsetup = 100ps ; tcombo = 400ps ; tclk = 1000ps

Answer) 
Setup slack solution

                From the above waveform, we can derive the following equation :

                  tclk = tclk-q + tcombo + tsetupsetup-slack
                  So, setup-slack = tclk – tclk-q – tcombo  - tsetup
                  Hence, setup-slack = 1000 – 300 – 400 -200
                                          = 100ps

Q.2) Calculate the minimum clock cycle time, for the above example.

Answer) For the minimum clock cycle time, the setup slack is zero.
              Hence,  tclk = tclk-q + tcombo + tsetup + setup-slack becomes,
                      tclk (min.) = tclk-q + tcombo + tsetup
                      tclk (min.) = 300 + 400 + 200
                      tclk (min.) = 900ps 


Path delay



Q.3) Calculate the hold slack for the above example. (thold = 100ps)

Answer) 
Hold slack

                From the above waveform, the equation for the hold slack comes as :
                                    hold-slack = tclk-q + tcombo – thold
                             hold-slack = 300 + 400 – 100
                                          = 600ps

Q.4) Explain the  worst case hold time scenario.

Answer) The following equation is an analysis of worst case hold time scenarios. In this case, two FFs are directly connected to each other, i.e. there is no combo delay.

Worst case hold time

As depicted in the diagram, output Q0 of FF0 is directly connected to D1 of FF1.
Since, for worst case :  tcombo = 0
So the equation becomes,
                                    hold-slack = tclk-q – thold
Since, hold-slack > 0 , as to avoid hold violation.
                                    tclk-q – thold > 0
                                    tclk-q thold
                             hold-slack = tclk-q + tcombo – thold       

Worst case hold analysis

For Verilog timing tasks related to setup and timing checks,  please go through this link.

Thursday, 24 April 2014

Setup and Hold time for flip flops

The most frequently asked question in the interview is regarding the timing of flops. Generally the questions asked are based on calculation of minimum time cycle (max. frequency), setup slack and hold slack. 

Consider a D –type edge-triggered, Flip Flop (FF). The time just before and just after the clock edge, is the critical time, where the D input must not change.

Region just before the clock is setup time (tsetup).
Region after the clock edge is hold time (thold).

Every flip flop has minimum required values for tsetup and thold. The values of tsetup and thold vary strongly with temperature, voltage and process.

What happens to Q if D input changes within the tsetup and thold window?
  • Q may follow D correctly.
  • Q may follow D incorrectly.
  • Q may assume a metastable state for an indeterminate time followed by a transition to logic 1 or logic 0.

For correct operation, D inputs must be stable for tsetup prior to clock and stay stable for a thold afterwards.

Basic timing analysis circuit


Minimum Cycle Time:
Time taken by data to travel from one flop to another flop. Path between two flops is composed of :
  • Clock to Q delay (tclk-q).
  • Propogation delay through the combo logic. (tcombo).
  • The required setup time (tsetup) of FF1.

Path delay
  
        tmin  = tclk-q + tcombo + tsetup 

fmax = 1/tmin
Setup Slack:
The setup time is a function of the clock period, combo delay and the clk-to-output delay.

Actual tsetup = tclk – tclk-q - tcombo

As said earlier, each flop has a minimum specified tsetup.
The difference between the actual setup time and the minimum required setup time is known as setup slack.


Setup Slack = Actual tsetup – Reqd. tsetup

Setup slack

A positive slack is always desirable. 
For maximum frequency, the setup slack is zero.

Hold Time:
Hold time is the amount of time that FF0’s old data must persist at the D input of FF1, i.e. D1 after the clock edge.

Actual hold time = tclk-q + tcombo.

Each flop has a minimum specified tholdThe difference between the actual hold time and the minimum required hold time is known as hold slack.

Hold slack = Actual hold time – Reqd. thold 

Hold slack

For examples, please visit Setup and Hold time for flip flops - Part 2
For Verilog timing tasks related to setup and timing checks,  please go through this link.