Salta al contenuto
Note per Studenti Timing of Sequential Systems - Setup, Hold and Maximum Clock Frequency Report

Timing of Sequential Systems - Setup, Hold and Maximum Clock Frequency

In questa pagina 5

Until now flip-flops were treated as ideal elements that update instantly on the clock edge. In real circuits, storing the correct value requires timing constraints, which also fix the maximum speed of the system. They are electrical parameters (they depend on technology, temperature and supply voltage), not logical ones.

The three flip-flop parameters

Definition (setup, hold and propagation time). Consider a positive-edge-triggered D flip-flop (Sequential Systems - State, Latches and Flip-FlopsA sequential circuit has outputs that depend on the inputs and on the state held in memory elements; it is a combinational network with flip-flops in a feedback loop, where present state is the flip-flop outputs and next state is their inputs. Synchronous circuits update only on the clock edge. The SR latch (NOR) sets, resets, holds, and forbids S=R=1; the D latch is transparent while C=1; the edge-triggered D flip-flop is two D latches in cascade (master-slave) and samples D only on the active clock edge, with Q(t+1)=D(t).Sequential Systems - State, Latches and Flip-Flops →) with input DD and rising clock edge at tclkt_{clk}.

  • Setup time tst_s: minimum time the input must be stable BEFORE the clock edge. If DD changes too late, the master latch output may be at an intermediate voltage when it is passed to the slave, and the stored value is unreliable.
  • Hold time tht_h: minimum time the input must stay stable AFTER the clock edge. If DD changes too soon the master may still be transparent and pass the change to the slave.
  • Propagation time tpd,FFt_{pd,FF}: delay between the triggering clock edge and the instant the output starts to switch (tp,min⁡t_{p,\min}) or has settled (tp,max⁡t_{p,\max}).

The stability window of the data is [ tclk−ts, tclk+th ][\,t_{clk}-t_s,\ t_{clk}+t_h\,]; the output QQ is valid after tclk+tpd,FFt_{clk}+t_{pd,FF}.

Example. With ts=0.2t_s=0.2 ns, th=0.1t_h=0.1 ns and edge at tclk=10t_{clk}=10 ns, DD must not change in [9.8; 10.1][9.8;\,10.1] ns.

Setup constraint and maximum frequency

The delay from one clock edge to the next has three components:

  1. the flip-flops change their outputs after tpd,FFt_{pd,FF} from the edge;
  2. the outputs reach the combinational network, which computes outputs and next state in time tCOMBt_{COMB} (the slowest path, the critical path);
  3. the next-state values reach the FF inputs and must be stable for ts,FFt_{s,FF} before the next edge.

Formula (minimum clock period). Adding a safety margin tslackt_{slack}: T ≥ tpd,FF+tCOMB+ts,FF+tslack,fmax=1Tmin.T\ \ge\ t_{pd,FF}+t_{COMB}+t_{s,FF}+t_{slack},\qquad f_{max}=\frac1{T_{min}} .

Example. tpd,FF=0.5t_{pd,FF}=0.5 ns, tCOMB=2.3t_{COMB}=2.3 ns, ts,FF=0.2t_{s,FF}=0.2 ns. Without margin Tmin=3.0T_{min}=3.0 ns, fmax=333f_{max}=333 MHz. With tslack=0.3t_{slack}=0.3 ns: Tmin=3.3T_{min}=3.3 ns, fmax=303f_{max}=303 MHz.

Consequences.

Hold constraint

Formula (hold constraint). Output changes of a flip-flop must not reach another flip-flop (or itself) too early. With the minimum delays of flip-flop and network: tpd,FF,min⁡+tCOMB,min⁡ ≥ th.t_{pd,FF,\min}+t_{COMB,\min}\ \ge\ t_h .

This is a correctness requirement independent of the clock frequency: the edge and the new output are both tied to the same edge, so slowing the clock does not help. If violated, add delay to the short paths (buffers).

Example. tpd,FF,min⁡=0.1t_{pd,FF,\min}=0.1 ns, tCOMB,min⁡=0.05t_{COMB,\min}=0.05 ns, th=0.3t_h=0.3 ns: 0.15<0.30.15<0.3, a violation of 0.150.15 ns. Lowering the frequency does not cure it; at least 0.150.15 ns of extra delay is needed on the shortest path.

Clock skew

The clock edge may reach different flip-flops at slightly different times because of delays in the clock distribution tree (clock skew); setup and hold constraints are modified accordingly. Gates inserted in the clock path (clock gating, see Registers and Load ControlAn n-bit register is n flip-flops with a common clock, and a counter is a register that steps through a sequence of states. Loading can be controlled by clock gating (an OR with the clock, which saves power but adds delays and clock skew) or, preferably, by load enable (a 2-to-1 MUX before each D input selecting the new data or the flip-flop's own output). Complex systems are split into a datapath (registers and arithmetic-logic blocks) and a control unit (an FSM that sends control signals and receives status signals).Registers and Load Control →) add delay and therefore skew, which is why register loading with a load enable is preferable to clock gating.

Timing in simulation

To simulate a synchronous circuit correctly:

  • apply inputs well before the active edge (for instance on the falling edge of the clock for PET FFs), so the combinational network can settle;
  • the clock period must be sufficient (worst-case network delay well below the period);
  • read results when state and outputs are stationary (for instance just before the next rising edge).

Simulation can be functional (ideal elements, zero delay) or timing (realistic delays); see VHDL - Finite State Machines and Sequential TestbenchesA finite state machine is described in behavioral VHDL with an enumerated type for the states and three processes: the state register (reset and state <= next_state on the clock edge), the next state as a combinational function of state and input (case state, with default next_state <= state), and the output as a combinational function of the state alone (Moore) or of state and input (Mealy). The testbench has a clock process and an input process (initial reset, then a test sequence that visits all states).VHDL - Finite State Machines and Sequential Testbenches →.

Versione ripasso

Teoria collegata