File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ class Cache
69
69
Sets->at (index )->UpdateDirtyEntry (tag);
70
70
}
71
71
72
+ // Invalidates the entire cache at set->set cache entry
72
73
int Invalidate (int physicalFrameNmumber)
73
74
{
74
75
int TotalDirty = 0 ;
@@ -97,6 +98,7 @@ class Cache
97
98
}
98
99
99
100
101
+ // Checks if the cache at index first entry is has a dirty bit
100
102
bool LRU_IsEntryDirtyBit (int index)
101
103
{
102
104
return Sets->at (index )->LRU_IsEntryDirtyBit ();
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class CacheEntry
11
11
12
12
public:
13
13
14
- // ctor
14
+ // constructor / set default values
15
15
CacheEntry ()
16
16
{
17
17
Tag = -1 ;
@@ -20,41 +20,49 @@ class CacheEntry
20
20
PFN = -1 ;
21
21
}
22
22
23
+ // Sets the tag for this cache entry
23
24
void SetTag (int t)
24
25
{
25
26
Tag = t;
26
27
}
27
28
29
+ // Returns the tag for this cache entry
28
30
int GetTag ()
29
31
{
30
32
return Tag;
31
33
}
32
34
35
+ // Sets the valid bit in this cache entry
33
36
void SetValidBit (int bit)
34
37
{
35
38
ValidBit = bit;
36
39
}
37
40
41
+ // Returns if this cache entry valid bit is set
38
42
int GetValidBit ()
39
43
{
40
44
return ValidBit;
41
45
}
42
46
47
+ // Sets the dirty bit to 0 or 1 in this cache entry
43
48
void SetDirtyBit (int bit)
44
49
{
45
50
DirtyBit = bit;
46
51
}
47
52
53
+ // Return if this cache entry has its dirty bit set
48
54
int GetDirtyBit ()
49
55
{
50
56
return DirtyBit;
51
57
}
52
58
59
+ // set Physican Page Number for this cache entry
53
60
void SetPFN (int physical)
54
61
{
55
62
PFN = physical;
56
63
}
57
64
65
+ // get Physical Page Number for this cache entry
58
66
int GetPFN ()
59
67
{
60
68
return PFN;
Original file line number Diff line number Diff line change @@ -114,8 +114,6 @@ class CacheSet
114
114
return TotalDirty; // return number of dirty cache entries for write back to memory (write-back policy)
115
115
}
116
116
117
-
118
-
119
117
// is entry set dirty bit?
120
118
bool LRU_IsEntryDirtyBit ()
121
119
{
You can’t perform that action at this time.
0 commit comments