-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCacheLine.h
61 lines (52 loc) · 1.41 KB
/
CacheLine.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
//
// CacheLine.h
// TLB-Coherence-Simulator
//
// Created by Yashwant Marathe on 12/6/17.
// Copyright © 2017 Yashwant Marathe. All rights reserved.
//
#ifndef CacheLine_h
#define CacheLine_h
#include<iostream>
class CoherenceProtocol;
class CacheLine {
public:
bool valid;
bool dirty;
bool lock;
bool is_translation;
bool is_large;
uint64_t tag;
uint64_t tid;
uint64_t cotag;
CoherenceProtocol *m_coherence_prot;
CacheLine() : valid(false),
dirty(false),
lock(false),
is_translation(false),
is_large(false),
tid(0),
cotag(0),
tag(0) { }
CoherenceProtocol* get_coherence_prot()
{
return m_coherence_prot;
}
void set_coherence_prot(CoherenceProtocol *coherence_prot)
{
m_coherence_prot = coherence_prot;
}
friend std::ostream& operator << (std::ostream &out, const CacheLine &l)
{
if(l.is_translation)
{
out << "|" << l.valid << "|" << l.dirty << "|" << l.lock << "|" << l.is_translation << "|" << std::hex << l.tag << "|" << l.cotag << "| --" ;
}
else
{
out << "|" << l.valid << "|" << l.dirty << "|" << l.lock << "|" << l.is_translation << "|" << std::hex << l.tag << "| -- ";
}
return out;
}
};
#endif /* CacheLine_h */