Skip to content

Commit c846a94

Browse files
authored
chore: get instruction appendix ready for release (#708)
This does several things: * fix(build): make instruction appendix dependent on docs-resources * fix: remove stray '<' in instruction appendix pages * refactor: use cfg_arch.possible_instructions to get appendix list * Also removes InstructionIndex class (redundant now) * ci: only generate asciidoc for instruction appendix regress * ci: add instruction appendix to deployment * ci: adds and checks a golden output for instruction appendix
1 parent 6ee7900 commit c846a94

File tree

22 files changed

+43044
-211
lines changed

22 files changed

+43044
-211
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN \
2929
libyaml-dev \
3030
nodejs \
3131
npm \
32+
parallel \
3233
python3 \
3334
python3-pip \
3435
python3.12-venv \

.github/workflows/regress.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ jobs:
6262
uses: actions/checkout@v4
6363
- name: singularity setup
6464
uses: ./.github/actions/singularity-setup
65-
- name: Generate instruction appendix
66-
run: ./do gen:instruction_appendix
65+
- name: Generate instruction appendix asciidoc
66+
run: ./do gen:instruction_appendix_adoc
67+
- name: Check instruction appendix result
68+
run: ./do test:instruction_appendix
6769
regress-cfg-manual:
6870
runs-on: ubuntu-latest
6971
env:

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ repos:
1919
stages: [pre-commit]
2020
- id: end-of-file-fixer
2121
stages: [pre-commit]
22+
exclude: \.golden.adoc$
2223
- id: trailing-whitespace
2324
stages: [pre-commit]
2425
args: [--markdown-linebreak-ext=md]

arch/inst/Zawrs/wrs.nto.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,37 @@ kind: instruction
55
name: wrs.nto
66
long_name: Wait-on-Reservation-Set-with-No-Timeout
77
description: |
8-
-id: inst-wrs.nto-behaviour
9-
-normative: false
10-
-text: |
11-
To mitigate the wasteful looping in such usages, a `wrs.nto` (WRS-with-no-timeout) instruction is provided.
12-
Instead of polling for a store to a specific memory location, software registers a reservation set that
13-
includes all the bytes of the memory location using the LR instruction. Then a subsequent `wrs.nto`
14-
instruction would cause the hart to temporarily stall execution in a low-power state until a store
15-
occurs to the reservation set or an interrupt is observed.
8+
To mitigate the wasteful looping in such usages, a `wrs.nto` (WRS-with-no-timeout) instruction is provided.
9+
Instead of polling for a store to a specific memory location, software registers a reservation set that
10+
includes all the bytes of the memory location using the LR instruction. Then a subsequent `wrs.nto`
11+
instruction would cause the hart to temporarily stall execution in a low-power state until a store
12+
occurs to the reservation set or an interrupt is observed.
1613
17-
This instruction is not supported in a constrained LR/SC loop.
18-
While stalled, an implementation is permitted to occasionally terminate the stall and complete
19-
execution for any reason.
14+
This instruction is not supported in a constrained LR/SC loop.
15+
While stalled, an implementation is permitted to occasionally terminate the stall and complete
16+
execution for any reason.
2017
21-
`wrs.nto` follows the rules of the WFI instruction for resuming execution
22-
on a pending interrupt.
18+
`wrs.nto` follows the rules of the WFI instruction for resuming execution
19+
on a pending interrupt.
2320
24-
When the TW (Timeout Wait) bit in `mstatus` is set and `wrs.nto` is executed
25-
in any privilege mode otherthan M mode, and it does not complete within an implementation-specific
26-
bounded time limit, the `wrs.nto` instruction will cause an illegal instruction exception.
21+
When the TW (Timeout Wait) bit in `mstatus` is set and `wrs.nto` is executed
22+
in any privilege mode otherthan M mode, and it does not complete within an implementation-specific
23+
bounded time limit, the `wrs.nto` instruction will cause an illegal instruction exception.
2724
28-
When executing in VS or VU mode, if the VTW bit is set in `hstatus`, the TW bit in `mstatus` is clear,
29-
and the `wrs.nto` does not complete within an implementation-specific bounded time limit,
30-
the `wrs.nto` instruction will cause a virtual instruction exception.
25+
When executing in VS or VU mode, if the VTW bit is set in `hstatus`, the TW bit in `mstatus` is clear,
26+
and the `wrs.nto` does not complete within an implementation-specific bounded time limit,
27+
the `wrs.nto` instruction will cause a virtual instruction exception.
3128
32-
[Note]
33-
Since `wrs.nto` can complete execution for reasons other than stores to the reservation set,
34-
software will likely need a means of looping until the required stores have occurred.
29+
[Note]
30+
Since `wrs.nto` can complete execution for reasons other than stores to the reservation set,
31+
software will likely need a means of looping until the required stores have occurred.
3532
36-
[Note]
37-
`wrs.nto`, unlike WFI, is not specified to cause an illegal instruction exception if executed in U-mode
38-
when the governing TW bit is 0. WFI is typically not expected to be used in U-mode and on many systems
39-
may promptly cause an illegal instruction exception if used at U-mode.
40-
Unlike WFI, `wrs.nto` is expected to be used by software in U-mode when waiting on memory but without
41-
a deadline for that wait.
33+
[Note]
34+
`wrs.nto`, unlike WFI, is not specified to cause an illegal instruction exception if executed in U-mode
35+
when the governing TW bit is 0. WFI is typically not expected to be used in U-mode and on many systems
36+
may promptly cause an illegal instruction exception if used at U-mode.
37+
Unlike WFI, `wrs.nto` is expected to be used by software in U-mode when waiting on memory but without
38+
a deadline for that wait.
4239
definedBy: Zawrs
4340
assembly: ""
4441
encoding:

arch/inst/Zawrs/wrs.sto.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,33 @@ kind: instruction
55
name: wrs.sto
66
long_name: Wait-on-Reservation-Set-with-Short-Timeout
77
description: |
8-
-id: inst-wrs.sto-behaviour
9-
-normative: false
10-
-text: |
11-
Instead of polling for a store to a specific memory location, software registers a
12-
reservation set that includes all the bytes of the memory location using the LR instruction.
13-
A subsequent `wrs.sto` instruction would cause the hart to temporarily stall execution in a
14-
low-power state until a store occurs to the reservation set or an interrupt is observed.
15-
Sometimes the program waiting on a memory update may also need to carry out a task at a future time
16-
or otherwise place an upper bound on the wait. To support such use cases, `wrs.sto` bounds the
17-
stall duration to an implementation-define short timeout such that the stall is terminated on the
18-
timeout if no other conditions have occurred to terminate the stall. The program using this instruction
19-
may then determine if its deadline has been reached.
20-
`wrs.sto` causes the hart to temporarily stall execution in a low-power state as long as the reservation
21-
set is valid and no pending interrupts, even if disabled, are observed. For `wrs.sto` the stall duration
22-
is bounded by an implementation defined short timeout. These instructions are not supported in a
23-
constrained LR/SC loop.
24-
Hart execution may be stalled while the following conditions are all satisfied:
25-
a. The reservation set is valid
26-
b. If `wrs.sto`, a "short" duration since start of stall has not elapsed
27-
c. No pending interrupt is observed (see the rules below)
8+
Instead of polling for a store to a specific memory location, software registers a
9+
reservation set that includes all the bytes of the memory location using the LR instruction.
10+
A subsequent `wrs.sto` instruction would cause the hart to temporarily stall execution in a
11+
low-power state until a store occurs to the reservation set or an interrupt is observed.
12+
Sometimes the program waiting on a memory update may also need to carry out a task at a future time
13+
or otherwise place an upper bound on the wait. To support such use cases, `wrs.sto` bounds the
14+
stall duration to an implementation-define short timeout such that the stall is terminated on the
15+
timeout if no other conditions have occurred to terminate the stall. The program using this instruction
16+
may then determine if its deadline has been reached.
17+
`wrs.sto` causes the hart to temporarily stall execution in a low-power state as long as the reservation
18+
set is valid and no pending interrupts, even if disabled, are observed. For `wrs.sto` the stall duration
19+
is bounded by an implementation defined short timeout. These instructions are not supported in a
20+
constrained LR/SC loop.
21+
Hart execution may be stalled while the following conditions are all satisfied:
22+
a. The reservation set is valid
23+
b. If `wrs.sto`, a "short" duration since start of stall has not elapsed
24+
c. No pending interrupt is observed (see the rules below)
2825
29-
While stalled, an implementation is permitted to occasionally terminate the stall and complete
30-
execution for any reason. `wrs.sto` follows the rules of the WFI instruction for resuming execution
31-
on a pending interrupt. Since `wrs.sto` can complete execution for reasons other than stores to
32-
the reservation set, software will likely need a means of looping until the required stores have occurred.
26+
While stalled, an implementation is permitted to occasionally terminate the stall and complete
27+
execution for any reason. `wrs.sto` follows the rules of the WFI instruction for resuming execution
28+
on a pending interrupt. Since `wrs.sto` can complete execution for reasons other than stores to
29+
the reservation set, software will likely need a means of looping until the required stores have occurred.
3330
34-
[Note]
35-
The duration of a `wrs.sto` instruction's timeout may vary significantly within and among implementations.
36-
In typical implementations this duration should be roughly in the range of 10 to 100 times an on-chip
37-
cache miss latency or a cacheless access to main memory.
31+
[Note]
32+
The duration of a `wrs.sto` instruction's timeout may vary significantly within and among implementations.
33+
In typical implementations this duration should be roughly in the range of 10 to 100 times an on-chip
34+
cache miss latency or a cacheless access to main memory.
3835
definedBy: Zawrs
3936
assembly: ""
4037
encoding:

arch/inst/Zicsr/csrrc.yaml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,18 @@ kind: instruction
55
name: csrrc
66
long_name: Atomic Read and Clear Bits in CSR
77
description: |
8-
-id: inst-csrrc-behavior
9-
-normative: false
10-
-text: |
11-
The CSRRC (Atomic Read and Clear Bits in CSR) instruction reads the value of the CSR, zero-extends
12-
the value to XLEN bits, and writes it to integer register `rd`. The initial value in integer register `rs1` is
13-
treated as a bit mask that specifies bit positions to be cleared in the CSR. Any bit that is high in `rs1` will
14-
cause the corresponding bit to be cleared in the CSR, if that CSR bit is writable.
8+
The CSRRC (Atomic Read and Clear Bits in CSR) instruction reads the value of the CSR, zero-extends
9+
the value to XLEN bits, and writes it to integer register `rd`. The initial value in integer register `rs1` is
10+
treated as a bit mask that specifies bit positions to be cleared in the CSR. Any bit that is high in `rs1` will
11+
cause the corresponding bit to be cleared in the CSR, if that CSR bit is writable.
1512
16-
For CSRRC, if `rs1=x0`, then the instruction will not write to the CSR at all, and so shall
17-
not cause any of the side effects that might otherwise occur on a CSR write, nor raise illegal-
18-
instruction exceptions on accesses to read-only CSRs. CSRRC always reads the addressed CSR and
19-
cause any read side effects regardless of `rs1` and `rd` fields.
20-
Note that if `rs1` specifies a register other than `x0`, and that register holds a zero value,
21-
the instruction will not action any attendant per-field side effects, but will action any
22-
side effects caused by writing to the entire CSR.
13+
For CSRRC, if `rs1=x0`, then the instruction will not write to the CSR at all, and so shall
14+
not cause any of the side effects that might otherwise occur on a CSR write, nor raise illegal-
15+
instruction exceptions on accesses to read-only CSRs. CSRRC always reads the addressed CSR and
16+
cause any read side effects regardless of `rs1` and `rd` fields.
17+
Note that if `rs1` specifies a register other than `x0`, and that register holds a zero value,
18+
the instruction will not action any attendant per-field side effects, but will action any
19+
side effects caused by writing to the entire CSR.
2320
definedBy: Zicsr
2421
assembly: xd, csr, xs1
2522
encoding:

arch/inst/Zicsr/csrrci.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ kind: instruction
55
name: csrrci
66
long_name: Atomic Read and Clear Bits in CSR with Immediate
77
description: |
8-
-id: inst-csrrci-behavior
9-
-normative: false
10-
-text: |
11-
The CSRRCI variant is similar to CSRRC, except this updates the CSR using an XLEN-bit value obtained
12-
by zero-extending a 5-bit unsigned immediate (uimm[4:0]) field encoded in the `rs1` field instead of a
13-
value from an integer register. For CSRRCI, if the `uimm[4:0]` field is zero, then this instruction
14-
will not write to the CSR, and shall not cause any of the side effects that might otherwise occur on
15-
a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs. The CSRRCI will
16-
always read the CSR and cause any read side effects regardless of `rd` and `rs1` fields.
8+
The CSRRCI variant is similar to CSRRC, except this updates the CSR using an XLEN-bit value obtained
9+
by zero-extending a 5-bit unsigned immediate (uimm[4:0]) field encoded in the `rs1` field instead of a
10+
value from an integer register. For CSRRCI, if the `uimm[4:0]` field is zero, then this instruction
11+
will not write to the CSR, and shall not cause any of the side effects that might otherwise occur on
12+
a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs. The CSRRCI will
13+
always read the CSR and cause any read side effects regardless of `rd` and `rs1` fields.
1714
definedBy: Zicsr
1815
assembly: xd, csr, uimm
1916
encoding:

arch/inst/Zicsr/csrrsi.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ kind: instruction
55
name: csrrsi
66
long_name: Atomic Read and Set Bits in CSR with Immediate
77
description: |
8-
-id: inst-csrrsi-behavior
9-
-normative: false
10-
-text: |
11-
The CSRRSI variant is similar to CSRRS, except this updates the CSR using an XLEN-bit value obtained
12-
by zero-extending a 5-bit unsigned immediate (uimm[4:0]) field encoded in the `rs1` field instead of a
13-
value from an integer register. For CSRRSI, if the `uimm[4:0]` field is zero, then this instruction
14-
will not write to the CSR, and shall not cause any of the side effects that might otherwise occur on
15-
a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs. The CSRRSI will
16-
always read the CSR and cause any read side effects regardless of `rd` and `rs1` fields.
8+
The CSRRSI variant is similar to CSRRS, except this updates the CSR using an XLEN-bit value obtained
9+
by zero-extending a 5-bit unsigned immediate (uimm[4:0]) field encoded in the `rs1` field instead of a
10+
value from an integer register. For CSRRSI, if the `uimm[4:0]` field is zero, then this instruction
11+
will not write to the CSR, and shall not cause any of the side effects that might otherwise occur on
12+
a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs. The CSRRSI will
13+
always read the CSR and cause any read side effects regardless of `rd` and `rs1` fields.
1714
definedBy: Zicsr
1815
assembly: xd, csr, uimm
1916
encoding:

arch/inst/Zkn/aes64ks1i.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ $schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64ks1i
66
long_name: AES Key Schedule Instruction 1
7-
description: |
8-
-id: inst-aes64ks1i-behavior
9-
-normative: true
10-
-text: |
11-
This instruction implements the rotation, SubBytes and Round Constant addition steps of the AES
12-
block cipher Key Schedule. This instruction must _always_ be implemented such that its execution
13-
latency does not depend on the data being operated on. Note that `rnum` must be in the range
14-
`0x0..0xA`. The values `0xB..0xF` are reserved.
7+
description:
8+
- id: inst-aes64ks1i-behavior
9+
normative: true
10+
text: |
11+
This instruction implements the rotation, SubBytes and Round Constant addition steps of the AES
12+
block cipher Key Schedule.
13+
- id: inst-aes64ks1i-range
14+
normative: true
15+
text: |
16+
`rnum` must be in the range `0x0..0xA`. The values `0xB..0xF` are reserved.
1517
definedBy:
1618
anyOf: [Zknd, Zkne]
1719
base: 64

arch/inst/Zkn/aes64ks2.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ $schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64ks2
66
long_name: AES Key Schedule Instruction 2
7-
description: |
8-
-id: instr-aes64ks2-behavior
9-
-normative: true
10-
-text: |
11-
This instruction implements the additional XOR'ing of key words as part of the AES block cipher
12-
Key Schedule. This instruction must _always_ be implemented such that its execution latency does
13-
not depend on the data being operated on.
7+
description:
8+
- id: instr-aes64ks2-behavior
9+
normative: true
10+
text: |
11+
This instruction implements the additional XOR'ing of key words as part of the AES block cipher
12+
Key Schedule.
1413
definedBy:
1514
anyOf: [Zknd, Zkne]
1615
base: 64

0 commit comments

Comments
 (0)