GLOBAL KNOWLEDGE ARK

Electronics · Integrated circuits and programmable hardware

Constrain timing and verify programmable hardware

A counter can produce every expected value in an ideal functional trace while a physical implementation changes data too early. Setup and hold ask different questions, and a constraint set must describe more than a clock period. Use both the intended state rule and an explicit timing contract.

Lesson preparation and course links

Use the preceding complete enabled-counter HDL/testbench and retained digital timing foundation. Edge selection, clock-to-Q, skew, residual uncertainty, min/max interface contracts and all arithmetic are developed here. No timing engine, FPGA purchase or implementation is required for the complete supplied-evidence route.

Back to the Electronics chapter

After reading, you can

Declare a clock and complete min/max interface assumptions, reconstruct setup and same-edge hold margins, and use the preceding actual testbench plus an intentionally wrong expectation. Distinguish logical checking, synthetic timing bounds and actual constrained implementation evidence.

01

Use the same circuit and declare every interface

Use enabled_counter and the complete tb_enabled_counter from the preceding HDL lesson in this prepared series. The only clock is clk; rst/en are synchronous data inputs, and count[0], count[1], pulse are data outputs. For the analytical timing contract, choose a relative root-edge epoch at 0 ns with a 10 ns period and falling edge at 5 ns. That numerical origin is independent of the testbench’s absolute simulation schedule.

The state rule remains: reset at a rising edge gives count/pulse 0/0; otherwise enable increments two-bit count modulo four and pulse tests old count 3. Disable holds count and clears pulse. The functional negative case and the timing failure below concern this same supplied design.

The interface contract supplies rst/en arrival bounds 0.5…2.0 ns relative to the clock at the device interface. Output receivers require setup 2.0 ns and hold 0.2 ns. For this exercise only, board data delay and relative board clock skew are zero.

SDC and XDC are tool timing-constraint formats; the values here are a declarative teaching contract. Under those output assumptions, SDC-like requirements are output max +2.0 ns and min −0.2 ns. The negative minimum is a receiver requirement expressed with the tool’s sign convention, not a negative physical propagation delay. This declarative contract is not executed XDC/SDC or a completed board constraint set.

Port-level teaching contract; both ends and both delay directions matter
ObjectDeclared relationshipLimit
clkOnly primary clock10 ns period; relative rising 0 / falling 5 ns
rst,enExternal synchronous sender relative to clkArrival min 0.5 / max 2.0 ns
count[0],count[1],pulseExternal receiver, same interface clockReceiver setup 2.0 / hold 0.2 ns
Board relationshipIdealised for this exampleData delay 0 / relative clock skew 0
Output constraint conventionRequirements, not measured arrivalsMax +2.0 / min −0.2 ns
02

Identify the edges and hypothetical path bounds

Select an illustrative register-to-register relationship from count[0] launch-register output Q to pulse capture-register input D. It is related to the supplied logic but is not a real synthesized path, netlist, routed report or device speed claim. Every delay below is a hypothetical input to the arithmetic.

Let L=1.0 ns be launch-clock latency and C=1.5 ns capture-clock latency from the same root edge; skew k=C−L=+0.5 ns. Clock-to-Q bounds tCQmax/min describe the latest/earliest new source-register data. Data-path bounds dmax/min then carry it to capture D.

Setup requires stable data before capture; hold requires old data to remain stable after capture. The supplied residual guards Usetup=0.2 ns and Uhold=0.1 ns already follow the model’s shared-clock correlation/cancellation assumptions. They are not two independent copies of one source’s jitter, and a generic tool uncertainty command need not reproduce them.

Internal-path arithmetic inputs, all ns; no timing engine supplied them
ParameterValueMeaning
T10Next root rising edge
L / C1.0 /1.5Local launch/capture clock latencies
k=C−L+0.5Destination-minus-source skew
tCQmax / tCQmin0.8 /0.15Latest/earliest clock-to-Q
dmax / dmin5.7 /0.1Latest/earliest data-path delay
tsetup / thold0.7 /0.2Capture-register stability intervals
Usetup / Uhold0.2 /0.1Declared residual timing guards
03

Setup compares latest data with the next capture edge

Latest new-data arrival at capture D is L+tCQmax+dmax=1.0+0.8+5.7=7.5 ns. For setup, use the next root edge at T=10 ns, whose capture clock arrives at T+C=11.5 ns.

Subtract setup and residual guard: required latest arrival=T+C−tsetup−Usetup=10+1.5−0.7−0.2=10.6 ns. Setup slack is required−arrival=10.6−7.5=+3.1 ns in this model.

Equivalently Ssetup=T+k−tCQmax−dmax−tsetup−Usetup. Positive destination skew gives this next-edge setup check more time. The positive slack says this one maximum-delay comparison passes the supplied bounds; it does not establish every path or constraint.

04

Hold compares earliest new data with the same root edge

For same-root-edge hold, the capture clock arrives at C=1.5 ns, not 11.5 ns. Old data must survive through C+thold+Uhold=1.5+0.2+0.1=1.8 ns.

Earliest new-data arrival=L+tCQmin+dmin=1.0+0.15+0.1=1.25 ns. Hold slack is arrival−required=1.25−1.8=−0.55 ns: new data may change before the old value is required to remain stable.

Equivalently Shold=tCQmin+dmin−k−thold−Uhold. Positive capture skew has the opposite effect here: it moves the required old-data stability later, reducing hold margin. A zero-delay functional trace does not model this physical aperture or routed bounds.

05

Recheck both bounds after changing frequency or delay

Changing only period to 20 ns moves the next setup capture edge: required latest arrival becomes 20.6 ns and setup slack +13.1 ns. It does not move the declared same-root-edge hold relationship, so hold remains −0.55 ns. That conclusion depends on retaining the same edges, phases, latencies and topology.

Instead, a hypothetical physical change adds at least 0.6 ns and at most 0.8 ns to the data path. New dmin=0.7 ns and dmax=6.5 ns. Earliest arrival 1.85 ns gives hold +0.05 ns; latest arrival 8.3 ns gives setup +2.3 ns at T=10 ns.

The positive margins qualify only this synthetic bound comparison. A register-transfer-level (RTL) source-code # delay is not a manufactured timing repair. A real change must be implemented and all affected min/max paths/corners and signal effects checked again.

Original setup alone requires T≥6.9 ns, while the modified setup-only inequality requires T≥7.7 ns. Neither is an overall operating-frequency guarantee: the original hold failure and all unqualified paths/interfaces still matter. The plot uses separate vertical scales to show both margins clearly.

Compare the three supplied path cases; values ns, not a routed timing report
CaseTdmin / dmaxSetup slackSame-edge hold slack
Original100.1 /5.7+3.10−0.55
Lower frequency only200.1 /5.7+13.10−0.55
Modelled physical delay added100.7 /6.5+2.30+0.05
A slower clock does not fix this declared same-edge hold failureThree hypothetical path cases compare setup and hold using separate vertical scales. Original ten nanosecond period gives setup plus three-point-one and hold minus zero-point-five-five nanoseconds. Changing only period to twenty gives setup plus thirteen-point-one while hold stays minus zero-point-five-five. Adding declared physical minimum and maximum data delay instead gives setup plus two-point-three and hold plus zero-point-zero-five. These are supplied arithmetic bounds, not a static timing report, routed design or measured FPGA. image/svg+xml Ark original declared min/max timing-margin comparison with Matplotlib Original 10 ns period Period only changed to 20 ns Modelled physical data delay added 0 5 10 15 Slack (ns) +3.10 +13.10 +2.30 Next-edge setup slack (maximum data delay) Original 10 ns period Period only changed to 20 ns Modelled physical data delay added −0.6 −0.4 −0.2 0.0 Slack (ns) -0.55 -0.55 +0.05 Same-root-edge hold slack (minimum data delay) Both minimum and maximum data-path bounds matter Separate vertical scales. Lower frequency changes this next-edge setup check, not the same-edge hold relation. Supplied delay bounds and arithmetic • no netlist, timing engine, routing or hardware result
Three supplied timing cases compare setup and same-root-edge hold slack on separate vertical scales. Original 10 ns period: +3.10 ns setup, −0.55 ns hold. Period 20 ns only: +13.10/−0.55 ns. Declared physical min/max data-delay addition at 10 ns: +2.30/+0.05 ns. These are synthetic bound calculations, not a generated timing report or an implemented fix.
06

Use an intentional failure to distinguish the checking questions

The actual testbench initializes clk=0, toggles every 5 ns and has rising edges at absolute times 5, 15, …, 75 ns. Step 6 checks the state 1 ns after the 75 ns rising edge, at 76 ns; step 9 checks reset priority. For the separate path arithmetic, any selected root edge can be called relative time 0. The hypothetical L/C latencies are not inserted into this ideal functional bench.

The functional bench changes rst/en on falling edges, 5 ns after the preceding rising edge. The separate physical input contract instead declares external arrival 0.5…2.0 ns after its interface rising-edge reference. The bench does not test compliance with that arrival contract; its ideal stimulus and #1 observation scheduling are not routed-delay, capture-aperture or I/O timing evidence.

In a separate optional negative-test copy, replace only the sixth expected count 0 with 1. The design/stimulus stay unchanged, so the specified result still conflicts with the expectation. A suitable actual simulation should reach $fatal there; no positive or negative simulator run is claimed in this lesson.

The two failures answer different questions: the wrong expectation conflicts with the logical state rule; the original −0.55 ns hold result conflicts with the hypothetical physical timing bounds. Matching functional values would not erase the latter, and #1 checking delay is not a physical fix.

Exact step 6 line in a testbench copy; complete source is in the preceding HDL lesson
VariantStatement
Original expected checkstep(1'b0, 1'b1, 2'd0, 1'b1);
Intentional wrong expectationstep(1'b0, 1'b1, 2'd1, 1'b1);
07

Validate constraints before calling timing complete

Static timing analysis (STA) evaluates constrained path bounds, rather than enumerating testbench input traces. Its result depends on valid clocks, edge relationships, device libraries, delay corners and exceptions. A correct formula for one selected path is not complete timing closure.

A clock-only declaration omits external rst/en arrivals and count/pulse receiver needs. Max-only interface constraints leave early-arrival/hold behaviour unqualified. In an actual flow, confirm intended queries match nonempty clock/port/path sets; a report that silently selected nothing is not evidence of coverage.

Cover all intended register-to-register and input/output paths with min/max relationships, specified input transition times (slews) and output electrical loads, clock uncertainty and board references. Check missing clocks, partial delays, loops and unconstrained endpoints. Select actual part/speed grade or libraries and relevant process/voltage/temperature corners.

No false-path or multicycle exception is justified here. A path being inconveniently fast is not proof that it is functionally false. Extensions with generated/unrelated clocks, asynchronous reset or clock gating require their own checks; this synchronous-input fixture excludes them by declaration.

The complete paper route reconstructs both edge timelines, evaluates the three path cases, identifies clock-only/max-only omissions and explains the negative test. No synthesis, static-timing engine, routing, bitstream or board operation occurred.

Evidence boundaries to retain in any actual follow-on flow
EvidenceQuestion it addressesRemaining limit
Supplied state rule / testbenchIntended logical result and checking pathNot an executed simulation
Actual functional simulation, if runObserved response for supplied stimuliNo physical aperture or exhaustive proof
One calculated min/max pathConsistency of its declared bounds/edgesNo complete path/constraint coverage
Actual STA with validated constraintsModelled setup/hold of covered paths/cornersNeeds real libraries/implementation and constraint completeness
Board electrical/functional evidenceObserved actual interface under stated conditionsSeparate from modelled timing and untested environments

A passing setup check with a failing hold check

The original latest arrival 7.5 ns precedes its 10.6 ns deadline, giving +3.1 ns setup. The same path’s earliest new data 1.25 ns precedes the required old-data stability end 1.8 ns, giving −0.55 ns hold.

A 20 ns period improves only the next-edge setup comparison to +13.1 ns. With the declared same-edge relationship unchanged, hold stays −0.55 ns. Slower repetition does not prevent that early change after this root edge.

The separately modelled minimum/maximum data-delay addition gives 1.85/8.3 ns arrivals and +0.05/+2.3 ns hold/setup. Keep the actual implementation, all corners, interfaces and testbench results pending; a delay in RTL source or a false-path label cannot substitute for a valid physical/constraint solution.

Try the reasoning

  1. Find original setup arrival, required time and slack.

    Show the answer and reasoning

    Latest arrival=1.0+0.8+5.7=7.5 ns. The next root edge 10 ns reaches capture at 11.5 ns; subtract 0.7 setup and 0.2 residual guard to get 10.6 ns required. Setup slack=10.6−7.5=+3.1 ns.

  2. Find original hold arrival, required stability end and slack.

    Show the answer and reasoning

    Earliest new arrival=1.0+0.15+0.1=1.25 ns. Same-root-edge capture arrives 1.5 ns, and old data must remain through 1.5+0.2+0.1=1.8 ns. Hold slack=1.25−1.8=−0.55 ns.

  3. Why does destination-minus-source skew help setup but hurt this hold check?

    Show the answer and reasoning

    Ssetup includes +k because later capture gives more time to the next edge. Shold includes −k because the old-data hold requirement extends later after the same root edge. These signs belong to the explicitly declared edge relationships.

  4. Does changing only period to 20 ns fix the original path?

    Show the answer and reasoning

    No. Setup improves to +13.1 ns, but same-edge hold remains −0.55 ns while edges/phases/latencies/topology stay unchanged. This is not a universal claim about opposite-edge, multicycle or unrelated-clock paths.

  5. Check the modelled 0.6 ns minimum / 0.8 ns maximum delay addition.

    Show the answer and reasoning

    dmin becomes 0.7 ns, giving earliest 1.85 ns and hold +0.05 ns. dmax becomes 6.5 ns, giving latest 8.3 ns and setup +2.3 ns at 10 ns period. Actual implementation must recheck all affected min/max paths/corners; an RTL # delay is not this physical change.

  6. Why does the setup-only 6.9 ns period bound not establish an overall clock limit?

    Show the answer and reasoning

    It solves only T+k−tCQmax−dmax−tsetup−Usetup≥0 for the original selected path. The original hold comparison still fails and complete path/interface constraints are absent. The modified setup-only bound 7.7 ns has the same scope limit.

  7. What do the interface min/max values mean?

    Show the answer and reasoning

    rst/en have declared external arrival 0.5…2.0 ns relative to clk. Output receivers need 2.0 ns setup/0.2 ns hold with zero supplied board data delay/skew. Their SDC-like max +2.0/min −0.2 ns requirements are sign-convention constraints, not measured output arrivals or negative physical travel time.

  8. What is intentionally wrong at testbench step 6, and what is its expected failure?

    Show the answer and reasoning

    Change expected_count from 0 to 1 in a separate testbench copy while keeping design/stimulus unchanged. The old count=3, rst=0, en=1 rule still gives count=0 and pulse=1 after the 75 ns rising edge; the check at absolute simulation time 76 ns should call $fatal. Those times belong to the ideal functional bench, which does not validate the separate physical I/O arrival contract. No simulator ran here.

  9. May a correct functional trace or false-path waiver replace the negative hold result?

    Show the answer and reasoning

    No. Functional scheduling omits physical capture apertures/routed min/max delay. A real functional path cannot be waived merely for being too fast. Repair the physical timing or a demonstrably wrong timing model, validate complete constraints and all affected paths/corners, and retain actual tool/board evidence separately.

What to carry forward

Check latest data against the next setup edge and earliest data against the same-edge hold requirement. Preserve the clock/interface contract, residual uncertainty meaning and complete min/max coverage; logical testbench evidence and physical timing qualify different claims.

References

Sources supporting this lesson’s explanations and examples.

  1. AMD4 sources
    1. Reviewing Timing Slack — Versal Adaptive SoC System Integration and Validation Methodology Guide (UG1388)AMDTechnical guidedocs.amd.comRead source
    2. check_timing — Vivado Design Suite Tcl Command Reference Guide (UG835)AMDTechnical guidedocs.amd.comRead source
    3. Defining Input Delays — UltraFast Design Methodology Guide for FPGAs and SoCs (UG949)AMDTechnical guidedocs.amd.comRead source
    4. Defining Output Delays — UltraFast Design Methodology Guide for FPGAs and SoCs (UG949)AMDTechnical guidedocs.amd.comRead source
  2. 2.3.4.6.2. Clock Uncertainty — Quartus Prime Standard Edition User Guide: Timing AnalyzerAlteraTechnical guidedocs.altera.comRead source