bi_mode.cc (10335:1b627a6ddac0) bi_mode.cc (10785:f56c10663a01)
1/*
2 * Copyright (c) 2014 The Regents of The University of Michigan
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;

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

31/* @file
32 * Implementation of a bi-mode branch predictor
33 */
34
35#include "base/bitfield.hh"
36#include "base/intmath.hh"
37#include "cpu/pred/bi_mode.hh"
38
1/*
2 * Copyright (c) 2014 The Regents of The University of Michigan
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;

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

31/* @file
32 * Implementation of a bi-mode branch predictor
33 */
34
35#include "base/bitfield.hh"
36#include "base/intmath.hh"
37#include "cpu/pred/bi_mode.hh"
38
39BiModeBP::BiModeBP(const Params *params)
40 : BPredUnit(params), instShiftAmt(params->instShiftAmt),
39BiModeBP::BiModeBP(const BiModeBPParams *params)
40 : BPredUnit(params),
41 globalHistoryReg(0),
42 globalHistoryBits(ceilLog2(params->globalPredictorSize)),
43 choicePredictorSize(params->choicePredictorSize),
44 choiceCtrBits(params->choiceCtrBits),
45 globalPredictorSize(params->globalPredictorSize),
46 globalCtrBits(params->globalCtrBits)
47{
48 if (!isPowerOf2(choicePredictorSize))

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

72}
73
74/*
75 * For an unconditional branch we set its history such that
76 * everything is set to taken. I.e., its choice predictor
77 * chooses the taken array and the taken array predicts taken.
78 */
79void
41 globalHistoryReg(0),
42 globalHistoryBits(ceilLog2(params->globalPredictorSize)),
43 choicePredictorSize(params->choicePredictorSize),
44 choiceCtrBits(params->choiceCtrBits),
45 globalPredictorSize(params->globalPredictorSize),
46 globalCtrBits(params->globalCtrBits)
47{
48 if (!isPowerOf2(choicePredictorSize))

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

72}
73
74/*
75 * For an unconditional branch we set its history such that
76 * everything is set to taken. I.e., its choice predictor
77 * chooses the taken array and the taken array predicts taken.
78 */
79void
80BiModeBP::uncondBranch(void * &bpHistory)
80BiModeBP::uncondBranch(Addr pc, void * &bpHistory)
81{
82 BPHistory *history = new BPHistory;
83 history->globalHistoryReg = globalHistoryReg;
84 history->takenUsed = true;
85 history->takenPred = true;
86 history->notTakenPred = true;
87 history->finalPred = true;
88 bpHistory = static_cast<void*>(history);

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

238
239void
240BiModeBP::updateGlobalHistReg(bool taken)
241{
242 globalHistoryReg = taken ? (globalHistoryReg << 1) | 1 :
243 (globalHistoryReg << 1);
244 globalHistoryReg &= historyRegisterMask;
245}
81{
82 BPHistory *history = new BPHistory;
83 history->globalHistoryReg = globalHistoryReg;
84 history->takenUsed = true;
85 history->takenPred = true;
86 history->notTakenPred = true;
87 history->finalPred = true;
88 bpHistory = static_cast<void*>(history);

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

238
239void
240BiModeBP::updateGlobalHistReg(bool taken)
241{
242 globalHistoryReg = taken ? (globalHistoryReg << 1) | 1 :
243 (globalHistoryReg << 1);
244 globalHistoryReg &= historyRegisterMask;
245}
246
247BiModeBP*
248BiModeBPParams::create()
249{
250 return new BiModeBP(this);
251}