-
Notifications
You must be signed in to change notification settings - Fork 0
/
plbp.hh
46 lines (39 loc) · 1.37 KB
/
plbp.hh
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
#ifndef __CPU_PRED_PLBP_PRED_HH__
#define __CPU_PRED_PLBP_PRED_HH__
#include <vector>
#include <stdint.h>
#include "base/types.hh"
#include "cpu/pred/bpred_unit.hh"
#include "cpu/pred/sat_counter.hh"
#include "params/Plbp.hh"
class Plbp : public BPredUnit
{
public:
Plbp(const PlbpParams *params);
void uncondBranch(ThreadID tid, Addr pc, void* &bp_histroy);
void squash(ThreadID tid, void* bp_histroy);
bool lookup(ThreadID tid, Addr branch_addr, void* &bp_histroy);
void btbUpdate(ThreadID tid, Addr branch_addr, void* &bp_histroy);
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history,bool squashed);
unsigned getGHR(ThreadID tid, void *bp_history) const;
private:
void updateGlobalHistReg(ThreadID tid, Addr branch_addr, bool taken);
struct BPHistory {
unsigned globalHistoryReg;
Addr branch_addr;
unsigned addrHead;
bool globalTakenPred;
bool globalUsed;
};
unsigned globalRegisterMask;
//using an unsigned integer to represent global histroy of each branch
unsigned globalHistoryBits;
unsigned globalPredictionSize;
unsigned historyRegisterMask;
unsigned trainThreashold;
std::vector<unsigned> globalHistoryReg;
std::vector<unsigned> globalAddrHead;
std::vector<std::vector<Addr>> globalAddr;
std::vector<std::vector<std::vector<int8_t>>> w;
};
#endif