Browse Source

Fix cache_access

master
Adam Goldsmith 6 years ago
parent
commit
e457f4dee0
  1. 14
      csim.c

14
csim.c

@ -234,17 +234,13 @@ char cache_access(linked_line** cache, long address, int set_bits, int block_bit @@ -234,17 +234,13 @@ char cache_access(linked_line** cache, long address, int set_bits, int block_bit
else if (line->tag == tag) out = 'H';
else out = 'E';
if (line != set_head) {
if(!(line == set_head)) {
line->newer->older = line->older;
if(line->older)
line->older->newer = line->newer;
line->newer = NULL;
set_head->newer = line;
line->older = set_head;
if (line->older) {
line->older->newer = line->newer;
if (line->older->older == line)
line->older->older = NULL;
}
if (line->newer)
line->newer->older = line->older;
set_head->newer = line;
cache[set] = line;
}