Skip to content

Commit

Permalink
Contribute ARC feedback on Zilsd (#45)
Browse files Browse the repository at this point in the history
* add newline at EOF

* contribute ARC recommendations

* Update zilsd.adoc

Co-authored-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Andrew Waterman <aswaterman@gmail.com>

* Update zilsd.adoc

Co-authored-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Andrew Waterman <aswaterman@gmail.com>

* Update zilsd.adoc

Co-authored-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: Andrew Waterman <aswaterman@gmail.com>

---------

Signed-off-by: Andrew Waterman <aswaterman@gmail.com>
Co-authored-by: Christian Herber <christian.herber@oss.nxp.com>
  • Loading branch information
aswaterman and christian-herber-nxp authored Sep 18, 2024
1 parent 5654a38 commit 53a1637
Showing 1 changed file with 22 additions and 37 deletions.
59 changes: 22 additions & 37 deletions zilsd.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,42 +87,27 @@ LD instructions with destination `x0` are processed as any other load, but the r

When using `x0` as `src` of SD or C.SDSP, the entire 64-bit operand is zero — i.e., register `x1` is not accessed.

=== Fault Handling

In implementations that crack Zilsd instructions for sequential execution, correct execution requires addressing idempotent memory, because the hart must be able to handle traps detected during the sequence. The entire sequence is re-executed after returning from the trap handler, and multiple traps are possible during the sequence.

[NOTE]
====
It is implementation defined whether interrupts can also be taken during the sequence execution.
====

=== Software view of the load/store pair sequence

From a software perspective load/store pair instructions appear as:

* load instructions:
** A sequence of one or more loads reading the bytes of the doubleword without updating rd or rd+1
*** If the effective address is 4B aligned:
**** The bytes are grouped into word accesses.
**** The words may be loaded in any order.
**** The words may be grouped into doublewords accesses.
**** Any of the words may be loaded multiple times.
*** Else:
**** The bytes may be loaded in any order.
**** The bytes may be grouped into larger accesses.
**** Any of the bytes may be loaded multiple times.
** An atomic write of the load result into rd and rd+1
* store instructions:
** A sequence of one or more stores writing the bytes of the doubleword
*** If the effective address is 4B aligned:
**** The bytes are grouped into word accesses.
**** The words may be stored in any order.
**** The words may be grouped into doublewords accesses.
**** Any of the words may be stored multiple times.
*** Else:
**** The bytes may be stored in any order.
**** The bytes may be grouped into larger accesses.
**** Any of the bytes may be stored multiple times.
=== Exception Handling

For the purposes of RVWMO and exception handling, LD and SD instructions are
considered to be misaligned loads and stores, with one additional constraint:
an LD or SD instruction whose effective address is a multiple of 4 gives rise
to two 4-byte memory operations.

NOTE: This definition permits LD and SD instructions giving rise to exactly one
memory access, regardless of alignment.
If instructions with 4-byte-aligned effective address are decomposed
into two 32b operations, there is no constraint on the order in which the
operations are performed and each operation is guaranteed to be atomic.
These decomposed sequences are interruptible.
Exceptions might occur on subsequent operations, making the effects of previous
operations within the same instruction visible.

NOTE: Software should make no assumptions about the number or order of
accessses these instructions might give rise to, beyond the 4-byte constraint
mentioned above.
For example, an interrupted store might overwrite the same bytes upon return
from the interrupt handler.

<<<

Expand Down Expand Up @@ -300,4 +285,4 @@ Stores a 64-bit value from registers `rs2'` and `rs2'+1`.
It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1'.
It expands to `sd rs2', offset(rs1')`.

Included in: <<zclsd>>
Included in: <<zclsd>>

0 comments on commit 53a1637

Please sign in to comment.