Fix cache_access
This commit is contained in:
parent
9997f58137
commit
e457f4dee0
16
csim.c
16
csim.c
@ -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 if (line->tag == tag) out = 'H';
|
||||||
else out = 'E';
|
else out = 'E';
|
||||||
|
|
||||||
if (line != set_head) {
|
if(!(line == set_head)) {
|
||||||
line->newer = NULL;
|
line->newer->older = line->older;
|
||||||
set_head->newer = line;
|
if(line->older)
|
||||||
line->older = set_head;
|
|
||||||
if (line->older) {
|
|
||||||
line->older->newer = line->newer;
|
line->older->newer = line->newer;
|
||||||
if (line->older->older == line)
|
line->newer = NULL;
|
||||||
line->older->older = NULL;
|
line->older = set_head;
|
||||||
}
|
set_head->newer = line;
|
||||||
if (line->newer)
|
|
||||||
line->newer->older = line->older;
|
|
||||||
cache[set] = line;
|
cache[set] = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user