Clock latency



Definition of clock latency (clock insertion delay): In sequential designs, each timing path is triggered by a clock signal that originates from a source. The flops being triggered by the clock signal are known as sinks for the clock. In general, clock latency (or clock insertion delay) is defined as the amount of time taken by the clock signal in traveling from its source to the sinks. Clock latency comprises of two components - clock source latency and clock network latency.
  • Source latency of clock (Source insertion delay): Source latency is defined as the time taken by the clock signal in traversing from clock source (may be PLL, oscillator or some other source) to the clock definition point. It is also known as source insertion delay. It can be used to model off-chip clock latency when clock source is not part of the chip itself. 

  • Network latency of clock (Network insertion delay): Network latency is defined as the time taken by the clock signal in traversing from clock definition point to the sinks of the clock. Thus, each sink of the clock has a different network latency. If we talk about the clock, it will have:
    • Maximum network latency: Maximum of all the network latencies
    • Minimum network latency: Minimum of all the network latencies
    • Average network latency: Average of all the network latencies

Total clock latency is given as the sum of source latency and network latency. In other words, total clock latency at a point is given as follows:

       Clock latency = Source latency + Network latency

It is generally stated that for a robust clock tree, ‘sum of source latency and network latency for all sinks of a clock should be equal’. If that is the case, the clock tree is said to be balanced as this means that all the registers are getting clock at the same time; i.e., clock skew is zero.

Source latency is the latency upto the point at which the clock is defined. Network latency is the time taken by clock from its root to the sink.

Figure 1 : Figure showing source latency and network latency components of clock latency

Figure 1 above shows the two components of clock latency, i.e. source latency and network latency. Each flop (sink, in general) has its own latency since the path traced by clock from source to it may be different. The above case may be found in block level constraints in case of hierarchical designs wherein clock source is sitting outside the block and clock signal enters the block through a block port. It may also represent a case of a chip in which the clock source is sitting outside; e.g. some external device is controlling the chip. In that case, clock source will be sitting inside that device.

How to specify clock latency: In EDA tools, we can model clock latency using SDC command ‘set_clock_latency’ to imitate the behavior there will be after clock tree will be built. Using this command, we can specify both the source latency for a clock as well as the network latency. After clock tree has been built, the latency for the sinks is calculated by the tool itself from the delays of various elements. However, in case the clock source is sitting outside, it still needs to be modeled by source latency even after the clock tree synthesis. To specify clock latency for clock signal named ‘CLK’, we may use SDC command set_clock_latency:

                set_clock_latency <value> CLK
                set_clock_latency <value> CLK –source

First command will specify the network latency whereas the second command will specify the source latency for CLK.

Also read:
Hope you liked this post. Let us know of your views through comments.

Scan chains – the backbone of DFT



What are scan chains: Scan chains are the elements in scan-based designs that are used to shift-in and shift-out test data. A scan chain is formed by a number of flops connected back to back in a chain with the output of one flop connected to another. The input of first flop is connected to the input pin of the chip (called scan-in) from where scan data is fed. The output of the last flop is connected to the output pin of the chip (called scan-out) which is used to take the shifted data out. The figure below shows a scan chain.

A scan chain contains a chain of flops with output of one flop connected directly to input of another flop. Input of first flop is driven directly by input port and output of last flop in the chain is connected directly to output port
A scan chain


Purpose of scan chains: As said above, scan chains are inserted into designs to shift the test data into the chip and out of the chip. This is done in order to make every point in the chip controllable and observable as discussed below.

How normal flop is transformed into a scan flop: The flops in the design have to be modified in order to be put in the scan chains. To do so, the normal input (D) of the flip-flop has to be multiplexed with the scan input. A signal called scan-enable is used to control which input will propagate to the output.

A normal flop transitions to a scan flop by connecting a mux that choses between functional input and scan input depending upon the enable pin that determines if scan input will be propagated to the output of the flop
Figure showing transition of a normal flop to scan flop
  
If scan-enable = 0, data at D pin of the flop will propagate to Q at the next active edge
If scan-enable= 1, data present at scan-in input will propagate to Q at the next active edge

Scan terminology: Before we talk further, it will be useful to know some signals used in scan chains which are as follows:
  • Scan-in: Input to the flop/scan-chain that is used to provide scan data into it 
  • Scan-out: Output from flop/scan-chain that provides the scanned data to the next flop/output 
  • Scan-enable: Input to the flop that controls whether scan_in data or functional data will propagate to output

    Purpose of testing using scan: Scan testing is carried out for various reasons, two most prominent of them are: 
  •  To test stuck-at faults in manufactured devices 
  •  To test the paths in the manufactured devices for delay; i.e. to test whether each path is working at functional frequency or not
How a scan chain functions: The fundamental goal of scan chains is to make each node in the circuit controllable and observable through limited number of patterns by providing a bypass path to each flip-flop. Basically, it follows these steps: 
  1.  Assert scan_enable (make it high) so as to enable (SI -> Q) path for each flop 
  2.  Keep shifting in the scan data until the intended values at intended nodes are reached 
  3.  De-assert scan_enable (for one pulse of clock in case of stuck-at testing and two or more cycles in case of transition testing) to enable D->Q path so that the combinational cloud output can be captured at the next clock edge. 
  4.  Again assert scan_enable and shift out the data through scan_out

How Chain length is decided: By chain length, we mean the number of flip-flops in a single scan chain. Larger the chain length, more the number of cycles required to shift the data in and out. However, considering the number of flops remains same, smaller chain length means more number of input/output ports is needed as scan_in and scan_out ports. As 

                Number of ports required = 2 X Number of scan chains

Since for each scan chain, scan_in and scan_out port is needed. Also,

               Number of cycles required to run a pattern = Length of largest scan chain in design

Suppose, there are 10000 flops in the design and there are 6 ports available as input/output. This means we can make (6/2=) 3 chains. If we make scan chains of 9000, 100 and 900 flops, it will be inefficient as 9000 cycles will be required to shift the data in and out. We need to distribute flops in scan chains almost equally. If we make chain lengths as 3300, 3400 and 3300, the number of cycles required is 3400.

Keeping almost equal number of flops in each scan chain is referred to as chain balancing.


Also read: