Deleted Added
sdiff udiff text old ( 13685:bb3377c81303 ) new ( 14081:f99ed78e5263 )
full compact
1/*
2 * Copyright (c) 2018 Metempsy Technology Consulting
3 * All rights reserved.
4 *
5 * Copyright (c) 2006 INRIA (Institut National de Recherche en
6 * Informatique et en Automatique / French National Research Institute
7 * for Computer Science and Applied Mathematics)
8 *
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are
13 * met: redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer;
15 * redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution;
18 * neither the name of the copyright holders nor the names of its
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * Author: André Seznec, Pau Cabre, Javier Bueno
35 *
36 */
37
38/*
39 * 8KB TAGE-SC-L branch predictor (devised by Andre Seznec)
40 */
41
42#ifndef __CPU_PRED_TAGE_SC_L_8KB
43#define __CPU_PRED_TAGE_SC_L_8KB
44
45#include "cpu/pred/tage_sc_l.hh"
46#include "params/TAGE_SC_L_8KB.hh"
47#include "params/TAGE_SC_L_8KB_StatisticalCorrector.hh"
48#include "params/TAGE_SC_L_TAGE_8KB.hh"
49
50class TAGE_SC_L_TAGE_8KB : public TAGE_SC_L_TAGE
51{
52 public:
53 TAGE_SC_L_TAGE_8KB(const TAGE_SC_L_TAGE_8KBParams *p) : TAGE_SC_L_TAGE(p)
54 {}
55
56 void initFoldedHistories(ThreadHistory & history) override;
57 int gindex_ext(int index, int bank) const override;
58
59 uint16_t gtag(ThreadID tid, Addr pc, int bank) const override;
60
61 void handleAllocAndUReset(
62 bool alloc, bool taken, TAGEBase::BranchInfo* bi, int nrand) override;
63
64 void handleTAGEUpdate(
65 Addr branch_pc, bool taken, TAGEBase::BranchInfo* bi) override;
66
67 void resetUctr(uint8_t & u) override;
68};
69
70class TAGE_SC_L_8KB_StatisticalCorrector : public StatisticalCorrector
71{
72 // global branch history GEHL
73 const unsigned gnb;
74 const unsigned logGnb;
75 std::vector<int> gm;
76 std::vector<int8_t> * ggehl;
77 std::vector<int8_t> wg;
78
79 struct SC_8KB_ThreadHistory : public SCThreadHistory
80 {
81 SC_8KB_ThreadHistory() {
82 globalHist = 0;
83 }
84 int64_t globalHist; // global history
85 };
86
87 SCThreadHistory *makeThreadHistory() override;
88
89 public:
90 TAGE_SC_L_8KB_StatisticalCorrector(
91 TAGE_SC_L_8KB_StatisticalCorrectorParams *p);
92
93 unsigned getIndBiasBank( Addr branch_pc, BranchInfo* bi, int hitBank,
94 int altBank) const override;
95
96 int gPredictions( ThreadID tid, Addr branch_pc,
97 BranchInfo* bi, int & lsum, int64_t phist) override;
98
99 int gIndexLogsSubstr(int nbr, int i) override;
100
101 void scHistoryUpdate(
102 Addr branch_pc, int brtype, bool taken, BranchInfo * tage_bi,
103 Addr corrTarget) override;
104
105 void gUpdates(ThreadID tid, Addr pc, bool taken, BranchInfo* bi,
106 int64_t phist) override;
107};
108
109class TAGE_SC_L_8KB : public TAGE_SC_L
110{
111 public:
112 TAGE_SC_L_8KB(const TAGE_SC_L_8KBParams *params);
113};
114
115#endif // __CPU_PRED_TAGE_SC_L_8KB
116