-
Notifications
You must be signed in to change notification settings - Fork 0
/
btfntPredictor.h
60 lines (45 loc) · 1 KB
/
btfntPredictor.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
/*
* btnfPredictor.h
*
* Branch Predictor backword-taken-forward-not-taken class
* for Sniper Simulation
*
* < Chris Mark >
*
*/
#ifndef BTFNT_PREDICTOR_H
#define BTFNT_PREDICTOR_H
#include "branch_predictor.h"
#include <cstring>
#include <iostream>
class btfntPredictor : public BranchPredictor
{
public:
btfntPredictor (String name, core_id_t core_id)
: BranchPredictor(name, core_id)
{
};
~btfntPredictor ()
{
};
/**
* Called from the Simulator to predict the result of branch instruction
* in address 'ip' and target 'target'.
**/
bool predict(IntPtr ip, IntPtr target)
{
int help;
if (target<ip) help=1;
else help =0;
int prediction = help;
return (prediction != 0);
};
/**
* Called from the Simulator to update the internal state of the predictor.
**/
void update(bool predicted, bool actual, IntPtr ip, IntPtr target)
{
updateCounters(predicted, actual);
};
};
#endif