gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
gshare.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024-2025 REDS-HEIG-VD and ESL-EPFL
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30/* @file
31 * Implementation of a gshare branch predictor
32 */
33
34#ifndef __CPU_PRED_GSHARE_PRED_HH__
35#define __CPU_PRED_GSHARE_PRED_HH__
36
37#include "base/sat_counter.hh"
39#include "params/GshareBP.hh"
40
41namespace gem5
42{
43
44namespace branch_prediction
45{
46
54
55class GshareBP : public BPredUnit
56{
57 public:
58 GshareBP(const GshareBPParams &params);
59 bool lookup(ThreadID tid, Addr pc, void *&bp_history);
60 void updateHistories(ThreadID tid, Addr pc, bool uncond, bool taken,
61 Addr target, const StaticInstPtr &inst,
62 void *&bp_history);
63 void squash(ThreadID tid, void *&bp_history);
64 void update(ThreadID tid, Addr pc, bool taken, void *&bp_history,
65 bool squashed, const StaticInstPtr &inst, Addr target);
66
67 private:
68 void updateGlobalHistReg(ThreadID tid, bool taken);
69 void uncondBranch(ThreadID tid, Addr pc, void *&bp_history);
70
71 struct BPHistory
72 {
75 };
76
80
82 unsigned globalCtrBits;
84
87};
88
89} // namespace branch_prediction
90} // namespace gem5
91#endif // __CPU_PRED_GSHARE_PRED_HH__
BPredUnit(const Params &p)
Branch Predictor Unit (BPU) interface functions.
Definition bpred_unit.cc:58
std::vector< unsigned > globalHistoryReg
Definition gshare.hh:77
void uncondBranch(ThreadID tid, Addr pc, void *&bp_history)
Definition gshare.cc:68
void updateHistories(ThreadID tid, Addr pc, bool uncond, bool taken, Addr target, const StaticInstPtr &inst, void *&bp_history)
Definition gshare.cc:77
GshareBP(const GshareBPParams &params)
Definition gshare.cc:45
bool lookup(ThreadID tid, Addr pc, void *&bp_history)
Definition gshare.cc:104
void update(ThreadID tid, Addr pc, bool taken, void *&bp_history, bool squashed, const StaticInstPtr &inst, Addr target)
Definition gshare.cc:126
void squash(ThreadID tid, void *&bp_history)
Definition gshare.cc:89
std::vector< SatCounter8 > globalCtrs
Definition gshare.hh:85
void updateGlobalHistReg(ThreadID tid, bool taken)
Definition gshare.cc:156
STL vector class.
Definition stl.hh:37
const Params & params() const
Bitfield< 4 > pc
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
RefCountingPtr< StaticInst > StaticInstPtr

Generated on Mon Oct 27 2025 04:13:01 for gem5 by doxygen 1.14.0