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
    • Why Ordering Matters
    • Ordering Scopes
    • The Point of Serialisation
    • Early and Final Acknowledgement
    • Fences and Barriers
    • Ordering Tables
    • Relaxed and ID-Based Ordering
    • Same-Address Hazards
    • Interrupt and Data Ordering
    • Memory Consistency Models
    • Ordering Across Bridges
    • Protocols Compared: Ordering
    • Drills: Ordering
  • 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
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 7: Ordering
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 7: Ordering
  4. Ordering Tables

Part 7 · Ordering · Principal (P)

Ordering Tables

A passing table says, for posted, non-posted and completion traffic, which may overtake which. Each cell has one of two reasons: producer/consumer correctness or deadlock avoidance. How to read the table and rebuild it from first principles.

On this page

    Note

    Level: Principal (P) · Answers: In what order do results become visible?

    Before this: Fences and Barriers, Posted and Non-Posted Writes

    A switch has a queue of packets heading to the same place: some posted writes, some read requests, some read completions. It may send them in any order the rules allow. The rules fit in a three-by-three table, and the table looks arbitrary until you see that every cell answers one of two questions: "would passing here let a consumer see stale data?" and "would not passing here risk a deadlock?"

    Which kinds of transaction may overtake which, and why?

    The obvious answer, and why it breaks

    The obvious rule is strict order: nothing passes anything. It is correct for producer/consumer and it can deadlock. A read request waiting in a full queue blocks the posted writes behind it; if the read cannot complete until those same writes drain somewhere else, nothing moves. The opposite rule, anything may pass anything, cannot deadlock this way and breaks data-then-flag. The table is the set of exceptions that keeps both properties.

    The idea: two forces, one table

    • Producer/consumer correctness says: a later access must not pass an earlier posted write. A flag write must not overtake its data write; a read must not overtake writes it is meant to observe; read data returned must not overtake writes made before it.

    • Deadlock avoidance says: posted writes and completions must never be blocked by non-posted requests. Non-posted requests need a completion before they finish, so they can wait on resources; posted writes and completions finish when delivered, so they must always be able to drain.

    Read the table as "may the row's transaction pass an earlier transaction of the column's type, in the same direction on the same path?"

    Later ↓ / earlier →

    Posted write

    Non-posted request

    Completion

    Posted write

    No: a flag must not pass its data (producer/consumer). Relaxed Ordering may permit it.

    Must be able to: otherwise a blocked request can block writes it depends on (deadlock)

    Must be able to (deadlock)

    Non-posted request

    No: a read must see earlier writes; a read-back flushes posted writes (producer/consumer)

    May, either way

    May, either way

    Completion

    No: returned data must not overtake writes made before it (producer/consumer). Relaxed Ordering may permit it.

    Must be able to (deadlock)

    May, between different requests; the pieces of one split read stay in address order

    Rebuilding each cell

    • Posted cannot pass posted: data then flag (lesson 7.1).

    • Non-posted cannot pass posted: the read-back rule (lesson 5.7): a read from a device confirms earlier writes to it have landed.

    • Completion cannot pass posted: a device that writes data to memory and then returns a read completion (or a status) must not have the completion seen first.

    • Posted and completions must be able to pass non-posted: non-posted requests can be stuck waiting for resources (completion buffers, credits); if posted writes and completions queued behind them, the traffic that would free those resources could never move (Part 9).

    • Everything else is free, because no correctness or deadlock argument needs it, and freedom helps performance.

    How real protocols chose

    Protocol

    Passing rules

    PCI Express

    Exactly this structure. A read request or non-posted write must not pass an earlier posted write; a completion must not pass an earlier posted write; a posted write must not pass a posted write; posted writes and completions must be allowed to pass non-posted requests. Relaxed Ordering and ID-Based Ordering relax some cells (lesson 7.7).

    AXI

    No posted/non-posted distinction; ordering is per ID, and deadlock avoidance comes from channel independence and dependency rules (lesson 5.6).

    What breaks

    A bridge (illustrative) kept a single FIFO for all traffic towards a host. A device read stalled at the head of the FIFO waiting for completion credits, while behind it sat posted writes, including the ones that would eventually let the host free those credits. The system deadlocked under heavy DMA. Separate queues per traffic type, with posted writes and completions allowed to bypass blocked requests, are not an optimisation: they are the deadlock rule of the table.

    Why this matters

    Principal lens. Every cell of a passing table should be justifiable in one sentence as either producer/consumer correctness or deadlock avoidance. When designing a bridge or switch, implement the table with separate queues per traffic type, prove the deadlock-avoidance cells with a dependency argument (Part 9), and test the producer/consumer cells with data-then-flag traffic under heavy contention. When defining a new protocol, derive the table from the two forces instead of copying one.

    Interview

    Asked: "Why may a read not pass a posted write in PCIe?"

    Weak answer: Because reads are slower.

    Strong answer: Producer/consumer correctness. Software relies on a read from a device to confirm that its earlier posted writes have arrived: the read cannot complete until the writes ahead of it have landed. If the read could pass them, the read-back would prove nothing and data-then-flag patterns would break. The opposite direction is a deadlock rule: posted writes must be able to pass a blocked read request, because the read may be waiting on resources only those writes can free.

    Follow-ups: (1) Why must completions be able to pass non-posted requests? (2) What does Relaxed Ordering change in the table?

    Check yourself Give the reason a completion may not pass an earlier posted write in the same direction.

    A device may write data to memory and then return a completion (or status) that tells software to look at it; the completion must not be seen before the data.

    Check yourself Why must posted writes never be stuck behind non-posted requests?

    Non-posted requests can wait for resources (credits, completion space); if posted writes queued behind them could never drain, the traffic that frees those resources could be blocked too: a deadlock.

    Key takeaways

    • A passing table says which traffic type may overtake which, in one direction on one path.

    • "Must not pass" cells come from producer/consumer correctness; "must be able to pass" cells from deadlock avoidance.

    • Implement them with separate queues per type, and justify every cell with one of the two reasons.

    Keep going

    Next: Lesson 7.7, Relaxed and ID-Based Ordering. Giving up order where nobody needs it: relaxed and ID-based ordering, and who may ask for it.

    Related topics

    • Part 7 overview: Ordering

    Previous

    109 / 234

    Next: Relaxed and ID-Based Ordering

    Up next

    Up nextRelaxed and ID-Based Ordering

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Why Ordering Matters
    • Ordering Scopes
    • The Point of Serialisation