-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCacheEntry.h
72 lines (60 loc) · 1.15 KB
/
CacheEntry.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef CACHEENTRY_H
#define CACHEENTRY_H
class CacheEntry
{
private:
int Tag;
int ValidBit;
int DirtyBit;
int PFN;
public:
// constructor / set default values
CacheEntry()
{
Tag = -1;
ValidBit = 0;
DirtyBit = 0;
PFN = -1;
}
// Sets the tag for this cache entry
void SetTag(int t)
{
Tag = t;
}
// Returns the tag for this cache entry
int GetTag()
{
return Tag;
}
// Sets the valid bit in this cache entry
void SetValidBit(int bit)
{
ValidBit = bit;
}
// Returns if this cache entry valid bit is set
int GetValidBit()
{
return ValidBit;
}
// Sets the dirty bit to 0 or 1 in this cache entry
void SetDirtyBit(int bit)
{
DirtyBit = bit;
}
// Return if this cache entry has its dirty bit set
int GetDirtyBit()
{
return DirtyBit;
}
// set Physican Page Number for this cache entry
void SetPFN(int physical)
{
PFN = physical;
}
// get Physical Page Number for this cache entry
int GetPFN()
{
return PFN;
}
};
#endif