Skip to content

Commit 30199ef

Browse files
committed
Added Hammer::get_csr() Python API check
Signed-off-by: Jerin Joy <joy@rivosinc.com>
1 parent 2107e77 commit 30199ef

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

hammer_pybind.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ PYBIND11_MODULE(hammer, m) {
3838
pybind11::enum_<PlatformDefines>(m, "PlatformDefines")
3939
.value("DramBase", DramBase)
4040
.export_values();
41+
42+
pybind11::enum_<CsrDefines>(m, "CsrDefines").value("MSTATUS_CSR", MSTATUS_CSR).export_values();
4143
}

pytests/pytest000.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def main():
6565
for _ in range(13):
6666
hammer.single_step(0)
6767

68-
# TODO: add a read of the mstatus CSR which is set by this point
68+
current_mstatus = hammer.get_csr(0, pyhammer.MSTATUS_CSR)
69+
if (current_mstatus != 0x8000000a00002600):
70+
sys.exit(f"Unexpected mstatus: {current_mstatus:x}")
71+
6972
current_x1 = hammer.get_gpr(0, 1)
7073
if (current_x1 != 4):
7174
sys.exit(f'Unexpected x1 after vsetivli {current_x1}')

0 commit comments

Comments
 (0)