Docsity

State Machine Timing Analysis: Maximum Frequency and Propagation Delay, Exams of Digital Systems Design

Toggle sidebar
bg1
1 STATE MACHINE TIMING ANALYSIS
1.1 System Overview
So far we have analyzed state machines on a functional level. That is, we can determine the next state
given the present state and present inputs. Functional analysis however, assumes that the timing
requirements for the system have been met. If the timing requirements are not met, the circuit may not
function correctly or the interface between the circuit and the external system may fail.
Figure 1 is a block diagram of a typical synchronous sequential system. The state machine in the figure
is the circuit that we are designing. The source and destination blocks are external circuits that are
connected to the state machine.
Figure 1 System Level Block Diagram
When performing a timing analysis we are normally interested in finding the following parameters:
1) The maximum frequency of the system (or, verifying the setup and hold times at a given
frequency).
2) The propagation delay from input to output.
For a complete system-level timing analysis, we must know the characteristics of the circuits that are
connected to the state machine we are designing. Specifically, we need to be given the times when the
inputs from the source are valid and the times that the outputs are sampled by the destination circuit.
Figure 2 shows the typical timing diagram for the system. The system depicted has inputs that are
triggered on the rising-edge of the clock, the state machine is triggered on the rising-edge, and the
outputs are sampled at the rising-edge. tsd (source delay) is the delay time from the input clocking
SMTimingV3.doc, 11/02/08 1 ©Todd Morton
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download State Machine Timing Analysis: Maximum Frequency and Propagation Delay and more Exams Digital Systems Design in PDF only on Docsity!

1.1 System Overview

So far we have analyzed state machines on a functional level. That is, we can determine the next state given the present state and present inputs. Functional analysis however, assumes that the timing requirements for the system have been met. If the timing requirements are not met, the circuit may not function correctly or the interface between the circuit and the external system may fail.

Figure 1 is a block diagram of a typical synchronous sequential system. The state machine in the figure is the circuit that we are designing. The source and destination blocks are external circuits that are connected to the state machine.

Figure 1 System Level Block Diagram

When performing a timing analysis we are normally interested in finding the following parameters:

  1. The maximum frequency of the system (or, verifying the setup and hold times at a given frequency).

  2. The propagation delay from input to output.

For a complete system-level timing analysis, we must know the characteristics of the circuits that are connected to the state machine we are designing. Specifically, we need to be given the times when the inputs from the source are valid and the times that the outputs are sampled by the destination circuit.

Figure 2 shows the typical timing diagram for the system. The system depicted has inputs that are triggered on the rising-edge of the clock, the state machine is triggered on the rising-edge, and the outputs are sampled at the rising-edge. tsd (source delay) is the delay time from the input clocking

edge to valid inputs. These inputs must be valid before the state machine setup time, tsu. The state machine’s outputs change tco after the rising-edge of the clock. They must be valid before the setup

time of the sampling device, tosu.

Note that the output parameters are very similar to the input parameters. In fact, they are the same if we treat the output sampling device as the state machine. i.e. with respect to the output sampling device, tco is it’s tsd , and tosu is it’s tsu. Therefore, we will only cover timing for the interface between two systems – input-to-state machine or state machine-to-output.

Figure 2 System Level Timing

CLK

Inputs

Outputs

tsd

t (^) co tosu

tsu

For real system designs, full timing analysis is required. However, in this class, we will not always know what the characteristics of the external circuitry are so we will look at the following analysis:

  • The maximum frequency of the state machine itself
  • The maximum frequency of the system given the input and output timing
  • The propagation delay for the system
  • The sampling time required for meaningful test vectors.

Detailed State Machine Timing Parameters. Figure 3 shows the critical timing paths for a general state machine. Each timing block represents the longest delay – the critical path – for a given path.

Figure 3 Detailed State Machine Timing Parameters

t (^) dfb

t (^) di

t (^) dfo

t (^) dio

FFs

Inputs CLK

Outputs

t (^) su

Excitation Logic Output Logic

t (^) ffcq

The parameters shown are: tdfb - The critical path delay from any flip-flop output to any flip-flop input. tdi - The critical path delay from any input to any flip-flop input. tsu - The setup time for the flip-flops. tffcq - The clock-to- flip flop output propagation delay. tdfo - The critical path delay from any flip-flop output to a state machine output. tdio - The critical path from any input to any output (Mealy machines only).

Each one of the paths shown in Figure 3 can limit the maximum frequency of the state machine. Therefore, we have to calculate the maximum frequency for each path in order to find the worst case maximum frequency.

1.3 Maximum Frequency Due to Input Paths

There are two important parameters when evaluating the input timing – input to flip-flop setup time and the input change to flip-flop hold time.

The set-up time requirement determines a maximum frequency due to the input signals. To find the maximum frequency of the system due to the input signal timing you must know when the inputs are valid. The parameters required are the input clocking edge and the clock to input delay, tsd. The requirement that must be met is the state machine flip-flop setup time, tsu. Figure 5 shows the timing diagram for the input signals.

Figure 5 Input Critical Path. Neg. Edge to Neg. Edge

Figure 5 shows a system that has 'same-edge' triggering. That is, the controlling clock edge for the inputs is the same as the controlling clock edge for the state machine flip-flops. In this case, the controlling clock edge is the falling edge of CLK. For the setup times of the flip-flops to be met

clk

T

su

t di

t sd

t + + ≤

Therefore the maximum system frequency is

,min ,max ,max , min

max

Tclk tsd tdi t su

f

In addition, because the negative clock edge triggers the flip-flops, the input signals must not change before the minimum hold time of the flip-flop. This is rarely an issue, especially if the input is clocked by the same clock as the flip-flop and there is any input logic. However, for those rare times when there may be a violation, we must check the hold time specification. Assuming the input source is clocked on the same clock edge as the flip-flops:

, min ,min h , min

t di

t sd

t + ≥

1.4 Maximum Frequency Due to Output Sampling

To find the maximum frequency of the system due to the output signal timing, you treat the output circuit as the state machine and the state machine as the input source. Then it becomes the same analysis as timing for input signals in section 1.3.

1.5 State Machine Propagation Delay

The propagation delay from a state machine input to output for same-edge systems is t (^) pd = Tclk + tffcq + tfdo − t sd If the clock period for the maximum system frequency is substituted into the equations above, you get t (^) pd ,min= tdi + tsu + tffcq + t fdo This represents the smallest possible propagation delay for the system.

The propagation delay through a state machine is usually not the critical factor in the design. The critical factor is more likely to be the maximum system frequency. For example, a serial communications circuit must be able to convert the input bit stream at a high data rate (frequency) but it rarely matters how long it takes to complete a conversion. The propagation delay results in a phase delay for the bit stream and is not a problem as long as it is under some humanly perceptible delay (often referred to as latency ). Propagation delay becomes important when a complex function must be completed as fast as possible – an arithmetic logic unit, for example.

We will look at ways to decrease the overall propagation delay for a system with the clock frequency set far below the maximum state machine frequency in Section 1.7.

Example 1-2 A State Machine Timing Analysis (cont)

  1. To find the maximum frequency due to the inputs, we must find the critical input path for all flip- flop inputs:

J1: No delay K1: No input path J2: No input path K2: No delay

So, the worst case input delay, tdi , is 0ns and the resulting maximum frequency is:

MHz

T t t t ns ns ns

f

clk sd di su

,min

max =

The next step is to verify that the flip-flop hold times are met. Since the minimum source delay is not given, we will give a practical value of one-half the maximum source delay. The worst case for this analysis are the two inputs with no input delay, J1 and K2.

ns

t

t h ns sd 12. 5

,min =^3 ≤ =

So, the hold time requirement has been met.

  1. To find the maximum frequency that will result in correct test vectors from a simulator we need to make sure the outputs are valid before the next falling-edge. In this case, since this is a Moore machine, we do not need to test an input to output delay. So,

MHz

t t t t t ns ns ns

f

sd su ffcq dfo osu

max =

Based on these three calculations, the maximum frequency for the system is 13.3MHz.

Example 1-3 CPLD Timing Analysis

In this example, we will analyze the timing of a Xilinx XC2C256-7 CPLD. Refer to ‘CoolRunner-II CPLD Family’ and ‘XC2C256 CoolRunner-II CPLD’ datasheets.

  1. Find the maximum state machine frequency for any state machine implemented in the CPLD (Assuming single pass logic with a single P-Term, all internal feedbacks, and the CLK uses a GCK pin).
  2. Find the maximum frequency of the system shown below given same-edge triggering and an input source delay of 10ns.
  3. Find the maximum frequency for valid output samples from a simulator that samples on the same- edge.

Inputs (Source)

CPLD

CLK

Inputs Outputs

CLK

Inputs

tsd tsu

Tclk

Outputs

tco (^) t osu

Output (Sampler)

Solutions:

  1. To find the maximum state machine frequency, we must find the critical feedback path. Since the feedback paths inside the CPLD have the same timing characteristic in this case (single p-term), we use the maximum frequency due to internal feedback specification on the CPLD data sheet. This is also given as fSYSTEM in the CPLD data. For this device we get:

MHz

t t t t

f

COI F LOGI SUI

1

max =

Now we must verify that this frequency will not violate the minimum pulsewidths for the CPLD.

ns T ns

f MHz MHz

t w 3. 3 CW 1. 6

max

, min = = ≤ =

So, assuming a 50% duty cycle clock, the pulsewidth requirements are met.

1.6 Output Sampling

In this section we will look at the sample times required to produce meaningful test vectors. Here we will assume a same-edge system. That is, both input signals and FFs are triggered on the same clock edge.

Test Vector Sample Times

In order to have meaningful test vectors, a vector must represent a single state. For example, a vector that contains the present value of the state variables must contain the present value of the inputs and the present value of the outputs. If the samples are taken at the wrong time, you can end up with the next inputs on the same line as the present state, etc.

Figure 7 shows the timing for a state machine that has inputs and flip-flops clocked on the same-edge. n represents the ' nth ' state, n-1 is the previous state, and n+1 is the next state. For same-edge systems, the input and state changes are both controlled on the same edge, in this case, the falling edge of CLK. For Moore machines, the outputs are only a function of the present state. For Mealy machines, the outputs are a function of both the present state and the inputs. However, since the inputs and state variables change nominally at the same time, the output changes occur nominally at the same time for both Mealy and Moore outputs.

Figure 7 State Timing, Moore or Mealy, same-edge Triggering

CLK

Inputs

Qs

Outputs

n - 1

n - 1

n - 1

n

n

n

n + 1

n + 1

n + 1

To sample the signals for test vectors, either clock edge could be used but it is better to use the controlling edge, in this case the falling edge. If the falling edge is used, the outputs have a full clock cycle to change before a vector is sampled. If the state machine is running close to its maximum frequency, it is possible for the outputs not to become valid until after the rising-edge. If this happens, and the rising-edge is used for test vector samples, it is possible to sample the incorrect output even if the state machine is operating correctly.

1.7 Opposite-Edge and Multiple Phase Timing

As we will see in the following discussions, timing analysis for systems that have the inputs clocked on the opposite-edge as the flip-flops is more complicated. There are reasons, however, that we may need to use opposite clock edges or use multiple clocks that are out of phase. These reasons include:

Increasing hold times in systems with slow clocks and long signal paths. Systems with clocks that run much slower than the maximum frequency do not come close to violating the setup time for the flip-flops. The inputs are valid shortly after the controlling clock edge and, therefore, have a whole clock cycle to satisfy the setup time. If same-edge triggering is used, there is a danger of hold time violations due to clock skew because the inputs change almost immediately after the controlling edge. If opposite-edge triggering is used the inputs don't change for another half cycle so the input transitions are kept as far as possible from the flip-flop controlling edge. Communication systems normally use opposite-edge triggering because of the long signal paths and signal distortion. Note that systems like this should not use Mealy machines because of the transition times on the outputs.

Systems with a fixed clock but require a minimal propagation delay. Many systems have a fixed clock frequency determined by some other logic block in the system. It is expensive to add another oscillator and doing so could result in some asynchronous interfaces between system blocks. The propagation delay for opposite-edge systems is 1/2 that for same-edge systems. So as long as setup times are not violated, opposite-edge triggering can decrease the propagation delay through the circuit. Again, care must be taken for Mealy outputs, as they must be sampled on the flip-flop controlling edge.

Systems that use different clock phases have the same maximum state machine frequency. However, we do need to recalculate the maximum frequency due to inputs, the propagation delay, and determine when the outputs can be sampled.

Maximum Frequency Due to Inputs

Figure 8 shows a system with opposite-edge triggering. In this case, the inputs are triggered on the falling edge and the state machine is triggered on the rising edge. Note that we are assuming a 50% duty cycle clock.

Figure 8 Input Critical Path. Neg. Edge to Pos. Edge

CLK

Inputs

FFins

tsd

tdi tsu

Tclk/

The setup time requirements are:

T clk tsd + tdi + tsu ≤

Therefore the maximum system frequency is

max ,min 2 ( ,max ,max ,min)

Tclk tsd tdi t su

f

However, note the error that occurs if the vectors are sampled on the falling edge. The last two falling edges would result in vectors with:

Vector Inputs State Output [f1] n-1 n n [f2] n n+1 n+

These vectors, by themselves, would not be adequate to determine if the system is working correctly.

It is interesting to note that if the output (destination) circuit sampled this state machine's outputs on the rising or falling edge, the system would work correctly as long as the maximum frequency limits were not violated. The difference between the circuit sampling on one edge instead of the other would just result in a difference in phase.

This assumes that the output sampling circuit is not also a function of the inputs. Figure 10 shows a Mealy machine that uses opposite-edge triggering. In this case, the outputs are a function of both the inputs and the state so there are twice as many output transitions.

Figure 10 State Timing, Mealy Machine w/ opposite-edge Triggering

CLK

Inputs

Qs

Outputs

n - 1

n - 1

n - 1

n

n

n

n + 1

[r1] [f1] [r2] [f2]


The outputs for this system go through transition regions, *, where the inputs and the state variables are at different timing states. These regions represent the time after the state variables have reached the next state but before the inputs have changed to the next input. During these transition regions, the outputs are invalid. This means that the vectors must be sampled on the controlling edge for the state machine. Here are the resulting vectors if the falling (incorrect) edge of CLK is used.

Vector Inputs State Output [f1] n-1 n * [f2] n n+1 *

The vectors in this case can not be used to verify the operation of the state machine. In fact, this circuit has an additional requirement. Remember that the outputs for the opposite-edge Moore machine could be sampled by the destination circuit on either clock edge and the system would work. In this case, if the outputs where sampled on the opposite edge of CLK than the state machine controlling edge, the circuit would not work. Imagine that the n output is a one, but the output is zero on both transition regions next to n. If the output is sampled on the rising-edge, the circuit would see a one. If the output is sampled on the falling-edge, the one would be missed. The intended output would not be sampled. Therefore, if a Mealy machine is used with opposite-edge triggering, the vector samples and the destination circuit must sample the outputs on the clock edge that controls the state machine.