Skip to content

Commit 9484dc9

Browse files
Merge branch 'add-ssqosid-csr-yaml' of https://github.com/syedowaisalishah/riscv-unified-db into add-ssqosid-csr-yaml
2 parents 04e166e + 9185363 commit 9484dc9

File tree

19 files changed

+635
-39
lines changed

19 files changed

+635
-39
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 5 deletions
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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ jobs:
134134
rm -rf ext/llvm-project
135135
git submodule sync --recursive
136136
git submodule update --init --recursive --depth=1 ext/llvm-project
137-
138137
- name: Check for required directories and files
139138
if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }}
140139
run: |
@@ -158,6 +157,11 @@ jobs:
158157
-o ext/llvm-project/riscv.json
159158
- name: Show riscv.json output
160159
run: ls -l ext/llvm-project/riscv.json
160+
- name: Upload RISC-V JSON as Artifact
161+
uses: actions/upload-artifact@v4
162+
with:
163+
name: riscv-json
164+
path: ext/llvm-project/riscv.json
161165
regress-gen-go:
162166
runs-on: ubuntu-latest
163167
env:
@@ -169,6 +173,17 @@ jobs:
169173
uses: ./.github/actions/singularity-setup
170174
- name: Generate Go code
171175
run: ./do gen:go
176+
regress-gen-c-header:
177+
runs-on: ubuntu-latest
178+
env:
179+
SINGULARITY: 1
180+
steps:
181+
- name: Clone Github Repo Action
182+
uses: actions/checkout@v4
183+
- name: singularity setup
184+
uses: ./.github/actions/singularity-setup
185+
- name: Generate c_header code
186+
run: ./do gen:c_header
172187
regress-cpp-unit:
173188
runs-on: ubuntu-latest
174189
env:

.gitignore

Lines changed: 1 addition & 0 deletions
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

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
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

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,44 @@
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+
-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.
16+
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.
20+
21+
`wrs.nto` follows the rules of the WFI instruction for resuming execution
22+
on a pending interrupt.
23+
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.
27+
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.
31+
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.
35+
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.
942
definedBy: Zawrs
10-
assembly: wrs_nto
43+
assembly: ""
1144
encoding:
1245
match: "00000000110100000000000001110011"
1346
variables: []

arch/inst/Zawrs/wrs.sto.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,40 @@
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+
-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)
28+
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.
33+
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.
938
definedBy: Zawrs
10-
assembly: wrs_sto
39+
assembly: ""
1140
encoding:
1241
match: "00000001110100000000000001110011"
1342
variables: []

arch/inst/Zicsr/csrrc.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@
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+
-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.
15+
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.
923
definedBy: Zicsr
10-
assembly: xd, imm, xs1
24+
assembly: xd, csr, xs1
1125
encoding:
1226
match: -----------------011-----1110011
1327
variables:

arch/inst/Zicsr/csrrci.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
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+
-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.
917
definedBy: Zicsr
1018
assembly: xd, csr, uimm
1119
encoding:

arch/inst/Zicsr/csrrsi.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
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+
-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.
917
definedBy: Zicsr
1018
assembly: xd, csr, uimm
1119
encoding:

arch/inst/Zkn/aes64ks1i.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: aes64ks1i
6-
long_name: No synopsis available
6+
long_name: AES Key Schedule Instruction 1
77
description: |
8-
No description available.
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.
915
definedBy:
1016
anyOf: [Zknd, Zkne]
1117
base: 64

0 commit comments

Comments
 (0)