Deleted Added
sdiff udiff text old ( 10330:f54586c894e3 ) new ( 10785:f56c10663a01 )
full compact
1/*
2 * Copyright (c) 2011, 2014 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 36 unchanged lines hidden (view full) ---

45#ifndef __CPU_PRED_TOURNAMENT_PRED_HH__
46#define __CPU_PRED_TOURNAMENT_PRED_HH__
47
48#include <vector>
49
50#include "base/types.hh"
51#include "cpu/pred/bpred_unit.hh"
52#include "cpu/pred/sat_counter.hh"
53
54/**
55 * Implements a tournament branch predictor, hopefully identical to the one
56 * used in the 21264. It has a local predictor, which uses a local history
57 * table to index into a table of counters, and a global predictor, which
58 * uses a global history to index into a table of counters. A choice
59 * predictor chooses between the two. Only the global history register
60 * is speculatively updated, the rest are updated upon branches committing
61 * or misspeculating.
62 */
63class TournamentBP : public BPredUnit
64{
65 public:
66 /**
67 * Default branch predictor constructor.
68 */
69 TournamentBP(const Params *params);
70
71 /**
72 * Looks up the given address in the branch predictor and returns
73 * a true/false value as to whether it is taken. Also creates a
74 * BPHistory object to store any state it will need on squash/update.
75 * @param branch_addr The address of the branch to look up.
76 * @param bp_history Pointer that will be set to the BPHistory object.
77 * @return Whether or not the branch is taken.
78 */
79 bool lookup(Addr branch_addr, void * &bp_history);
80
81 /**
82 * Records that there was an unconditional branch, and modifies
83 * the bp history to point to an object that has the previous
84 * global history stored in it.
85 * @param bp_history Pointer that will be set to the BPHistory object.
86 */
87 void uncondBranch(void * &bp_history);
88 /**
89 * Updates the branch predictor to Not Taken if a BTB entry is
90 * invalid or not found.
91 * @param branch_addr The address of the branch to look up.
92 * @param bp_history Pointer to any bp history state.
93 * @return Whether or not the branch is taken.
94 */
95 void btbUpdate(Addr branch_addr, void * &bp_history);

--- 133 unchanged lines hidden (view full) ---

229 std::vector<SatCounter> choiceCtrs;
230
231 /** Number of entries in the choice predictor. */
232 unsigned choicePredictorSize;
233
234 /** Number of bits in the choice predictor's counters. */
235 unsigned choiceCtrBits;
236
237 /** Number of bits to shift the instruction over to get rid of the word
238 * offset.
239 */
240 unsigned instShiftAmt;
241
242 /** Thresholds for the counter value; above the threshold is taken,
243 * equal to or below the threshold is not taken.
244 */
245 unsigned localThreshold;
246 unsigned globalThreshold;
247 unsigned choiceThreshold;
248};
249
250#endif // __CPU_PRED_TOURNAMENT_PRED_HH__