From 40d2b3d6a899d52a2fa0086021fc0e83d3043663 Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Thu, 2 May 2019 11:15:05 -0700 Subject: rvfi: clear memory between tests. --- c_emulator/riscv_sim.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'c_emulator') diff --git a/c_emulator/riscv_sim.c b/c_emulator/riscv_sim.c index 1c9e9e3..c70b31c 100644 --- a/c_emulator/riscv_sim.c +++ b/c_emulator/riscv_sim.c @@ -432,6 +432,14 @@ void init_sail(uint64_t elf_entry) if (!rv_enable_rvc) z_set_Misa_C(&zmisa, 0); } +/* reinitialize to clear state and memory, typically across tests runs */ +void reinit_sail(uint64_t elf_entry) +{ + model_fini(); + model_init(); + init_sail(elf_entry); +} + int init_check(struct tv_spike_t *s) { int passed = 1; @@ -800,7 +808,7 @@ int main(int argc, char **argv) #else if (rvfi_dii) { /* Reset for next test */ - init_sail(entry); + reinit_sail(entry); } } while (rvfi_dii); #endif -- cgit v1.1