Tutorials

Protocols

Learn More

Atomicity is about what other agents are allowed to observe while data is being updated. A normal ordered transaction can still be non-atomic: it can complete in the correct order but still be observed as multiple smaller updates. Atomic behavior adds a stronger rule: observers must not see a partial update of the atomic element.

AXI uses three related ideas in this area:

IdeaMeaning
Single-copy atomicity sizeThe minimum update size that all relevant observers see as one indivisible update.
Multi-copy write atomicityA write that becomes visible to one observer becomes visible consistently to all observers, and writes to the same location are seen in the same order.
Atomic transactionA transaction that sends an operation to the data location, so the Subordinate performs the read-modify-write style operation atomically.

Atomic transactions are different from exclusive accesses. Exclusive accesses use a read-then-write monitor sequence and can fail if another write intervenes. Atomic transactions send the operation itself to the Subordinate and are described using AWATOP.

Single-copy atomicity size

The single-copy atomicity size is the minimum number of bytes that a transaction updates atomically. If a system supports 32-bit single-copy atomicity, no observer can see only half of a 32-bit update. If a system supports 64-bit single-copy atomicity, a naturally aligned 64-bit update can be observed as one indivisible update.

For a transaction larger than the single-copy atomicity size, memory must be updated in blocks of at least the supported atomicity size. Atomicity does not define the exact clock cycle when data is updated. It defines what other Managers are allowed to observe.

ExampleAtomicity implication
32-bit linked-list pointer updateOther Managers must not observe only 16 bits updated.
64-bit counter updateRequires all communicating components to support 64-bit atomicity if software depends on 64-bit indivisibility.
Unaligned 64-bit accessDoes not get a 64-bit single-copy atomic guarantee if the start address is not 8-byte aligned.
Byte-strobed writeByte strobes do not reduce the single-copy atomicity size.

The AXI protocol does not require one universal single-copy atomicity size for every system. A system can define single-copy atomic groups. For example, a CPU, DSP, DMA, SRAM, DRAM controller, and interconnect might share 32-bit atomicity, while only the CPU, DSP, DRAM controller, and part of the interconnect share 64-bit atomicity.

Multi-copy write atomicity

A system is multi-copy atomic when writes to the same location are observed in the same order by all agents, and when a write that is observable by one agent is observable by all agents. The Multi_Copy_Atomicity property indicates support. For Issue G and later, the local specification requires this property to be True.

Multi_Copy_AtomicityDefaultMeaning
TrueNoMulti-copy atomicity is supported.
FalseYesMulti-copy atomicity is not supported.

Multi-copy atomicity is commonly achieved by using a single Point of Serialization for a given address, so all accesses to that address are ordered consistently. It can also require avoiding forwarding buffers that make a write visible to one observer before it is visible to all observers.

Atomic transactions

Atomic transactions send the operation to the data instead of pulling the data back to the Manager and later writing it again. This can reduce the time during which the location must be protected from other agents. Atomic transactions update the entire written location atomically, regardless of the single-copy atomicity size of the component.

AXI defines four atomic forms:

Atomic formChannels usedBehaviorData returned
AtomicStoreAW, W, BManager sends data and an operation. The Subordinate combines sent data with memory data and stores the result.No read data.
AtomicLoadAW, W, B, RManager sends data and an operation. The Subordinate returns the original memory value and stores the operation result.Original memory value.
AtomicSwapAW, W, B, RManager sends a replacement value. The Subordinate stores it and returns the original value.Original memory value.
AtomicCompareAW, W, B, RManager sends compare and swap values. The Subordinate writes the swap value only if the compare value matches memory.Original memory value.

AtomicStore and AtomicLoad support these operation types:

OperationMeaning
ADDAdd sent data to memory value and store the result.
CLRClear memory bits where sent data has bits set.
EORBitwise exclusive OR.
SETSet memory bits where sent data has bits set.
SMAX / SMINSigned maximum or minimum.
UMAX / UMINUnsigned maximum or minimum.

The operation and atomic form are encoded using AWATOP.

AWATOP patternMeaning
0b000000Non-atomic operation.
0b01exxxAtomicStore; e carries endianness for arithmetic operations and xxx selects the operation.
0b10exxxAtomicLoad; e carries endianness for arithmetic operations and xxx selects the operation.
0b110000AtomicSwap.
0b110001AtomicCompare.

Atomic transaction attributes

Atomic transaction attributes are constrained so the Subordinate can perform the operation predictably.

RuleMeaning
AWLEN and AWSIZE describe the write data bytes.For AtomicCompare, this includes both compare and swap values.
If AWLEN is greater than zero, AWSIZE must be the full data channel width.Multi-transfer atomic data uses full-width transfers.
Write strobes outside the legal data window must be LOW.Atomic writes must not update bytes outside the requested atomic operand.
Write strobes inside the legal data window must be HIGH.Atomic operands are complete; sparse updates are not allowed inside the operand.
Atomic transactions are Regular transactions.They obey the Regular transaction subset.
AWCACHE and AWDOMAIN can use any legal combination for the interface type.Atomic support is not limited to one memory type by this rule alone.
AWSNOOP must be all zeros.If AWSNOOP is not zero, AWATOP must be all zeros.
AWLOCK must be deasserted.Atomic transactions are not exclusive accesses.

For AtomicStore, AtomicLoad, and AtomicSwap, write data size is 1, 2, 4, or 8 bytes, and AWADDR must be aligned to the total write data size. AWBURST must be INCR.

For AtomicCompare, write data size is 2, 4, 8, 16, or 32 bytes because it contains both compare and swap values. The read data size is half the write data size because only the original memory value is returned. AWADDR is aligned to half the total write data size.

Figure A6.2 shows how compare and swap values are placed for AtomicCompare. If the address points to the lower half of the transaction, compare is sent first and AWBURST is INCR. If the address points to the upper half, swap is sent first and AWBURST is WRAP.

ID and response rules

A single AXI ID is used for an atomic transaction. The same ID is used for the request, the write response, and any returned read data. Therefore, the Manager must use an ID value that can be represented on both the write and read ID paths.

Atomic formUnique-in-flight rule
AtomicStoreCan be issued only when there is no outstanding write-channel transaction using the same ID.
AtomicLoad, AtomicSwap, AtomicCompareCan be issued only when there is no outstanding read-channel or write-channel transaction using the same ID.
Atomic transaction with read data and Unique ID signalingIf AWIDUNQ was asserted, RIDUNQ must be asserted on all response transfers.

For AtomicLoad, AtomicSwap, and AtomicCompare, the request is on AW, outbound data is on W, the original value returns on R, and the write response returns on B. The relative timing between the request and write data is not fixed. The Subordinate can wait for all write data before sending read data, and it can also send read data before accepting write data. A correct Manager must be able to handle both legal timings.

For AtomicStore, the request is on AW, outbound data is on W, and the transaction completes with a B response. There is no R response for AtomicStore.

Response pointMeaning
Write response for any atomic transactionIndicates the transaction is visible to all required observers.
First read data for atomic transactions with read dataAlso indicates visibility to all required observers.
AtomicCompare success or failureNot encoded as a separate response outcome. Software must inspect the returned original value to determine whether the compare matched.
Unsupported atomic at a targetCan receive an appropriate error response.

For AtomicLoad, AtomicSwap, and AtomicCompare, the Subordinate must send the correct number of read data transfers even if the write response is DECERR or SLVERR. If there is an error with the write part, it is recommended that the error be visible on both read and write responses so a Manager does not miss it.

Atomic support

Atomic support is controlled by the Atomic_Transactions property.

Atomic_TransactionsDefaultMeaning
TrueNoAtomic transactions are supported.
FalseYesAtomic transactions are not supported.

If a Subordinate or interconnect declares support for atomic transactions, it must support all operation types, sizes, and endianness. If atomic support is only valid for certain memory types or address regions, unsupported atomic requests must receive an appropriate error response.

ComponentSupport rule
ManagerCan include BROADCASTATOMIC; when present and LOW, the Manager must not issue atomic transactions.
SubordinateAtomic support is optional. Unsupported atomic requests must complete with a legal response.
InterconnectAtomic support is optional. If unsupported, attached Managers must be configured not to generate atomic transactions.
Device transactionMust be passed to the endpoint Subordinate if supported; an atomic transaction must not be passed to a component that does not support atomics.

The number of bytes returned must still match the transaction described by ARLEN and ARSIZE. Chunking changes the order and grouping of returned chunks; it does not change the requested byte count.