mirror of
https://github.com/Comp211-SP24/lab-05-Rushilwiz.git
synced 2025-04-09 14:50:19 -04:00
i cant read
This commit is contained in:
parent
cb81b76f72
commit
be35fbd2bb
10
cache.c
10
cache.c
|
@ -74,12 +74,18 @@ int cread(unsigned int cmf, unsigned int* hex_addr, bool* hit, bool* replace) {
|
||||||
|
|
||||||
if (cache[line]->tag == tag) {
|
if (cache[line]->tag == tag) {
|
||||||
// hit
|
// hit
|
||||||
*replace = true;
|
*hit = true;
|
||||||
cache[line]->hit_count++;
|
cache[line]->hit_count++;
|
||||||
ret_val = cache[line]->block[block_offset];
|
ret_val = cache[line]->block[block_offset];
|
||||||
} else {
|
} else {
|
||||||
// miss
|
// miss
|
||||||
*hit = true;
|
if (cache[line]->tag == EMPTY) {
|
||||||
|
open_line = line;
|
||||||
|
} else {
|
||||||
|
replace_line = line;
|
||||||
|
*replace = true;
|
||||||
|
}
|
||||||
|
|
||||||
cache[line]->tag = tag;
|
cache[line]->tag = tag;
|
||||||
cache[line]->hit_count = 1;
|
cache[line]->hit_count = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user