-
Notifications
You must be signed in to change notification settings - Fork 16
/
MultiCacheSim.h
62 lines (44 loc) · 1.47 KB
/
MultiCacheSim.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
#include "CacheInterface.h"
#include "SMPCache.h"
#include "MESI_SMPCache.h"
#include "MSI_SMPCache.h"
#ifndef PIN
#include <pthread.h>
#else
#include "pin.H"
#endif
class MultiCacheSim : public CacheInterface{
public:
//FIELDS
//Number of Caches in the multicachesim
int num_caches;
//The vector that contains the caches
std::vector<SMPCache * > allCaches;
//The lock that protects the vector so it isn't corrupted by concurrent updates
PIN_LOCK allCachesLock;
//Cache Parameters
int cache_size;
int cache_assoc;
int cache_bsize;
//The output file to dump stats to at the end
FILE* CacheStats;
CacheFactory cacheFactory;
//METHODS
//Constructor
//MultiCacheSim(FILE *cachestats,int size, int assoc, int bsize);
MultiCacheSim(FILE *cachestats,int size, int assoc, int bsize, CacheFactory c);
//Adds a cache to the multicachesim
void createNewCache();
//These three functions implement the CacheInterface interface
void readLine(unsigned long tid, unsigned long rdPC, unsigned long addr);
void writeLine(unsigned long tid, unsigned long wrPC, unsigned long addr);
void dumpStatsForAllCaches(bool concise);
//Utility Function to get the cache object that has the specified CPUid
SMPCache *findCacheByCPUId(unsigned int CPUid);
//Translate from program threadID to multicachesim CPUId
int tidToCPUId(int tid);
char *Identify();
int getStateAsInt(unsigned long tid, unsigned long addr);
//Destructor
~MultiCacheSim();
};