-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache.cpp
More file actions
55 lines (48 loc) · 882 Bytes
/
cache.cpp
File metadata and controls
55 lines (48 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// cache.cpp
// Author: John Voong
// Created on June 18, 2019 at 11:11 PM
#include <cstdlib>
#include "cache.h"
/*
Cache::Cache(int numL, int numS)
{
sets = (Set*) malloc(sizeof(Set) * numSets);
for (int i = 0; i < numSets; i++) {
//sets[i]. = (Line*) malloc(sizeof(Line) * numL);
}
numSets = numS;
blocksPerSet = numL;
} // constructor
*/
int Cache::evict()
{
return 0;
} // evict()
Block* Cache::read(void *data)
{
Block *block = NULL;
for (int i = 0; i < numSets; i++) {
block = sets[i].read(data);
if (block != NULL) {
return block;
}
}
return NULL;
}
/*
int Cache::read(void *data)
{
void *dataLocation = find(data);
if (dataLocation == NULL) {
// miss
dataLocation = 0;//readDrive(data);
}
updateAges();
return dataLocation;
return 0;
} // read()
*/
int Cache::write(void *data)
{
return 0;
} // write()