Don't tick HTIF as often
authorAndrew Waterman <waterman@cs.berkeley.edu>
Tue, 10 Sep 2013 09:07:08 +0000 (02:07 -0700)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Tue, 10 Sep 2013 09:07:08 +0000 (02:07 -0700)
riscv/sim.cc

index 9ab61b6257015441e49d32bc8c94c7f2a0d47997..f01e931ea6eb24f153feabdb1f84e5283dfe5d97 100644 (file)
@@ -87,10 +87,6 @@ void sim_t::step(size_t n, bool noisy)
 {
   for (size_t i = 0, steps = 0; i < n; i += steps)
   {
-    htif->tick();
-    if (!running())
-      break;
-
     steps = std::min(n - i, INTERLEAVE - current_step);
     procs[current_proc]->step(steps, noisy);
 
@@ -101,6 +97,10 @@ void sim_t::step(size_t n, bool noisy)
       procs[current_proc]->yield_load_reservation();
       if (++current_proc == procs.size())
         current_proc = 0;
+
+      htif->tick();
+      if (!running())
+        break;
     }
   }
 }