Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
    • Writing an Interface Contract
    • Safety and Liveness
    • Protocol Assertions
    • Monitors and Transaction Reconstruction
    • Ordering-Aware Scoreboards
    • Protocol Coverage
    • Formal Methods for Protocols
    • Compliance and VIP
    • Observability and Tracing
    • A Waveform Debug Method
    • Drills: Specifying and Verifying
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 15: Specifying and Verifying
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 15: Specifying and Verifying
  4. Safety and Liveness

Part 15 · Specifying and Verifying · Working (W)

Safety and Liveness

Every protocol rule is either "nothing bad ever happens" or "something good eventually happens". Why the first can be caught by a simulation and the second cannot, and how engineers turn liveness into something checkable.

On this page

    Note

    Level: Working (W) · Answers: How do we know it is correct?

    Before this: Writing an Interface Contract, Deadlock, Livelock and Starvation

    A verification team runs a million cycles of random traffic with every assertion passing and declares the interface clean. On silicon, under one unusual traffic pattern, a request never gets its response. No assertion fired because no assertion could: in every finite simulation, "the response has not come yet" looks exactly like "the response will never come". The team had checked that nothing bad happened. Nobody had checked that something good eventually did.

    What kinds of property does a protocol have, and why are some so much harder to check?

    The obvious answer, and why it breaks

    The obvious approach is to write a check for every rule and run lots of simulation. That works for rules whose violation shows up at a moment in time: data changed while stalled, a credit count went negative. It cannot work for rules that promise something will happen eventually, because a simulation always ends, and at the end the promise might still be about to be kept.

    The idea: two kinds of property

    Safety

    Liveness

    Says

    Nothing bad ever happens

    Something good eventually happens

    Violated by

    A finite trace: you can point at the cycle it went wrong

    Only an infinite trace: no finite trace proves it was broken

    Protocol examples

    Data stable while stalled; credits never negative; never more than N outstanding; a response matches a request

    Every request gets a response; a stalled transfer completes; every requester is eventually granted; the link eventually trains

    Checked by

    Assertions in simulation; formal tools

    Formal tools; or turned into a bounded safety check

    Every property is a combination of the two (fact T29). Deadlock, livelock and starvation (Part 9) are all liveness failures, which is exactly why they escape simulation-based testing.

    Making liveness checkable

    • Bound it: "every request gets a response within 1,000 cycles" is a safety property, violated at cycle 1,001. Choose the bound from the design's worst case, not from typical latency.

    • Check at the end of a test: after traffic stops and the design drains, nothing may be outstanding. A hang shows up as leftovers.

    • Prove it formally: formal tools can check true liveness ("eventually") or show a trace that loops for ever (lesson 15.7).

    • Watch for fairness assumptions: "eventually granted" usually holds only if the partner eventually becomes ready; state those assumptions explicitly.

    design.sv
    1
    2
    3
    4
    // snippet: a liveness rule made bounded (and so checkable in simulation)
    // Every request (req) receives a response (rsp) within MAX_LAT cycles.
    assert property (@(posedge clk) disable iff (!rst_n)
      req |-> ##[1:MAX_LAT] rsp);

    The bounded form catches hangs and also unexpectedly slow responses; the bound itself becomes part of the specification.

    How real protocols state it

    Protocol

    Liveness promise

    How it is bounded

    AXI

    A transfer eventually completes once the handshake rules are followed (facts A1 to A3)

    Not bounded by the protocol; systems add timeouts

    PCI Express

    A non-posted request gets a completion

    Completion timeout ranges in Device Control 2 (fact P29)

    DCLink

    Every packet is eventually acknowledged

    Replay timer (step 9)

    What breaks

    The opening silicon hang (illustrative) was a starvation case: one requester was always beaten by a higher-priority one under a particular traffic mix. Adding a bounded-response assertion (every request granted within 64 cycles) to the random simulation found it in a few hours; a formal run on the arbiter then proved the corrected version could not starve.

    Why this matters

    Senior lens. Classify every rule in the specification as safety or liveness. For each liveness rule, decide how it will be checked: a bounded assertion with a justified bound, an end-of-test drain check, or a formal proof, and state the fairness assumptions it relies on. An unchecked liveness rule is where hangs hide.

    Interview

    Asked: "Is "every request gets a response" a safety or a liveness property?"

    Weak answer: Safety, because it keeps the system safe.

    Strong answer: Liveness: it promises something good eventually happens, and no finite simulation can show it's violated, because the response might always be about to arrive. To check it you either bound it, every request gets a response within N cycles, which is a safety property an assertion can catch, or check that nothing is outstanding after the test drains, or prove it with a formal tool, stating the fairness assumptions such as the partner eventually being ready. Deadlock and starvation are liveness failures, which is why they escape ordinary testing.

    Follow-ups: (1) How would you choose the bound? (2) What fairness assumption does that property need?

    Check yourself "The credit count never exceeds the buffer size." Safety or liveness?

    Safety: a violation happens at a specific cycle and a finite trace shows it.

    Check yourself Why can an end-of-test check catch a hang that no assertion caught during the test?

    After traffic stops and the design should have drained, anything still outstanding proves something never completed.

    Key takeaways

    • Safety: nothing bad happens, violated at a cycle you can point to. Liveness: something good eventually happens.

    • Simulation catches safety violations; liveness needs a bound, an end-of-test drain check, or a formal proof.

    • Deadlock and starvation are liveness failures; give every liveness rule a checking plan.

    Keep going

    Next: Lesson 15.3, Protocol Assertions. The standard set of interface assertions, built as a reusable checker.

    Related topics

    • Part 15 overview: Specifying and Verifying

    Previous

    197 / 234

    Next: Protocol Assertions

    Up next

    Up nextProtocol Assertions

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Monitors and Transaction Reconstruction
    • Ordering-Aware Scoreboards
    • Protocol Coverage