-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathqueryRecord.h
More file actions
34 lines (28 loc) · 923 Bytes
/
queryRecord.h
File metadata and controls
34 lines (28 loc) · 923 Bytes
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
#include <vector>
#include <iostream>
class QueryRecord
{
private:
public:
bool isTypeRead; //whether read(1) or write query(0)
int index;//which set in the cache?
int tag; //main way to search
bool gotHit; //True if query hit, false if missed
int n_cycles;
QueryRecord(char ty, int idx, int t)
{
isTypeRead = (ty == 'l') ? true : false;
index = idx; //to get set
tag = t; //to search block in set
gotHit = false;
n_cycles = 0;
}
void display()
{
if (isTypeRead) std::cout << "(r) "; else std::cout << "(w) ";
std::cout << "Index: " << index << ", Tag: " << tag << " | ";
if (gotHit) std::cout << "Hit | "; else std::cout << "Miss | ";
std::cout << "Cycles: " << n_cycles << "\n";
std::cout << "----------------------------------------------\n";
}
};