Skip to content

Commit

Permalink
integrate Zaamo and Zalrsc text (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos authored Apr 11, 2024
1 parent a52f243 commit e87412e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
21 changes: 15 additions & 6 deletions src/a-st-ext.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[atomics]]
== "A" Extension for Atomic Instructions, Version 2.1

The standard atomic-instruction extension, named "A", contains
The atomic-instruction extension, named "A", contains
instructions that atomically read-modify-write memory to support
synchronization between multiple RISC-V harts running in the same memory
space. The two forms of atomic instruction provided are
Expand All @@ -18,6 +18,10 @@ appear to have finally settled on release consistency as the standard
memory consistency model and so the RISC-V atomic support is built
around this model.
====

The A extension comprises instructions provided by the Zaamo and Zalrsc
extensions.

=== Specifying Ordering of Atomic Instructions

The base RISC-V ISA has a relaxed memory model, with the FENCE
Expand Down Expand Up @@ -48,7 +52,7 @@ after any later memory operations in the same RISC-V hart and to the
same address domain.

[[sec:lrsc]]
=== Load-Reserved/Store-Conditional Instructions
=== "Zalrsc" Extension for Load-Reserved/Store-Conditional Instructions

include::images/wavedrom/load-reserve-st-conditional.adoc[]

Expand Down Expand Up @@ -114,7 +118,7 @@ for the SLT/SLTU instructions. More specific failure codes might be
defined in future versions or extensions to the ISA.
====

For LR and SC, the A extension requires that the address held in _rs1_
For LR and SC, the Zalrsc extension requires that the address held in _rs1_
be naturally aligned to the size of the operand (i.e., eight-byte
aligned for _doublewords_ and four-byte aligned for _words_). If the
address is not naturally aligned, an address-misaligned exception or an
Expand Down Expand Up @@ -250,7 +254,7 @@ using LR/SC to implement a compare-and-swap function is shown in
[[sec:lrscseq]]
=== Eventual Success of Store-Conditional Instructions

The standard A extension defines _constrained LR/SC loops_, which have
The Zalrsc extension defines _constrained LR/SC loops_, which have
the following properties:

* The loop comprises only an LR/SC sequence and code to retry the
Expand Down Expand Up @@ -349,7 +353,7 @@ substantially easier to provide in some microarchitectural styles.
====

[[sec:amo]]
=== Atomic Memory Operations
=== "Zaamo" Extension for Atomic Memory Operations

include::images/wavedrom/atomic-mem.adoc[]

Expand All @@ -363,7 +367,7 @@ can either operate on _doublewords_ (RV64 only) or _words_ in memory. For
RV64, 32-bit AMOs always sign-extend the value placed in _rd_, and
ignore the upper 32 bits of the original value of _rs2_.

For AMOs, the A extension requires that the address held in _rs1_ be
For AMOs, the Zaamo extension requires that the address held in _rs1_ be
naturally aligned to the size of the operand (i.e., eight-byte aligned
for _doublewords_ and four-byte aligned for _words_). If the address
is not naturally aligned, an address-misaligned exception or an
Expand Down Expand Up @@ -404,6 +408,11 @@ operations efficiently, and also to support parallel reductions in
memory. Another use of AMOs is to provide atomic updates to
memory-mapped device registers (e.g., setting, clearing, or toggling
bits) in the I/O space.
The Zaamo extension enables microcontroller class implementations to utilize
atomic primitives from the AMO subset of the A extension. Typically such
implementations do not have caches and thus may not be able to naturally support
the LR/SC instructions provided by the Zalrsc extension.
====

To help implement multiprocessor synchronization, the AMOs optionally
Expand Down
2 changes: 1 addition & 1 deletion src/zacas.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ quadword compare and swap (of both the pointer and the counter). The double and
quadword CAS instructions support implementation of algorithms for ABA problem
avoidance.

The Zacas extension depends upon the A extension cite:[unpriv].
The Zacas extension depends upon the Zaamo extension cite:[unpriv].

[[chapter2]]
=== Word/Doubleword/Quadword CAS (AMOCAS.W/D/Q)
Expand Down
5 changes: 2 additions & 3 deletions src/zawrs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ reached.
[NOTE]
====
The instructions in the Zawrs extension are only useful in conjunction with the
LR instruction, which is provided by the A extension, and which we also expect
to be provided by a narrower Zalrsc extension in the future.
LR instruction, which is provided by the Zalrsc component of the A extension.
====
[[Zawrs]]
=== Wait-on-Reservation-Set Instructions
Expand Down Expand Up @@ -102,4 +101,4 @@ typically not expected to be used in U-mode and on many systems may promptly
cause an illegal instruction exception if used at U-mode. Unlike `WFI`,
`WRS.NTO` is expected to be used by software in U-mode when waiting on
memory but without a deadline for that wait.
====
====

0 comments on commit e87412e

Please sign in to comment.