Tutorials
Protocols
Learn More
Atomicity
Atomicity describes what other observers are allowed to see when a memory location is updated. In a shared system, it is not enough for the data eventually to become correct. Other Managers must not observe illegal partial updates within the atomicity guarantee provided by the system.
AHB has two related but different ideas here. HMASTLOCK protects a sequence of transfers from interleaving by another Manager. Atomicity properties define what other observers are allowed to see when memory is updated. A correct system often needs both ideas to be understood separately.
Locked sequences in atomic updates
A locked sequence is useful when a Manager performs a read-modify-write operation. The Manager first reads a location, computes a new value, and then writes the result back. If another Manager accesses the same shared location between the read and the write, the update can be based on stale data.
HMASTLOCK tells the interconnect and any relevant shared Subordinate that the protected sequence must not be interrupted by another competing access to the same resource. This matters most for multi-Manager systems, shared memories, and multi-port memory controllers. A simple in-order Subordinate that only receives one transfer stream might not need special internal lock behavior, but shared arbitration logic must respect the lock.
| Concept | What it protects |
|---|---|
| Locked sequence | Ordering of a group of transfers, such as read then write. |
| Single-copy atomicity | Visibility of one memory update so observers do not see a partial update within the atomicity size. |
| Multi-copy atomicity | Visibility order of writes across multiple observing agents. |
So, a locked sequence can stop another Manager from entering the middle of a read-modify-write sequence, while atomicity defines what partial or reordered memory updates are allowed to be observed.
Single-copy atomicity
Single-copy atomicity size defines how many bytes are guaranteed to update atomically for a group of communicating components. The group is a system property. For example, a CPU and DRAM controller might support 64-bit atomic updates, while a wider system including peripherals might only guarantee 32-bit atomicity.
| Rule | Meaning |
|---|---|
| Atomicity cannot exceed start-address alignment | A transfer not aligned to 8 bytes cannot claim 64-bit single-copy atomicity. |
| Observers must not see partial updates within the atomicity size | Another Manager must see either no update or a complete atomic-size update. |
| Byte strobes do not reduce the atomicity size | Strobes choose which bytes are written, but the atomicity guarantee is still defined by the system group. |
| Larger transfers update in atomic-size blocks | A transfer wider than the atomicity size must update memory in blocks of at least the atomicity size. |
The exact instant of update is not the point. The requirement is that no observer can see a partially updated version of one atomic element.
Multi-copy atomicity
AHB5 defines the Multi_Copy_Atomicity property. A system is multi-copy atomic when:
- Writes to the same location are observed in the same order by all agents.
- If a write becomes visible to any agent other than the issuer, it becomes visible to all agents.
Forwarding buffers can break this property because they can make data visible to one part of the system before it is visible everywhere. Systems with hardware cache coherency can have additional requirements outside the AHB signal-level protocol.
Atomicity checklist
| Check | Reason |
|---|---|
| Locked sequence start and end are well defined | Prevents permanent bus locking. |
| Single-copy atomicity size is documented | Verification needs the atomic update granularity. |
| Start-address alignment is checked | Atomicity cannot exceed the alignment of the transfer start address. |
| Byte strobes do not shrink atomicity assumptions | Strobes select written bytes, but the system atomicity size is still a system property. |
| Larger transfers update in atomic-size blocks | Prevents observers from seeing illegal partial updates. |
| Multi-copy atomicity property is understood | Visibility ordering is a system-level guarantee. |
AHB Protocol