-
Notifications
You must be signed in to change notification settings - Fork 0
/
configlib.h
133 lines (112 loc) · 2.81 KB
/
configlib.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* Configure Parameters */
// cache parameters
unsigned long long L1_block_size;
unsigned long long L1_cache_size;
unsigned long long L1_assoc;
unsigned long long L1_hit_time;
unsigned long long L1_miss_time;
unsigned long long L2_block_size;
unsigned long long L2_cache_size;
unsigned long long L2_assoc;
unsigned long long L2_hit_time;
unsigned long long L2_miss_time;
unsigned long long L2_transfer_time;
unsigned long long L2_bus_width;
int DIRECT_MAPPED;
int FULLY_ASSOC;
int SET_ASSOC;
int mem_sendaddr;
int mem_ready;
int mem_chunktime;
int mem_chunksize;
unsigned long long blockNumL1;
unsigned long long blockNumL2;
unsigned long long numBitsL1;
unsigned long long numBitsL2;
unsigned long long numByteBounL1;
unsigned long long numByteBounL2;
unsigned long long refCount;
unsigned long long invalidCount;
unsigned long long totalCycle;
// flush
unsigned long long flushTime;
unsigned long long flushCount;
// instructions
unsigned long long instCount;
unsigned long long instCycle;
unsigned long long avgInstCycle;
// data
unsigned long long dataCount;
unsigned long long dataCycle;
// reads
unsigned long long readCount;
unsigned long long readCycle;
unsigned long long avgReadCycle;
// writes
unsigned long long writeCount;
unsigned long long writeCycle;
unsigned long long avgWriteCycle;
// L1i
unsigned long long l1iMissCount;
unsigned long long l1iHitCount;
unsigned long long l1iRefCount;
unsigned long long l1iKickouts;
unsigned long long l1iDirtyKickouts;
unsigned long long l1iTransfers;
unsigned long long l1iFlushKickouts;
// L1d
unsigned long long l1dMissCount;
unsigned long long l1dHitCount;
unsigned long long l1dRefCount;
unsigned long long l1dKickouts;
unsigned long long l1dDirtyKickouts;
unsigned long long l1dTransfers;
unsigned long long l1dFlushKickouts;
// L2
unsigned long long l2MissCount;
unsigned long long l2HitCount;
unsigned long long l2RefCount;
unsigned long long l2Kickouts;
unsigned long long l2DirtyKickouts;
unsigned long long l2Transfers;
unsigned long long l2FlushKickouts;
// cache structs
typedef struct {
unsigned long long addr;
unsigned long long tag;
int dirty;
int valid;
} dmEntry; //Direct Mapped
struct node {
unsigned long long addr;
unsigned long long tag;
int dirty;
int valid;
struct node *next;
struct node *prev;
}; //Fully Associative
typedef struct node faEntry;
typedef struct {
unsigned long long addr;
unsigned long long tag;
int dirty;
int valid;
} saEntry; //Set Associative
// cache arrays
dmEntry* dmL1i;
dmEntry* dmL1d;
dmEntry* dmL2;
faEntry* faL1iHead;
faEntry* faL1iCurr;
faEntry* faL1iTail;
faEntry* faL1dHead;
faEntry* faL1dCurr;
faEntry* faL1dTail;
faEntry* faL2Head;
faEntry* faL2Curr;
faEntry* faL2Tail;
saEntry* saL1i;
saEntry* saL1d;
saEntry* saL2;
// initializes cache parameters
int configRead(char *file);