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. Same-Address Hazards

Part 7 · Ordering · Senior (S)

Same-Address Hazards

Even accesses to one address can be reordered when they take different paths or sit in different buffers: a read that returns data older than a write already acknowledged. Where these hazards hide and how buffers prevent them.

On this page

    Note

    Level: Senior (S) · Answers: In what order do results become visible?

    Before this: Early and Final Acknowledgement

    A requester writes 5 to an address, gets the write response, then reads the same address and gets the old value, 3. Every component did its job. The write was accepted by a write buffer that answered early. The read took a separate read path that did not look in the write buffer, reached memory first, and returned what memory held. One address, one requester, wrong answer.

    Can a read return data older than a write you already got a response for, and how do designs prevent it?

    The obvious answer, and why it breaks

    The obvious answer is no: accesses to the same address are always kept in order (lesson 7.2). That is the promise, but it holds only if the two accesses meet at one point of serialisation (lesson 7.3) in issue order. Whenever a write and a later access to the same address can take different paths (a write buffer and a read bypass, two links, two interconnect routes), they can arrive in the wrong order, and the promise has to be kept by extra hardware.

    The idea: two hazards and their causes

    Hazard

    What goes wrong

    Typical cause

    Read after write (RAW)

    A read returns the value before an earlier write to the same address

    The write waits in a buffer that the read does not check; the read takes a faster path

    Write after write (WAW)

    An older write lands after a newer one, leaving the old value

    Two writes take different paths, or a buffer drains out of order

    The write sits in the buffer while the read takes another path to memory and returns the old value.

    How designs prevent them

    Technique

    How it works

    Cost

    Check the buffer (forwarding)

    A read compares its address with buffered writes; on a match it returns the buffered data (or waits for it to drain)

    An address comparison per buffer entry

    Same path for same address

    Route all accesses to an address through one path (for example by hashing the address to choose a link)

    Less freedom to balance load

    Block on match

    A read that matches a buffered write waits until that write has drained

    Latency for that read only

    In-order buffers

    Write buffers drain in arrival order, and two writes to one address never take different paths

    Prevents WAW only

    Requester waits

    Issue the read only after the write's final acknowledgement

    A round trip, paid by software

    Processors do the first one constantly: store-to-load forwarding lets a load read a value still in the store buffer. Interconnects and bridges do the second and third.

    How real protocols chose

    Protocol

    Same-address order

    AXI

    No ordering between the read and write channels, even for the same ID and address: a requester that needs a read to see its write must wait for the write response; components that buffer writes and answer early must make later reads to the same address see them.

    PCI Express

    A read may not pass earlier posted writes in the same direction (lesson 7.6), so a read to the same address sees writes sent before it on that path.

    What breaks

    The opening system (illustrative): an interconnect added a write buffer to speed up memory writes and answered them early, but its read path went straight to memory without checking the buffer. Single-threaded code that wrote and then read a variable failed under load. Adding an address check that held matching reads until the write drained fixed it, and cost almost nothing, because matches were rare.

    Why this matters

    Senior lens. Wherever a design adds a buffer, a second path or early acknowledgement, ask: can a later access to the same address take a different route and arrive first? If yes, the design needs forwarding, blocking on address match, or address-based routing. Verify with write-then-read and write-then-write to the same address under heavy traffic, the cases quiet tests never exercise.

    Interview

    Asked: "Can a read return older data than a write you already got a response for?"

    Weak answer: No, same-address accesses are always ordered.

    Strong answer: Yes, if the response was an early one from a write buffer and the read took a path that doesn't check that buffer: the read reaches memory before the write drains and returns the old value. Same-address order holds only if both accesses meet one point of serialisation in order. Designs fix it with forwarding or blocking on an address match in the buffer, routing an address always through one path, or having the requester wait for a final acknowledgement. In AXI there's no ordering between read and write channels, so the requester must wait for the write response.

    Follow-ups: (1) What is store-to-load forwarding? (2) How can two writes to one address land in the wrong order?

    Check yourself Two writes to the same address go over two different links. What can go wrong, and what prevents it?

    A write-after-write hazard: the older write may land last. Routing every access to an address over the same link (or waiting for the first write's acknowledgement) prevents it.

    Check yourself Why is blocking on an address match cheap in practice?

    Reads that match a still-buffered write are rare, so only those few reads pay the extra latency.

    Key takeaways

    • Same-address order holds only if both accesses meet one point of serialisation in issue order.

    • Buffers that answer early and separate paths create read-after-write and write-after-write hazards.

    • Prevent them with forwarding, blocking on address match, address-based routing, or waiting for final acknowledgement.

    Keep going

    Next: Lesson 7.9, Interrupt and Data Ordering. Why a message-signalled interrupt must push earlier writes ahead of it.

    Related topics

    • Part 7 overview: Ordering

    • Architecture course: Store Buffer Reordering

    Previous

    111 / 234

    Next: Interrupt and Data Ordering

    Up next

    Up nextInterrupt and Data Ordering

    Sign in to save progress

    Practice this lessonReport an error

    See also

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