diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-04 14:19:56 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-04 14:19:56 -0700 |
commit | bb8162c22e34ac588f92b4d3783c39d04a67ec2c (patch) | |
tree | 08d7b613bd201a9524e3fef36c99dc3fcafcff17 /src/memory.rs | |
parent | f71937d4bb74ad0ba8937da94643ddfe403ea346 (diff) |
Fix cache sharing bug
Diffstat (limited to 'src/memory.rs')
-rw-r--r-- | src/memory.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/memory.rs b/src/memory.rs index db0dca4..9bc3643 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -307,8 +307,12 @@ impl<'a> MemoryInterface for DirectMappedCache<'a> { fn step(&mut self) { for set in self.cache.iter_mut() { if let Some(ref mut fetch_request) = set.fetch_request { - if fetch_request.cycles_left > 0 { + // Start filling the cache once the cycles_left would + // have hit 0, so that the consumer never gets + // stall_cycles = 0 + if fetch_request.cycles_left > 1 { fetch_request.cycles_left -= 1; + return; } // read all the words in a line from the next // level, until we get a stall |