Add read-only counter CSRs to readability/writability tests, and fix cycleh being unreadable when U mode is not implemented
This commit is contained in:
parent
d62861159f
commit
0199f48087
|
@ -715,7 +715,7 @@ always @ (*) begin
|
|||
decode_match = mcounteren_cy ? match_uro : match_mro;
|
||||
rdata = mcycle;
|
||||
end
|
||||
CYCLEH: if (CSR_COUNTER && U_MODE) begin
|
||||
CYCLEH: if (CSR_COUNTER) begin
|
||||
decode_match = mcounteren_cy ? match_uro : match_mro;
|
||||
rdata = mcycleh;
|
||||
end
|
||||
|
|
|
@ -123,6 +123,11 @@ int main() {
|
|||
(void)read_csr(mhpmcounter30h);
|
||||
(void)read_csr(mhpmcounter31h);
|
||||
|
||||
(void)read_csr(cycle);
|
||||
(void)read_csr(cycleh);
|
||||
(void)read_csr(instret);
|
||||
(void)read_csr(instreth);
|
||||
|
||||
(void)read_csr(mcountinhibit);
|
||||
(void)read_csr(mhpmevent3);
|
||||
(void)read_csr(tselect);
|
||||
|
|
|
@ -30,6 +30,14 @@ CSR was 302
|
|||
CSR was 303
|
||||
-> exception, mcause = 2 // write to medeleg, unimplemented
|
||||
CSR was 303
|
||||
-> exception, mcause = 2 // write to cycle, read-only
|
||||
CSR was c00
|
||||
-> exception, mcause = 2 // write to cycleh, read-only
|
||||
CSR was c80
|
||||
-> exception, mcause = 2 // write to instret, read-only
|
||||
CSR was c02
|
||||
-> exception, mcause = 2 // write to instreth, read-only
|
||||
CSR was c82
|
||||
-> exception, mcause = 2 // write to tselect, unimplemented but we permit reads as a workaround for an OpenOCD bug
|
||||
CSR was 7a0
|
||||
-> exception, mcause = 2 // read of tdata1, unimplemented
|
||||
|
@ -148,6 +156,11 @@ int main() {
|
|||
write_csr(mhpmcounter30h, read_csr(mhpmcounter30h ));
|
||||
write_csr(mhpmcounter31h, read_csr(mhpmcounter31h ));
|
||||
|
||||
write_csr(cycle, read_csr(cycle ));
|
||||
write_csr(cycleh, read_csr(cycleh ));
|
||||
write_csr(instret, read_csr(instret ));
|
||||
write_csr(instreth, read_csr(instreth ));
|
||||
|
||||
write_csr(mcountinhibit, read_csr(mcountinhibit ));
|
||||
write_csr(mhpmevent3, read_csr(mhpmevent3 ));
|
||||
write_csr(tselect, read_csr(tselect ));
|
||||
|
|
Loading…
Reference in New Issue