@@ -46,25 +46,19 @@ fields:
4646 }
4747 reset_value : UNDEFINED_LEGAL
4848 sw_write(csr_value) : |
49- if ((mode() != PrivilegeMode::M) && implemented?(ExtensionName::Smstateen)) {
50- if (CSR[mstateen0].JVT == 1'b0) {
51- unimplemented_csr($encoding);
52- }
53- }
54- else if ((mode() == PrivilegeMode::U) && implemented?(ExtensionName::Ssstateen)) {
55- if (CSR[sstateen0].JVT == 1'b0) {
56- unimplemented_csr($encoding);
57- }
58- }
59- else if ((mode() == PrivilegeMode::VS) && implemented?(ExtensionName::Ssstateen)) {
60- if (CSR[hstateen0].JVT == 1'b0) {
61- unimplemented_csr($encoding);
62- }
63- }
64- else if ((mode() == PrivilegeMode::VU) && implemented?(ExtensionName::Ssstateen)) {
65- if ((CSR[sstateen0].JVT == 1'b0) || (CSR[hstateen0].JVT == 1'b0)) {
66- unimplemented_csr($encoding);
67- }
49+ if (( mode() != PrivilegeMode::M && implemented?(ExtensionName::Smstateen)
50+ && CSR[mstateen0].JVT == 1'b0 )
51+ ||
52+ ( mode() == PrivilegeMode::U && implemented?(ExtensionName::Ssstateen)
53+ && CSR[sstateen0].JVT == 1'b0 )
54+ ||
55+ ( mode() == PrivilegeMode::VS && implemented?(ExtensionName::Ssstateen)
56+ && CSR[hstateen0].JVT == 1'b0 )
57+ ||
58+ ( mode() == PrivilegeMode::VU && implemented?(ExtensionName::Ssstateen)
59+ && (CSR[sstateen0].JVT == 1'b0 || CSR[hstateen0].JVT == 1'b0) )) {
60+
61+ unimplemented_csr($encoding);
6862 }
6963 else {
7064 if (JVT_BASE_TYPE == "custom") {
@@ -94,28 +88,4 @@ fields:
9488 }
9589 return 0;
9690sw_read() : |
97- # If the Smstateen extension is implemented, then bit 2 in `mstateen0`, `sstateen0`, and `hstateen0` is
98- # implemented. If bit 2 of a controlling `stateen0` CSR is zero, then access to the `jvt` CSR and execution
99- # of a `cm.jalt` or `cm.jt` instruction by a lower privilege level results in an illegal-instruction trap (or, if
100- # appropriate, a virtual-instruction trap).
101-
102- if ((mode() != PrivilegeMode::M) && implemented?(ExtensionName::Smstateen)) {
103- if (CSR[mstateen0].JVT == 1'b0) {
104- raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
105- }
106- }
107- else if ((mode() == PrivilegeMode::U) && implemented?(ExtensionName::Ssstateen)) {
108- if (CSR[sstateen0].JVT == 1'b0) {
109- raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
110- }
111- }
112- else if ((mode() == PrivilegeMode::VS) && implemented?(ExtensionName::Ssstateen)) {
113- if (CSR[hstateen0].JVT == 1'b0) {
114- raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
115- }
116- }
117- else if ((mode() == PrivilegeMode::VU) && implemented?(ExtensionName::Ssstateen)) {
118- if ((CSR[sstateen0].JVT == 1'b0) || (CSR[hstateen0].JVT == 1'b0)) {
119- raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
120- }
121- }
91+ check_zcmt_enabled($encoding);
0 commit comments