aboutsummaryrefslogtreecommitdiff
path: root/src/simulator.rs
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2016-01-07 15:35:19 -0700
committerDavid Li <li.davidm96@gmail.com>2016-01-07 15:35:19 -0700
commit1374c4e812ea584b59a5ed08001e8362a8aa3a66 (patch)
treed0f872b5bae3f1ebd07a658c73181d329e528098 /src/simulator.rs
parent292b24d0f6d14f9f10fe99c2bfeac3b7e2f405ed (diff)
Avoid cache deadlock
Diffstat (limited to 'src/simulator.rs')
-rw-r--r--src/simulator.rs4
1 files changed, 2 insertions, 2 deletions
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) => {