Skip to content

Commit 0b95c63

Browse files
author
Derek Hower
committed
Merge branch 'main' into iu
2 parents 4ebcd4c + be96f79 commit 0b95c63

25 files changed

+999
-11
lines changed

arch/ext/I.yaml

+38-1
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,47 @@ I:
109109
maximum: 127
110110
MISALIGNED_LDST:
111111
description: |
112-
Whether or not the implementation supports misaligned loads and stores in
112+
Whether or not the implementation supports non-atomic misaligned loads and stores in
113113
main memory (does *not* affect misaligned support to device memory)
114114
schema:
115115
type: boolean
116+
MISALIGNED_LDST_EXCEPTION_PRIORITY:
117+
description: |
118+
The relative priority of a load/store/AMO exception vs. load/store/AMO page-fault
119+
or access-fault exceptions.
120+
121+
May be one of:
122+
123+
[separator="!"]
124+
!===
125+
! high ! Misaligned load/store/AMO exceptions are always higher priority than load/store/AMO page-fault and access-fault exceptions.
126+
! low ! Misaligned load/store/AMO exceptions are always lower priority than load/store/AMO page-fault and access-fault exceptions.
127+
!===
128+
129+
MISALIGNED_LDST_EXCEPTION_PRIORITY cannot be "high" when MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE
130+
is non-zero, since the atomicity of an access cannot be determined in that case until after
131+
address translation.
132+
schema:
133+
type: string
134+
enum: ["high", "low"]
135+
extra_validation: |
136+
assert (MISALIGNED_LDST_EXCEPTION_PRIORITY == "low") if MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE.positive?
137+
MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE:
138+
description: |
139+
The maximum granule size, in bytes, that the hart can atomically perform a
140+
misligned load/store/AMO without raising a Misaligned exception. When MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE is 0, the hart
141+
cannot atomically perform a misaligned load/store/AMO. When a power of two, the hart can
142+
atomically load/store/AMO a misaligned access that is fully contained in a
143+
MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE-aligned region.
144+
145+
[NOTE]
146+
Even if the hart is capable of performing a misligned load/store/AMO atomically,
147+
a misaligned exception may still occur if the access does not have the appropriate
148+
Misaligned Atomicity Granule PMA set.
149+
schema:
150+
type: integer
151+
# can't be larger than a page, since there is no way to reconcile that with virtual memory
152+
enum: [0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]
116153
MISALIGNED_SPLIT_STRATEGY:
117154
description: |
118155
when misaligned accesses are supported, this determines the *order* in the implementation appears

arch/inst/A/amoadd.d.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amoadd.d:
4+
long_name: Atomic fetch-and-add doubleword
5+
description: |
6+
Atomically:
7+
8+
* Load the doubleword at address _rs1_
9+
* Write the loaded value into _rd_
10+
* Add the value of register _rs2_ to the loaded value
11+
* Write the sum to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
base: 64
14+
assembly: xd, xs2, (xrs1)
15+
encoding:
16+
match: 00000------------011-----0101111
17+
variables:
18+
- name: aq
19+
location: 26
20+
- name: rl
21+
location: 27
22+
- name: rs2
23+
location: 24-20
24+
- name: rs1
25+
location: 19-15
26+
- name: rd
27+
location: 11-7
28+
access:
29+
s: always
30+
u: always
31+
vs: always
32+
vu: always
33+
operation(): |
34+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
35+
raise (ExceptionCode::IllegalInstruction, $encoding);
36+
}
37+
38+
XReg virtual_address = X[rs1];
39+
40+
X[rd] = amo<64>(virtual_address, X[rs2], AmoOperation::Add, aq, rl);

arch/inst/A/amoadd.w.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amoadd.w:
4+
long_name: Atomic fetch-and-add word
5+
description: |
6+
Atomically:
7+
8+
* Load the word at address _rs1_
9+
* Write the sign-extended value into _rd_
10+
* Add the least-significant word of register _rs2_ to the loaded value
11+
* Write the sum to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
assembly: xd, xs2, (xrs1)
14+
encoding:
15+
match: 00000------------010-----0101111
16+
variables:
17+
- name: aq
18+
location: 26
19+
- name: rl
20+
location: 27
21+
- name: rs2
22+
location: 24-20
23+
- name: rs1
24+
location: 19-15
25+
- name: rd
26+
location: 11-7
27+
access:
28+
s: always
29+
u: always
30+
vs: always
31+
vu: always
32+
operation(): |
33+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
34+
raise (ExceptionCode::IllegalInstruction, $encoding);
35+
}
36+
37+
XReg virtual_address = X[rs1];
38+
39+
X[rd] = amo<32>(virtual_address, X[rs2][31:0], AmoOperation::Add, aq, rl);

arch/inst/A/amoand.d.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amoand.d:
4+
long_name: Atomic fetch-and-and doubleword
5+
description: |
6+
Atomically:
7+
8+
* Load the doubleword at address _rs1_
9+
* Write the loaded value into _rd_
10+
* AND the value of register _rs2_ to the loaded value
11+
* Write the result to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
base: 64
14+
assembly: xd, xs2, (xrs1)
15+
encoding:
16+
match: 01100------------011-----0101111
17+
variables:
18+
- name: aq
19+
location: 26
20+
- name: rl
21+
location: 27
22+
- name: rs2
23+
location: 24-20
24+
- name: rs1
25+
location: 19-15
26+
- name: rd
27+
location: 11-7
28+
access:
29+
s: always
30+
u: always
31+
vs: always
32+
vu: always
33+
operation(): |
34+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
35+
raise (ExceptionCode::IllegalInstruction, $encoding);
36+
}
37+
38+
XReg virtual_address = X[rs1];
39+
40+
X[rd] = amo<64>(virtual_address, X[rs2], AmoOperation::And, aq, rl);

arch/inst/A/amoand.w.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amoand.w:
4+
long_name: Atomic fetch-and-and word
5+
description: |
6+
Atomically:
7+
8+
* Load the word at address _rs1_
9+
* Write the sign-extended value into _rd_
10+
* AND the least-significant word of register _rs2_ to the loaded value
11+
* Write the result to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
assembly: xd, xs2, (xrs1)
14+
encoding:
15+
match: 01100------------010-----0101111
16+
variables:
17+
- name: aq
18+
location: 26
19+
- name: rl
20+
location: 27
21+
- name: rs2
22+
location: 24-20
23+
- name: rs1
24+
location: 19-15
25+
- name: rd
26+
location: 11-7
27+
access:
28+
s: always
29+
u: always
30+
vs: always
31+
vu: always
32+
operation(): |
33+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
34+
raise (ExceptionCode::IllegalInstruction, $encoding);
35+
}
36+
37+
XReg virtual_address = X[rs1];
38+
39+
X[rd] = amo<32>(virtual_address, X[rs2][31:0], AmoOperation::And, aq, rl);

arch/inst/A/amomax.d.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amomax.d:
4+
long_name: Atomic MAX doubleword
5+
description: |
6+
Atomically:
7+
8+
* Load the doubleword at address _rs1_
9+
* Write the loaded value into _rd_
10+
* Signed compare the value of register _rs2_ to the loaded value, and select the maximum value
11+
* Write the maximum to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
base: 64
14+
assembly: xd, xs2, (xrs1)
15+
encoding:
16+
match: 10100------------011-----0101111
17+
variables:
18+
- name: aq
19+
location: 26
20+
- name: rl
21+
location: 27
22+
- name: rs2
23+
location: 24-20
24+
- name: rs1
25+
location: 19-15
26+
- name: rd
27+
location: 11-7
28+
access:
29+
s: always
30+
u: always
31+
vs: always
32+
vu: always
33+
operation(): |
34+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
35+
raise (ExceptionCode::IllegalInstruction, $encoding);
36+
}
37+
38+
XReg virtual_address = X[rs1];
39+
40+
X[rd] = amo<64>(virtual_address, X[rs2], AmoOperation::Max, aq, rl);

arch/inst/A/amomax.w.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amomax.w:
4+
long_name: Atomic MAX word
5+
description: |
6+
Atomically:
7+
8+
* Load the word at address _rs1_
9+
* Write the sign-extended value into _rd_
10+
* Signed compare the least-significant word of register _rs2_ to the loaded value, and select the maximum value
11+
* Write the maximum to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
assembly: xd, xs2, (xrs1)
14+
encoding:
15+
match: 10100------------010-----0101111
16+
variables:
17+
- name: aq
18+
location: 26
19+
- name: rl
20+
location: 27
21+
- name: rs2
22+
location: 24-20
23+
- name: rs1
24+
location: 19-15
25+
- name: rd
26+
location: 11-7
27+
access:
28+
s: always
29+
u: always
30+
vs: always
31+
vu: always
32+
operation(): |
33+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
34+
raise (ExceptionCode::IllegalInstruction, $encoding);
35+
}
36+
37+
XReg virtual_address = X[rs1];
38+
39+
X[rd] = amo<32>(virtual_address, X[rs2][31:0], AmoOperation::Max, aq, rl);

arch/inst/A/amomaxu.d.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amomaxu.d:
4+
long_name: Atomic MAX unsigned doubleword
5+
description: |
6+
Atomically:
7+
8+
* Load the doubleword at address _rs1_
9+
* Write the loaded value into _rd_
10+
* Unsigned compare the value of register _rs2_ to the loaded value, and select the maximum value
11+
* Write the maximum to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
base: 64
14+
assembly: xd, xs2, (xrs1)
15+
encoding:
16+
match: 11100------------011-----0101111
17+
variables:
18+
- name: aq
19+
location: 26
20+
- name: rl
21+
location: 27
22+
- name: rs2
23+
location: 24-20
24+
- name: rs1
25+
location: 19-15
26+
- name: rd
27+
location: 11-7
28+
access:
29+
s: always
30+
u: always
31+
vs: always
32+
vu: always
33+
operation(): |
34+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
35+
raise (ExceptionCode::IllegalInstruction, $encoding);
36+
}
37+
38+
XReg virtual_address = X[rs1];
39+
40+
X[rd] = amo<64>(virtual_address, X[rs2], AmoOperation::Maxu, aq, rl);

arch/inst/A/amomaxu.w.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
amomaxu.w:
4+
long_name: Atomic MAX unsigned word
5+
description: |
6+
Atomically:
7+
8+
* Load the word at address _rs1_
9+
* Write the sign-extended value into _rd_
10+
* Unsigned compare the least-significant word of register _rs2_ to the loaded value, and select the maximum value
11+
* Write the maximum to the address in _rs1_
12+
definedBy: [A, Zaamo]
13+
assembly: xd, xs2, (xrs1)
14+
encoding:
15+
match: 11100------------010-----0101111
16+
variables:
17+
- name: aq
18+
location: 26
19+
- name: rl
20+
location: 27
21+
- name: rs2
22+
location: 24-20
23+
- name: rs1
24+
location: 19-15
25+
- name: rd
26+
location: 11-7
27+
access:
28+
s: always
29+
u: always
30+
vs: always
31+
vu: always
32+
operation(): |
33+
if (implemented?(ExtensionName::A) && (CSR[misa].A == 1'b0)) {
34+
raise (ExceptionCode::IllegalInstruction, $encoding);
35+
}
36+
37+
XReg virtual_address = X[rs1];
38+
39+
X[rd] = amo<32>(virtual_address, X[rs2][31:0], AmoOperation::Maxu, aq, rl);

0 commit comments

Comments
 (0)