-
Notifications
You must be signed in to change notification settings - Fork 16
/
MESI_SMPCache.h
69 lines (49 loc) · 1.76 KB
/
MESI_SMPCache.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
#include "CacheCore.h"
#include "SMPCache.h"
#include "MESI_SMPCacheState.h"
#include <vector>
class MESI_SMPCache : public SMPCache{
public:
/*First we define a couple of helper classes that
* carry data between methods in our main class*/
class RemoteReadService{
public:
bool isShared;
bool providedData;
RemoteReadService(bool shrd, bool prov){
isShared = shrd;
providedData = prov;
}
};
class InvalidateReply{
/*This class isn't used, but i left it here so you
* could add to it if you need to communicate
* between caches in Invalidate Replies*/
public:
uint32_t empty;
InvalidateReply(bool EMPTY){
empty = EMPTY;
}
};
//FIELDS
//This cache's ID
int CPUId;
//METHODS
//Constructor
MESI_SMPCache(int cpuid, std::vector<SMPCache * > * cacheVector, int csize, int cassoc, int cbsize, int caddressable, const char * repPol, bool cskew);
//Readline performs a read, and uses readRemoteAction to
//check for data in other caches
virtual void readLine(uint32_t rdPC, uint32_t addr);//SMPCache Interface Function
virtual MESI_SMPCache::RemoteReadService readRemoteAction(uint32_t addr);
//Writeline performs a write, and uses writeRemoteAction
//to check for data in other caches
virtual void writeLine(uint32_t wrPC, uint32_t addr);//SMPCache Interface Function
virtual MESI_SMPCache::InvalidateReply writeRemoteAction(uint32_t addr);
//Fill line touches cache state, bringing addr's block in, and setting its state to mesi_state
virtual void fillLine(uint32_t addr, uint32_t mesi_state);//SMPCache Interface Function
virtual char *Identify();
//Dump the stats for this cache to outFile
//void dumpStatsToFile(FILE* outFile);
//Destructor
~MESI_SMPCache();
};