From 7b250145783b6f2f1a8e533194d0028bb41df01e Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Thu, 2 Mar 2023 07:52:41 -0800 Subject: [PATCH] Initialize MTIP at reset Since mtime and mtimecmp both initialize to 0, and "a machine timer interrupt becomes pending whenever mtime contains a value greater than or equal to mtimecmp," MTIP should be 1. Before this change, MTIP would be 0 until the first increment, or until reading/writing from CLINT regs (since clint_t::load() and clint_t::store() call increment(0)). --- riscv/clint.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/riscv/clint.cc b/riscv/clint.cc index 778c0854..cf9e923f 100644 --- a/riscv/clint.cc +++ b/riscv/clint.cc @@ -12,6 +12,7 @@ clint_t::clint_t(sim_t* sim, uint64_t freq_hz, bool real_time) real_time_ref_secs = base.tv_sec; real_time_ref_usecs = base.tv_usec; + increment(0); } /* 0000 msip hart 0