-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtage_sc_l.cc
74 lines (57 loc) · 1.36 KB
/
tage_sc_l.cc
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
#include <iostream>
#include <cstdlib>
#include "tage_sc_l.h"
//BranchTracer *tracer;
class TAGE_SC_L {
public:
void initialize()
{
cpu = 0;
std::cout << "CPU " << cpu << " TAGE-SC-L branch predictor" << std::endl;
tage_sc_l = new PREDICTOR();
//tracer = new BranchTracer();
}
uint8_t predict(uint64_t ip)
{
uint8_t prediction = tage_sc_l->GetPrediction(ip);
return prediction;
}
void update(uint64_t ip, uint32_t branch_type,
uint32_t taken, uint32_t prediction,
uint64_t target)
{
//FIXME: opType has less types here, maybe need to take better care
tage_sc_l->UpdatePredictor(ip, branch_type, taken, prediction, target);
}
void cleanup_branch_predictor()
{
delete tage_sc_l;
}
private:
uint32_t cpu;
PREDICTOR* tage_sc_l;
};
extern "C"
{
TAGE_SC_L* create_TAGE_SC_L()
{
return new TAGE_SC_L;
}
void delete_TAGE_SC_L(TAGE_SC_L* tage_sc_l)
{
delete tage_sc_l;
}
void initialize_TAGE_SC_L(TAGE_SC_L* tage_sc_l)
{
tage_sc_l->initialize();
}
uint8_t predict_TAGE_SC_L(TAGE_SC_L* tage_sc_l, uint64_t ip)
{
return tage_sc_l->predict(ip);
}
void update_TAGE_SC_L(TAGE_SC_L* tage_sc_l, uint64_t ip, uint32_t branch_type, uint32_t taken,
uint32_t predictor, uint64_t target)
{
tage_sc_l->update(ip, branch_type, taken, predictor, target);
}
}