From cc598c09106273a3d477eb54be61ce20edd1c633 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Tue, 8 Jun 2021 11:35:20 +0200 Subject: [PATCH] [PrivCPU] changed timer compare to lower equals to trigger exactly on time --- riscemu/priv/PrivCPU.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscemu/priv/PrivCPU.py b/riscemu/priv/PrivCPU.py index e0cd30c..270f032 100644 --- a/riscemu/priv/PrivCPU.py +++ b/riscemu/priv/PrivCPU.py @@ -175,7 +175,7 @@ class PrivCPU(CPU): def _timer_step(self): if not self._time_interrupt_enabled: return - if self._time_timecmp < (time.perf_counter_ns() // self.TIME_RESOLUTION_NS) - self._time_start: + if self._time_timecmp <= (time.perf_counter_ns() // self.TIME_RESOLUTION_NS) - self._time_start: self.pending_traps.append(TimerInterrupt()) self._time_interrupt_enabled = False print(FMT_CPU + "[CPU] raising timer interrupt: tartegt: {}, current: {}".format(self._time_timecmp, (time.perf_counter_ns() // self.TIME_RESOLUTION_NS) - self._time_start) + FMT_NONE)