From 1374c4e812ea584b59a5ed08001e8362a8aa3a66 Mon Sep 17 00:00:00 2001
From: David Li
Date: Thu, 7 Jan 2016 15:35:19 -0700
Subject: Avoid cache deadlock
---
src/simulator.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'src/simulator.rs')
diff --git a/src/simulator.rs b/src/simulator.rs
index 503f902..dd851e5 100644
--- a/src/simulator.rs
+++ b/src/simulator.rs
@@ -281,7 +281,7 @@ impl<'a> Core<'a> {
match result {
Ok(value) => self.registers.write_word(inst.rd(), value),
Err(MemoryError::CacheMiss { stall_cycles }) => {
- self.stall = stall_cycles;
+ self.stall = stall_cycles - 1;
return; // don't increment PC
},
Err(MemoryError::InvalidAddress) => {
@@ -316,7 +316,7 @@ impl<'a> Core<'a> {
match result {
Ok(()) => (),
Err(MemoryError::CacheMiss { stall_cycles }) => {
- self.stall = stall_cycles;
+ self.stall = stall_cycles - 1;
return; // don't increment PC
},
Err(MemoryError::InvalidAddress) => {
--
cgit v1.2.3