Skip to content

Commit 12a4d9b

Browse files
feat(csr): add YAML file for Ssqosid:srmcfg
1 parent abcd342 commit 12a4d9b

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

arch/csr/Ssqosid/srmcfg.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ fields:
100100
The `RCID` is used to determine the resource allocations (e.g., cache occupancy limits,
101101
memory bandwidth limits, etc.) to enforce.
102102
reset_value: UNDEFINED_LEGAL
103+
sw_write(csr_value): |
104+
if (implemented?(ExtensionName::Smstateen)) {
105+
if (mode() < PrivilegeMode::M && CSR[mstateen0].SRMCFG == 0) {
106+
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
107+
}
108+
if (virtual_mode?() && CSR[mstateen0].SRMCFG == 1) {
109+
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
110+
}
111+
} else {
112+
if (virtual_mode?()) {
113+
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
114+
}
115+
}
116+
return csr_value.RCID;
103117
104118
MCID:
105119
location: 27-16
@@ -121,15 +135,7 @@ fields:
121135
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
122136
}
123137
}
124-
value = csr_value;
125-
126-
rcid_mask = 0xFFF
127-
mcid_mask = 0xFFF
128-
129-
rcid = csr_value & rcid_mask
130-
mcid = (csr_value >> 16) & mcid_mask
131-
132-
value = (mcid << 16) | rcid
138+
return csr_value.MCID;
133139
134140
sw_read(): |
135141
if (implemented?(ExtensionName::Smstateen)) {
@@ -144,4 +150,4 @@ sw_read(): |
144150
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
145151
}
146152
}
147-
return value;
153+
return $bits(CSR[srmcfg]);

0 commit comments

Comments
 (0)