Execute exactly the # of insns passed to step()
authorAndrew Waterman <waterman@cs.berkeley.edu>
Mon, 1 Jun 2015 01:10:20 +0000 (18:10 -0700)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Mon, 1 Jun 2015 01:29:45 +0000 (18:29 -0700)
Previously, the value was treated as approximate.

riscv/processor.cc

index 7162a393b30b407022922a1cff9fc45b48b1df8c..6368c8f18cc5ad3f3423894927c06043626cb6af 100644 (file)
@@ -261,6 +261,7 @@ void processor_t::step(size_t n)
         pc = execute_insn(this, pc, fetch); \
         if (idx == mmu_t::ICACHE_ENTRIES-1) break; \
         if (unlikely(ic_entry->tag != pc)) break; \
+        if (unlikely(instret+1 == n)) break; \
         instret++; \
         state.pc = pc; \
       }