Skip to content

Commit 199b4b8

Browse files
committed
comments
1 parent f5808de commit 199b4b8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

DataCache/Cache.h

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class Cache
6969
Sets->at(index)->UpdateDirtyEntry(tag);
7070
}
7171

72+
// Invalidates the entire cache at set->set cache entry
7273
int Invalidate(int physicalFrameNmumber)
7374
{
7475
int TotalDirty = 0;
@@ -97,6 +98,7 @@ class Cache
9798
}
9899

99100

101+
// Checks if the cache at index first entry is has a dirty bit
100102
bool LRU_IsEntryDirtyBit(int index)
101103
{
102104
return Sets->at(index)->LRU_IsEntryDirtyBit();

DataCache/CacheEntry.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CacheEntry
1111

1212
public:
1313

14-
// ctor
14+
// constructor / set default values
1515
CacheEntry()
1616
{
1717
Tag = -1;
@@ -20,41 +20,49 @@ class CacheEntry
2020
PFN = -1;
2121
}
2222

23+
// Sets the tag for this cache entry
2324
void SetTag(int t)
2425
{
2526
Tag = t;
2627
}
2728

29+
// Returns the tag for this cache entry
2830
int GetTag()
2931
{
3032
return Tag;
3133
}
3234

35+
// Sets the valid bit in this cache entry
3336
void SetValidBit(int bit)
3437
{
3538
ValidBit = bit;
3639
}
3740

41+
// Returns if this cache entry valid bit is set
3842
int GetValidBit()
3943
{
4044
return ValidBit;
4145
}
4246

47+
// Sets the dirty bit to 0 or 1 in this cache entry
4348
void SetDirtyBit(int bit)
4449
{
4550
DirtyBit = bit;
4651
}
4752

53+
// Return if this cache entry has its dirty bit set
4854
int GetDirtyBit()
4955
{
5056
return DirtyBit;
5157
}
5258

59+
// set Physican Page Number for this cache entry
5360
void SetPFN(int physical)
5461
{
5562
PFN = physical;
5663
}
5764

65+
// get Physical Page Number for this cache entry
5866
int GetPFN()
5967
{
6068
return PFN;

DataCache/CacheSet.h

-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ class CacheSet
114114
return TotalDirty; // return number of dirty cache entries for write back to memory (write-back policy)
115115
}
116116

117-
118-
119117
// is entry set dirty bit?
120118
bool LRU_IsEntryDirtyBit()
121119
{

0 commit comments

Comments
 (0)