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 and rising clock edge at .
- Setup time : minimum time the input must be stable BEFORE the clock edge. If 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 : minimum time the input must stay stable AFTER the clock edge. If changes too soon the master may still be transparent and pass the change to the slave.
- Propagation time : delay between the triggering clock edge and the instant the output starts to switch () or has settled ().
The stability window of the data is ; the output is valid after .
Example. With ns, ns and edge at ns, must not change in ns.
Setup constraint and maximum frequency
The delay from one clock edge to the next has three components:
- the flip-flops change their outputs after from the edge;
- the outputs reach the combinational network, which computes outputs and next state in time (the slowest path, the critical path);
- the next-state values reach the FF inputs and must be stable for before the next edge.
Formula (minimum clock period). Adding a safety margin :
Example. ns, ns, ns. Without margin ns, MHz. With ns: ns, MHz.
Consequences.
- The setup time limits the maximum clock frequency (not the minimum).
- A setup violation is fixed by increasing the period, i.e. lowering the clock frequency, or by shortening the combinational path.
- The combinational delay that matters is the worst case (slowest gate or path). Gate propagation delays and their effect on speed are discussed in Implementation Technologies - CMOS Gates and Technology ParametersIn CMOS integrated circuits MOSFETs behave as switches: an nMOS conducts when its gate is 1, a pMOS when its gate is 0. A static gate has a pull-up network (only pMOS, to Vdd) and a dual pull-down network (only nMOS, to ground), exactly one of which is on. NAND has series nMOS and parallel pMOS, NOR the opposite; an n-input NAND or NOR has 2n transistors. Technology parameters are fan-in, fan-out, noise margin, propagation delay (limits clock frequency), power dissipation and cost (silicon area, NRE and production costs).Implementation Technologies - CMOS Gates and Technology Parameters →.
- is a property of the flip-flop; what depends on the logic upstream is the available margin.
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:
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. ns, ns, ns: , a violation of ns. Lowering the frequency does not cure it; at least 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
- Stability window: fixed in ; valid after . With , , edge at 10 ns: ns.
- Setup : stable before the edge, else the master may sit at an intermediate level. Hold : stable after the edge, else the master, still transparent, passes the change. : edge to start () or end () of switching.
- Period: , ; ns (333 MHz), with ns: ns (303 MHz). Use worst-case delays. Setup limits the maximum frequency; fix by slowing the clock or shortening the path.
- Hold: , minimum delays, independent of frequency; slowing the clock does not help, add delay (buffers). Example: , short by ns.
- Skew: clock arrives at different times; gating adds skew, so prefer load enable (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 →).
- Simulation: PET inputs on the falling edge, read before the rising edge; functional (zero delay) vs timing (real delays).
- Mistakes: setup limiting the minimum frequency; slowing the clock to cure hold; maximum delays for hold or minimum for setup; swapping setup and hold; leaving out of the path.