Skip to content

Commit 4c2fad7

Browse files
Merge branch 'main' into Zclsd_extension
2 parents 3ba465c + 6e7c74c commit 4c2fad7

25 files changed

+43100
-111
lines changed

.devcontainer/Dockerfile

+1
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 \

.devcontainer/devcontainer.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@
2525
"asciidoc.antora.showEnableAntoraPrompt": true
2626
},
2727
"extensions": [
28-
"castwide.solargraph",
29-
"redhat.vscode-yaml",
3028
"asciidoctor.asciidoctor-vscode",
31-
"zhwu95.riscv",
32-
"mathematic.vscode-pdf",
29+
"castwide.solargraph",
3330
"CraigMaslowski.erb",
3431
"HowerLimited.udb-extension-pack-vscode",
35-
"sorbet.sorbet-vscode-extension"
32+
"mathematic.vscode-pdf",
33+
"redhat.vscode-yaml",
34+
"zhwu95.riscv"
3635
]
3736
}
3837
},

.github/workflows/regress.yml

+20-3
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:
@@ -134,7 +136,6 @@ jobs:
134136
rm -rf ext/llvm-project
135137
git submodule sync --recursive
136138
git submodule update --init --recursive --depth=1 ext/llvm-project
137-
138139
- name: Check for required directories and files
139140
if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }}
140141
run: |
@@ -158,6 +159,11 @@ jobs:
158159
-o ext/llvm-project/riscv.json
159160
- name: Show riscv.json output
160161
run: ls -l ext/llvm-project/riscv.json
162+
- name: Upload RISC-V JSON as Artifact
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: riscv-json
166+
path: ext/llvm-project/riscv.json
161167
regress-gen-go:
162168
runs-on: ubuntu-latest
163169
env:
@@ -169,6 +175,17 @@ jobs:
169175
uses: ./.github/actions/singularity-setup
170176
- name: Generate Go code
171177
run: ./do gen:go
178+
regress-gen-c-header:
179+
runs-on: ubuntu-latest
180+
env:
181+
SINGULARITY: 1
182+
steps:
183+
- name: Clone Github Repo Action
184+
uses: actions/checkout@v4
185+
- name: singularity setup
186+
uses: ./.github/actions/singularity-setup
187+
- name: Generate c_header code
188+
run: ./do gen:c_header
172189
regress-cpp-unit:
173190
runs-on: ubuntu-latest
174191
env:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
.asciidoctor
1010
.vscode/*
1111
!.vscode/launch.json
12+
!.vscode/extensions.json
1213
.container-type
1314
diag-ditaa-*
1415
arch/manual/isa/**/riscv-isa-manual

.pre-commit-config.yaml

+1
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]

.vscode/extensions.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"recommendations": [
3+
"asciidoctor.asciidoctor-vscode",
4+
"castwide.solargraph",
5+
"CraigMaslowski.erb",
6+
"HowerLimited.udb-extension-pack-vscode",
7+
"mathematic.vscode-pdf",
8+
"redhat.vscode-yaml",
9+
"zhwu95.riscv"
10+
]
11+
}

arch/inst/Zawrs/wrs.nto.yaml

+33-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,41 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: wrs.nto
6-
long_name: No synopsis available
6+
long_name: Wait-on-Reservation-Set-with-No-Timeout
77
description: |
8-
No description available.
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.
13+
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.
17+
18+
`wrs.nto` follows the rules of the WFI instruction for resuming execution
19+
on a pending interrupt.
20+
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.
24+
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.
28+
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.
32+
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.
939
definedBy: Zawrs
10-
assembly: wrs_nto
40+
assembly: ""
1141
encoding:
1242
match: "00000000110100000000000001110011"
1343
variables: []

arch/inst/Zawrs/wrs.sto.yaml

+29-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,37 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: wrs.sto
6-
long_name: No synopsis available
6+
long_name: Wait-on-Reservation-Set-with-Short-Timeout
77
description: |
8-
No description available.
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)
25+
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.
30+
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.
935
definedBy: Zawrs
10-
assembly: wrs_sto
36+
assembly: ""
1137
encoding:
1238
match: "00000001110100000000000001110011"
1339
variables: []

arch/inst/Zicsr/csrrc.yaml

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33
$schema: inst_schema.json#
44
kind: instruction
55
name: csrrc
6-
long_name: No synopsis available
6+
long_name: Atomic Read and Clear Bits in CSR
77
description: |
8-
No description available.
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.
12+
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.
920
definedBy: Zicsr
10-
assembly: xd, imm, xs1
21+
assembly: xd, csr, xs1
1122
encoding:
1223
match: -----------------011-----1110011
1324
variables:

arch/inst/Zicsr/csrrci.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
$schema: inst_schema.json#
44
kind: instruction
55
name: csrrci
6-
long_name: No synopsis available
6+
long_name: Atomic Read and Clear Bits in CSR with Immediate
77
description: |
8-
No description available.
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.
914
definedBy: Zicsr
1015
assembly: xd, csr, uimm
1116
encoding:

arch/inst/Zicsr/csrrsi.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
$schema: inst_schema.json#
44
kind: instruction
55
name: csrrsi
6-
long_name: No synopsis available
6+
long_name: Atomic Read and Set Bits in CSR with Immediate
77
description: |
8-
No description available.
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.
914
definedBy: Zicsr
1015
assembly: xd, csr, uimm
1116
encoding:

arch/inst/Zkn/aes64ks1i.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64ks1i
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
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.
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.
917
definedBy:
1018
anyOf: [Zknd, Zkne]
1119
base: 64

arch/inst/Zkn/aes64ks2.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64ks2
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
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.
913
definedBy:
1014
anyOf: [Zknd, Zkne]
1115
base: 64

arch/inst/Zknd/aes64ds.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64ds
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
long_name: AES decrypt final round
7+
description:
8+
- id: inst-aes64ds-behavior
9+
normative: true
10+
text: |
11+
Uses the two 64-bit source registers to represent the entire AES state, and produces _half_ of the next
12+
round output, applying the Inverse ShiftRows and SubBytes steps.
913
definedBy: Zknd
1014
base: 64
1115
assembly: xd, xs1, xs2

arch/inst/Zknd/aes64dsm.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64dsm
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
long_name: AES decrypt middle round
7+
description:
8+
- id: inst-aes64dsm-behavior
9+
normative: true
10+
text: |
11+
Uses the two 64-bit source registers to represent the entire AES state, and produces _half_ of the next
12+
round output, applying the Inverse ShiftRows, SubBytes and MixColumns steps.
913
definedBy: Zknd
1014
base: 64
1115
assembly: xd, xs1, xs2

arch/inst/Zknd/aes64im.yaml

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64im
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
long_name: AES Decrypt KeySchedule MixColumns
7+
description:
8+
- id: inst-aes64im-behavior
9+
normative: true
10+
text: |
11+
The instruction applies the inverse MixColumns transformation to two columns of the state array,
12+
packed into a single 64-bit register. It is used to create the inverse cipher KeySchedule, according to
13+
the equivalent inverse cipher construction in (NIST, 2001) (Page 23, Section 5.3.5).
914
definedBy: Zknd
1015
base: 64
1116
assembly: xd, xs1

arch/inst/Zkne/aes64es.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64es
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
long_name: AES encrypt final round
7+
description:
8+
- id: inst-aes64es-behavior
9+
normative: true
10+
text: |
11+
Uses the two 64-bit source registers to represent the entire AES state, and produces _half_ of the next
12+
round output, applying the ShiftRows and SubBytes steps.
913
definedBy: Zkne
1014
base: 64
1115
assembly: xd, xs1, xs2

arch/inst/Zkne/aes64esm.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64esm
6-
long_name: No synopsis available
7-
description: |
8-
No description available.
6+
long_name: AES encrypt middle round
7+
description:
8+
- id: inst-aes64esm-behavior
9+
normative: true
10+
text: |
11+
Uses the two 64-bit source registers to represent the entire AES state, and produces _half_ of the next
12+
round output, applying the Inverse ShiftRows, SubBytes and MixColumns steps.
913
definedBy: Zkne
1014
base: 64
1115
assembly: xd, xs1, xs2

0 commit comments

Comments
 (0)