+#include "riscv_test.h"
+#include "sv_test_macros.h"
+
+RVTEST_RV64U # Define TVM used by program.
+
+
+
+# Test code region.
+RVTEST_CODE_BEGIN # Start of test code.
+ csrrw x0, 0x4f2, 2
+ la x1, testdata
+ lw x2, 0(x1)
+ la x1, (testdata+8)
+ lw x3, 0(x1)
+ li x1, SV_REG_CSR(1, 2, 0, 2, 1, 0)
+ csrrw x0, 0x4c0, x1
+ csrrw x0, 0x4f0, 2
+ addi x2, x2, 1 # Should be 42 into $2.
+ csrrwi x0, 0x4f2, 0
+ csrrwi x0, 0x4c0, 0
+ csrrwi x0, 0x4f0, 0
+ li x1, 42 # Desired result 1
+ bne x2, x1, fail # Fail out if doesn't match.
+ li x1, 43 # Desired result 2
+ bne x3, x1, fail # Fail out if doesn't match.
+ RVTEST_PASS # Signal success.
+fail:
+ RVTEST_FAIL
+RVTEST_CODE_END # End of test code.
+
+# Input data section.
+# This section is optional, and this data is NOT saved in the output.
+.data
+ .align 3
+testdata:
+ .dword 41
+ .dword 42
+ .dword 43
+
+# Output data section.
+RVTEST_DATA_BEGIN # Start of test output data region.
+ .align 3
+result:
+ .dword -1
+ .dword -1
+ .dword -1
+RVTEST_DATA_END # End of test output data region.
+