Skip to content

Commit 2bbeb59

Browse files
committed
Merge branch 'main' into H_CSRs
2 parents 626384d + b45a89f commit 2bbeb59

File tree

474 files changed

+1865
-1550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

474 files changed

+1865
-1550
lines changed

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,47 @@ repos:
4646
rev: 0.33.0
4747
hooks:
4848
- id: check-jsonschema
49+
name: Validate instruction files with jsonschema
4950
stages: [pre-commit]
5051
alias: check-jsonschema-inst
5152
files: ^arch/inst/.*\.(yaml|yml)$
5253
args: ["--schemafile", "schemas/inst_schema.json"]
5354
- id: check-jsonschema
55+
name: Validate CSR files with jsonschema
5456
stages: [pre-commit]
5557
alias: check-jsonschema-csr
5658
files: ^arch/csr/.*\.(yaml|yml)$
5759
args: ["--schemafile", "schemas/csr_schema.json"]
5860
- id: check-jsonschema
61+
name: Validate extension files with jsonschema
5962
stages: [pre-commit]
6063
alias: check-jsonschema-ext
6164
files: ^arch/ext/.*\.(yaml|yml)$
6265
args: ["--schemafile", "schemas/ext_schema.json"]
6366
- id: check-jsonschema
67+
name: Validate cert model files with jsonschema
6468
stages: [pre-commit]
6569
alias: check-jsonschema-cert-model
6670
files: ^arch/proc_cert_model/.*\.(yaml|yml)$
6771
args: ["--schemafile", "schemas/proc_cert_model_schema.json"]
6872
- id: check-jsonschema
73+
name: Validate cert class files with jsonschema
6974
stages: [pre-commit]
7075
alias: check-jsonschema-cert-class
7176
files: ^arch/proc_cert_class/.*\.(yaml|yml)$
7277
args: ["--schemafile", "schemas/proc_cert_class_schema.json"]
78+
- id: check-jsonschema
79+
name: Validate profile family files with jsonschema
80+
stages: [pre-commit]
81+
alias: check-jsonschema-profile-family
82+
files: ^arch/profile_family/.*\.(yaml|yml)$
83+
args: ["--schemafile", "schemas/profile_family_schema.json"]
84+
- id: check-jsonschema
85+
name: Validate profile release files with jsonschema
86+
stages: [pre-commit]
87+
alias: check-jsonschema-profile-release
88+
files: ^arch/profile_release/.*\.(yaml|yml)$
89+
args: ["--schemafile", "schemas/profile_release_schema.json"]
7390
# Commenting because throwing errors and not sure this is complete yet
7491
# - id: check-jsonschema
7592
# alias: check-jsonschema-manual-version

arch/csr/H/vsie.yaml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ description:
3737
priv_mode: VS
3838
definedBy: H
3939
length: VSXLEN
40+
41+
sw_read(): |
42+
let value = 0;
43+
if (CSR[hideleg][2]) {
44+
value |= (CSR[hie].VSSIE[0] << 1);
45+
}
46+
if (CSR[hideleg][6]) {
47+
value |= (CSR[hie].VSTIE[0] << 5);
48+
}
49+
if (CSR[hideleg][10]) {
50+
value |= (CSR[hie].VSEIE[0] << 9);
51+
}
52+
if (CSR[hideleg][13]) {
53+
value |= (CSR[sie].LCOFIE[0] << 13);
54+
}
55+
return value;
56+
4057
fields:
4158
SSIE:
4259
location: 1
@@ -45,23 +62,22 @@ fields:
4562
alias: hie.VSSIE[0]
4663
description: |
4764
SSIE. Read-only zero when hideleg[2] is 0. Else, alias of hie.VSSIE.
48-
sw_read(): |
49-
if (CSR[hideleg].S == 1) {
50-
return CSR[hie].VSSIE[0];
51-
} else {
52-
return 0;
53-
}
54-
sw_write(csr_value): |
55-
if (CSR[hideleg].S == 1) {
56-
CSR[hie].VSSIE[0] = csr_value.VSSIE & ((1 << NUM_VSSI) - 1);
65+
"sw_write(csr_value)": |
66+
if (CSR[hideleg][2]) {
67+
CSR[hie].VSSIE[0] = (csr_value >> 1) & 1;
5768
}
69+
5870
STIE:
5971
location: 5
6072
type: RW-H
6173
reset_value: UNDEFINED_LEGAL
6274
alias: hie.VSTIE[0]
6375
description: |
6476
STIE. Read-only zero when hideleg[6] is 0. Else, alias of hie.VSTIE.
77+
"sw_write(csr_value)": |
78+
if (CSR[hideleg][6]) {
79+
CSR[hie].VSTIE[0] = (csr_value >> 5) & 1;
80+
}
6581
6682
SEIE:
6783
location: 9
@@ -70,6 +86,10 @@ fields:
7086
alias: hie.VSEIE[0]
7187
description: |
7288
SEIE. Read-only zero when hideleg[10] is 0. Else, alias of hie.VSEIE.
89+
"sw_write(csr_value)": |
90+
if (CSR[hideleg][10]) {
91+
CSR[hie].VSEIE[0] = (csr_value >> 9) & 1;
92+
}
7393
7494
LCOFIE:
7595
location: 13
@@ -78,3 +98,7 @@ fields:
7898
alias: sie.LCOFIE[0]
7999
description: |
80100
LCOFIE. Read-only zero when hideleg[13] is 0. Else, alias of sie.LCOFIE.
101+
"sw_write(csr_value)": |
102+
if (CSR[hideleg][13]) {
103+
CSR[sie].LCOFIE[0] = (csr_value >> 13) & 1;
104+
}

arch/csr/H/vsip.yaml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ description:
2727
priv_mode: VS
2828
definedBy: H
2929
length: VSXLEN
30+
sw_read(): |
31+
val = 0;
32+
if (CSR[hideleg].S == 1) {
33+
val |= (CSR[hip].VSSIP[0] << 1);
34+
}
35+
if (CSR[hideleg].ST == 1) {
36+
val |= (CSR[hip].VSTIP[0] << 5);
37+
}
38+
if (CSR[hideleg].SE == 1) {
39+
val |= (CSR[hip].VSEIP[0] << 9);
40+
}
41+
if (CSR[hideleg].LCOF == 1) {
42+
val |= (CSR[sip].LCOFIP[0] << 13);
43+
}
44+
return val;
45+
3046
fields:
3147
SSIP:
3248
location: 1
@@ -35,29 +51,26 @@ fields:
3551
alias: hip.VSSIP[0]
3652
description: |
3753
*Supervisor Software Interrupt Pending*
38-
3954
Indicates a pending software interrupt at the supervisor level.
4055
Read-only zero when `hideleg[2] == 0`, else aliased to `hip.VSSIP[0]`.
41-
sw_read(): |
42-
if (CSR[hideleg].S == 1) {
43-
return CSR[hip].VSSIP[0];
44-
} else {
45-
return 0;
46-
}
47-
sw_write(csr_value): |
48-
if (CSR[hideleg].S == 1) {
49-
CSR[hip].VSSIP[0] = csr_value.VSSIP & ((MXLEN'1 << NUM_VSSI) - 1);
50-
}
56+
"sw_write(csr_value)": |
57+
if (CSR[hideleg].S == 1) {
58+
CSR[hip].VSSIP[0] = (csr_value >> 1) & ((1 << NUM_VSSI) - 1);
59+
}
60+
5161
STIP:
5262
location: 5
5363
type: RW-H
5464
reset_value: UNDEFINED_LEGAL
5565
alias: hip.VSTIP[0]
5666
description: |
5767
*Supervisor Timer Interrupt Pending*
58-
5968
Indicates a pending timer interrupt at the supervisor level.
6069
Read-only zero when `hideleg[6] == 0`, else aliased to `hip.VSTIP[0]`.
70+
"sw_write(csr_value)": |
71+
if (CSR[hideleg].ST == 1) {
72+
CSR[hip].VSTIP[0] = (csr_value >> 5) & ((1 << NUM_VSTI) - 1);
73+
}
6174
6275
SEIP:
6376
location: 9
@@ -66,9 +79,12 @@ fields:
6679
alias: hip.VSEIP[0]
6780
description: |
6881
*Supervisor External Interrupt Pending*
69-
7082
Indicates a pending external interrupt at the supervisor level.
7183
Read-only zero when `hideleg[10] == 0`, else aliased to `hip.VSEIP[0]`.
84+
"sw_write(csr_value)": |
85+
if (CSR[hideleg].SE == 1) {
86+
CSR[hip].VSEIP[0] = (csr_value >> 9) & ((1 << NUM_VSEI) - 1);
87+
}
7288
7389
LCOFIP:
7490
location: 13
@@ -77,6 +93,9 @@ fields:
7793
alias: sip.LCOFIP[0]
7894
description: |
7995
*Local Counter Overflow Interrupt Pending*
80-
8196
Indicates an overflow of a local counter.
8297
Read-only zero when `hideleg[13] == 0`, else aliased to `sip.LCOFIP[0]`.
98+
"sw_write(csr_value)": |
99+
if (CSR[hideleg].LCOF == 1) {
100+
CSR[sip].LCOFIP[0] = (csr_value >> 13) & 0x1;
101+
}

arch/csr/Smcntrpmf/mcyclecfg.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# yaml-language-server: $schema=../../../schemas/csr_schema.json
2+
$schema: csr_schema.json#
3+
kind: csr
4+
name: mcyclecfg
5+
long_name: Machine Cycle Counter Configuration
6+
address: 0x321
7+
priv_mode: M
8+
length: 64
9+
definedBy: Smcntrpmf
10+
description: |
11+
The `mcyclecfg` CSR is a 64-bit machine-level register that configures privilege
12+
mode filtering for the cycle counter. Each inhibit bit (xINH) suppresses
13+
counting of events in the corresponding privilege mode when set.
14+
15+
| Field | Description |
16+
|---------|---------------------------------------------------------|
17+
| MINH | If set, then counting of events in M-mode is inhibited. |
18+
| SINH | If set, then counting of events in S/HS-mode is inhibited. |
19+
| UINH | If set, then counting of events in U-mode is inhibited. |
20+
| VSINH | If set, then counting of events in VS-mode is inhibited. |
21+
| VUINH | If set, then counting of events in VU-mode is inhibited. |
22+
23+
When all xINH bits are zero, event counting is enabled in all modes.
24+
25+
For each bit in 61:58, if the associated privilege mode is not implemented,
26+
the bit is read-only zero.
27+
28+
Bit 63 is hardwired to 0, as these counters do not generate overflow interrupts.
29+
30+
Bits [57:0] are reserved (WPRI) and read as zero.
31+
32+
For RV32, the upper 32 bits of `mcyclecfg` are accessed via `mcyclecfgh` (CSR 0x721).
33+
34+
Note: Although CSR address 0x320 would have been a more natural choice,
35+
it is already allocated to `mcountinhibit`.
36+
37+
fields:
38+
MINH:
39+
location: 62
40+
base: 64
41+
type: RW
42+
definedBy: M
43+
description: If set, then counting of events in M-mode is inhibited.
44+
reset_value: UNDEFINED_LEGAL
45+
46+
SINH:
47+
location: 61
48+
base: 64
49+
type: RW
50+
definedBy: S
51+
description: If set, then counting of events in S/HS-mode is inhibited.
52+
reset_value: UNDEFINED_LEGAL
53+
54+
UINH:
55+
location: 60
56+
base: 64
57+
type: RW
58+
definedBy: U
59+
description: If set, then counting of events in U-mode is inhibited.
60+
reset_value: UNDEFINED_LEGAL
61+
62+
VSINH:
63+
location: 59
64+
base: 64
65+
type: RW
66+
definedBy: H
67+
description: If set, then counting of events in VS-mode is inhibited.
68+
reset_value: UNDEFINED_LEGAL
69+
70+
VUINH:
71+
location: 58
72+
base: 64
73+
type: RW
74+
definedBy: H
75+
description: If set, then counting of events in VU-mode is inhibited.
76+
reset_value: UNDEFINED_LEGAL

arch/csr/Smcntrpmf/mcyclecfgh.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# yaml-language-server: $schema=../../../schemas/csr_schema.json
2+
$schema: csr_schema.json#
3+
kind: csr
4+
name: mcyclecfgh
5+
long_name: Machine Cycle Counter Configuration High
6+
address: 0x721
7+
priv_mode: M
8+
length: 32
9+
definedBy: Smcntrpmf
10+
description: |
11+
Upper 32 bits of the 64-bit `mcyclecfg` CSR, used for RV32 systems to access
12+
the privilege mode filtering inhibit bits.
13+
14+
fields:
15+
MINH:
16+
alias: mcyclecfg.MINH
17+
location: 30
18+
type: RW
19+
definedBy: M
20+
description: If set, then counting of events in M-mode is inhibited.
21+
reset_value: UNDEFINED_LEGAL
22+
23+
SINH:
24+
alias: mcyclecfg.SINH
25+
location: 29
26+
type: RW
27+
definedBy: S
28+
description: If set, then counting of events in S/HS-mode is inhibited.
29+
reset_value: UNDEFINED_LEGAL
30+
31+
UINH:
32+
alias: mcyclecfg.UINH
33+
location: 28
34+
type: RW
35+
definedBy: U
36+
description: If set, then counting of events in U-mode is inhibited.
37+
reset_value: UNDEFINED_LEGAL
38+
39+
VSINH:
40+
alias: mcyclecfg.VSINH
41+
location: 27
42+
type: RW
43+
definedBy: H
44+
description: If set, then counting of events in VS-mode is inhibited.
45+
reset_value: UNDEFINED_LEGAL
46+
47+
VUINH:
48+
alias: mcyclecfg.VUINH
49+
location: 26
50+
type: RW
51+
definedBy: H
52+
description: If set, then counting of events in VU-mode is inhibited.
53+
reset_value: UNDEFINED_LEGAL

0 commit comments

Comments
 (0)