2 * Copyright (c) 2006 The Regents of The University of Michigan
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.
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.
31 #ifndef __CPU_OZONE_NULL_PREDICTOR_HH__
32 #define __CPU_OZONE_NULL_PREDICTOR_HH__
34 #include "arch/isa_traits.hh"
35 #include "cpu/inst_seq.hh"
41 typedef typename Impl::Params Params;
42 typedef typename Impl::DynInstPtr DynInstPtr;
44 NullPredictor(Params *p) { }
51 BPredInfo(const Addr &pc, const Addr &next_pc)
52 : PC(pc), nextPC(next_pc)
59 BPredInfo lookup(Addr &PC) { return BPredInfo(PC, PC+4); }
61 void undo(BPredInfo &bp_info) { return; }
64 * Predicts whether or not the instruction is a taken branch, and the
65 * target of the branch if it is taken.
66 * @param inst The branch instruction.
67 * @param PC The predicted PC is passed back through this parameter.
68 * @param tid The thread id.
69 * @return Returns if the branch is taken or not.
71 bool predict(DynInstPtr &inst, Addr &PC, unsigned tid)
75 * Tells the branch predictor to commit any updates until the given
77 * @param done_sn The sequence number to commit any older updates up until.
78 * @param tid The thread id.
80 void update(const InstSeqNum &done_sn, unsigned tid) { }
83 * Squashes all outstanding updates until a given sequence number.
84 * @param squashed_sn The sequence number to squash any younger updates up
86 * @param tid The thread id.
88 void squash(const InstSeqNum &squashed_sn, unsigned tid) { }
91 * Squashes all outstanding updates until a given sequence number, and
92 * corrects that sn's update with the proper address and taken/not taken.
93 * @param squashed_sn The sequence number to squash any younger updates up
95 * @param corr_target The correct branch target.
96 * @param actually_taken The correct branch direction.
97 * @param tid The thread id.
99 void squash(const InstSeqNum &squashed_sn, const Addr &corr_target,
100 bool actually_taken, unsigned tid)
105 #endif // __CPU_OZONE_NULL_PREDICTOR_HH__