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. Writing an Interface Contract

Part 15 · Specifying and Verifying · Principal (P)

Writing an Interface Contract

An interface specification is a contract: two teams build to it separately and their blocks must work together the first time. What a good contract contains, how to state rules so they can be checked, and what to leave out.

On this page

    Note

    Level: Principal (P) · Answers: How do we know it is correct?

    Before this: A Protocol Is a Contract

    Two teams build the two sides of a new interface from the same specification. Months later the blocks meet in simulation and fail on the first transfer. The sender drops valid while it is stalled; the specification's timing diagram never showed a stall, and its prose said "the sender presents data with valid". Each team read it differently, and each reading was reasonable. The specification was the bug.

    What must an interface specification contain so that two teams who never talk can build blocks that work together?

    The obvious answer, and why it breaks

    The obvious specification is a signal list, a description of what each signal means, and a few timing diagrams of typical transfers. That describes the happy path. The failures live elsewhere: stalls, back-to-back transfers, resets in the middle, errors, maximum outstanding requests, the cycle where two events coincide. A diagram shows one example; it does not say which features of the example are rules and which are accidents. Every gap is filled by each team's assumption, and the assumptions differ.

    The idea: a contract is a set of checkable rules

    Section

    What it says

    Common gap

    Roles and signals

    Who drives each signal, its width, its reset value, which clock

    Reset values and which side drives what during reset

    Rules (numbered)

    Every obligation, each one testable on the wires: "once valid is high, it stays high until valid and ready are both high"

    Rules only implied by a diagram

    Allowed and forbidden freedoms

    What a side may do (ready may depend on valid; responses may come in any order across IDs) and may not do

    Assuming the partner will not use a freedom the spec gives it

    Transaction semantics

    What each transfer means: ordering, completion, error responses

    Ordering left to "obvious"

    State machines and tables

    Where behaviour depends on history: link states, credit initialisation

    Prose instead of an exhaustive table

    Timing diagrams

    Examples, including stalls, back-to-back and errors, each labelled as an example

    Diagrams read as rules

    Parameters and limits

    Maximum outstanding, burst length, credit counts, timeouts

    Limits a block silently assumes

    Reset, errors and corner cases

    Mid-transfer reset, error paths, simultaneous events

    Missing entirely

    Writing rules that can be checked

    Each rule should be a statement about the interface's signals that a checker could evaluate cycle by cycle, with a number so that reviews, assertions and bug reports can refer to it. Compare:

    Diagram
    Weak:   "The sender presents data with valid."
    
    Strong: R3. Once vld is high, vld stays high, and data and last stay
            unchanged, until the cycle in which vld and rdy are both high.
            R4. vld must not depend combinationally on rdy.
            R5. rdy may depend on vld.
            R6. A packet ends with last; a packet has at most 8 beats.

    Each strong rule maps to one assertion (lesson 15.3). If you cannot write the assertion, the rule is not yet precise enough.

    What to leave out

    • Implementation: how a side meets the rules (buffer sizes, pipelines) is its own business unless it is visible on the wires.

    • Unnecessary restrictions: every rule constrains both teams forever; forbid only what would break the other side.

    • Duplicated statements: say each rule once; two slightly different statements of one rule become two rules.

    How real specifications do it

    Specification

    Practice

    AMBA AXI

    Explicit handshake rules and channel dependency rules, stated separately from the timing examples (facts A1, A2, A21)

    PCI Express

    Numbered requirements and exhaustive tables such as the ordering table (fact P28)

    Register maps

    Machine-readable descriptions (IP-XACT, SystemRDL) from which RTL, documents and checks are generated (fact T13)

    What breaks

    The opening failure (illustrative) was fixed by adding a single numbered rule (R3 above) and an assertion for it to both teams' testbenches. A review of the rest of the specification against the question "could each statement be an assertion?" found eleven more statements that were really examples, three of which the two teams had implemented differently.

    Why this matters

    Principal lens. A specification is the most leveraged document in a project: every block, testbench and future derivative is built from it. Write rules, not descriptions; number them; mark every diagram as an example; state the freedoms each side has; and deliver the assertions with the document. A rule that cannot be turned into a check is a disagreement waiting to happen.

    Interview

    Asked: "What makes an interface specification good?"

    Weak answer: It has detailed timing diagrams.

    Strong answer: It's a set of numbered, checkable rules rather than descriptions: who drives what, reset values, every obligation stated as something you could assert on the wires, the freedoms each side has, transaction semantics like ordering and errors, state machines and tables where behaviour depends on history, limits like maximum outstanding, and the corner cases: stalls, back-to-back, mid-transfer reset, simultaneous events. Diagrams are labelled as examples. It leaves out implementation and states each rule once. The test is whether every rule can become an assertion.

    Follow-ups: (1) Why shouldn't timing diagrams be the rules? (2) What would you leave out?

    Check yourself A diagram shows ready rising one cycle after valid. Is that a rule?

    Not unless the text says so; diagrams are examples. A good specification states whether ready may come earlier, later or at the same time.

    Check yourself How can you tell whether a rule is precise enough?

    Try to write it as an assertion over the interface signals; if you cannot, it is still ambiguous.

    Key takeaways

    • A specification is a contract between teams who may never talk: every gap becomes a disagreement.

    • Write numbered rules that can each become an assertion; label diagrams as examples; state freedoms and limits.

    • Cover stalls, back-to-back, resets, errors and simultaneous events; leave out implementation.

    Keep going

    Next: Lesson 15.2, Safety and Liveness. The two kinds of property every rule is, and why one is much harder to check.

    Related topics

    • Part 15 overview: Specifying and Verifying

    Previous

    196 / 234

    Next: Safety and Liveness

    Up next

    Up nextSafety and Liveness

    Sign in to save progress

    Practice this lessonReport an error

    See also

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