2004-08-20 20:54:07 +02:00
|
|
|
/*
|
2005-05-27 05:30:12 +02:00
|
|
|
* Copyright (c) 2001-2005 The Regents of The University of Michigan
|
2004-08-20 20:54:07 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
#ifndef __CPU_BASE_DYN_INST_HH__
|
|
|
|
#define __CPU_BASE_DYN_INST_HH__
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
#include <string>
|
2005-02-26 00:00:49 +01:00
|
|
|
#include <vector>
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
#include "base/fast_alloc.hh"
|
|
|
|
#include "base/trace.hh"
|
|
|
|
|
|
|
|
#include "cpu/beta_cpu/comm.hh"
|
2005-02-26 00:00:49 +01:00
|
|
|
#include "cpu/exetrace.hh"
|
2004-08-20 20:54:07 +02:00
|
|
|
#include "cpu/full_cpu/bpred_update.hh"
|
|
|
|
#include "cpu/full_cpu/op_class.hh"
|
2005-02-26 00:00:49 +01:00
|
|
|
#include "cpu/full_cpu/spec_memory.hh"
|
2004-08-20 20:54:07 +02:00
|
|
|
#include "cpu/full_cpu/spec_state.hh"
|
2005-02-26 00:00:49 +01:00
|
|
|
#include "cpu/inst_seq.hh"
|
|
|
|
#include "cpu/static_inst.hh"
|
|
|
|
#include "mem/functional_mem/main_memory.hh"
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Defines a dynamic instruction context.
|
|
|
|
*/
|
|
|
|
|
Update to make multiple instruction issue and different latencies work.
Also change to ref counted DynInst.
SConscript:
Add branch predictor, BTB, load store queue, and storesets.
arch/isa_parser.py:
Specify the template parameter for AlphaDynInst
base/traceflags.py:
Add load store queue, store set, and mem dependence unit to the
list of trace flags.
cpu/base_dyn_inst.cc:
Change formating, add in debug statement.
cpu/base_dyn_inst.hh:
Change DynInst to be RefCounted, add flag to clear whether or not this
instruction can commit. This is likely to be removed in the future.
cpu/beta_cpu/alpha_dyn_inst.cc:
AlphaDynInst has been changed to be templated, so now this CC file
is just used to force instantiations of AlphaDynInst.
cpu/beta_cpu/alpha_dyn_inst.hh:
Changed AlphaDynInst to be templated on Impl. Removed some unnecessary
functions.
cpu/beta_cpu/alpha_full_cpu.cc:
AlphaFullCPU has been changed to be templated, so this CC file is now
just used to force instantation of AlphaFullCPU.
cpu/beta_cpu/alpha_full_cpu.hh:
Change AlphaFullCPU to be templated on Impl.
cpu/beta_cpu/alpha_impl.hh:
Update it to reflect AlphaDynInst and AlphaFullCPU being templated
on Impl. Also removed time buffers from here, as they are really
a part of the CPU and are thus in the CPU policy now.
cpu/beta_cpu/alpha_params.hh:
Make AlphaSimpleParams inherit from the BaseFullCPU so that it doesn't
need to specifically declare any parameters that are already in the
BaseFullCPU.
cpu/beta_cpu/comm.hh:
Changed the structure of the time buffer communication structs. Now
they include the size of the packet of instructions it is sending.
Added some parameters to the backwards communication struct, mainly
for squashing.
cpu/beta_cpu/commit.hh:
Update typenames to reflect change in location of time buffer structs.
Update DynInst to DynInstPtr (it is refcounted now).
cpu/beta_cpu/commit_impl.hh:
Formatting changes mainly. Also sends back proper information
on branch mispredicts so that the bpred unit can update itself.
Updated behavior for non-speculative instructions (stores, any
other non-spec instructions): once they reach the head of the ROB,
the ROB signals back to the IQ that it can go ahead and issue the
non-speculative instruction. The instruction itself is updated so that
commit won't try to commit it again until it is done executing.
cpu/beta_cpu/cpu_policy.hh:
Added branch prediction unit, mem dependence prediction unit, load
store queue. Moved time buffer structs from AlphaSimpleImpl to here.
cpu/beta_cpu/decode.hh:
Changed typedefs to reflect change in location of time buffer structs
and also the change from DynInst to ref counted DynInstPtr.
cpu/beta_cpu/decode_impl.hh:
Continues to buffer instructions even while unblocking now. Changed
how it loops through groups of instructions so it can properly block
during the middle of a group of instructions.
cpu/beta_cpu/fetch.hh:
Changed typedefs to reflect change in location of time buffer structs
and the change to ref counted DynInsts. Also added in branch
brediction unit.
cpu/beta_cpu/fetch_impl.hh:
Add in branch prediction. Changed how fetch checks inputs and its
current state to make for easier logic.
cpu/beta_cpu/free_list.cc:
Changed int regs and float regs to logically use one flat namespace.
Future change will be moving them to a single scoreboard to conserve
space.
cpu/beta_cpu/free_list.hh:
Mostly debugging statements. Might be removed for performance in future.
cpu/beta_cpu/full_cpu.cc:
Added in some debugging statements. Updated BaseFullCPU to take
a params object.
cpu/beta_cpu/full_cpu.hh:
Added params class within BaseCPU that other param classes will be
able to inherit from. Updated typedefs to reflect change in location
of time buffer structs and ref counted DynInst.
cpu/beta_cpu/iew.hh:
Updated typedefs to reflect change in location of time buffer structs
and use of ref counted DynInsts.
cpu/beta_cpu/iew_impl.hh:
Added in load store queue, updated iew to be able to execute non-
speculative instructions, instead of having them execute in commit.
cpu/beta_cpu/inst_queue.hh:
Updated change to ref counted DynInsts. Changed inst queue to hold
non-speculative instructions as well, which are issued only when
commit signals backwards that a nonspeculative instruction is at
the head of the ROB.
cpu/beta_cpu/inst_queue_impl.hh:
Updated to allow for non-speculative instructions to be in the inst
queue. Also added some debug functions.
cpu/beta_cpu/regfile.hh:
Added debugging statements, changed formatting.
cpu/beta_cpu/rename.hh:
Updated typedefs, added some functions to clean up code.
cpu/beta_cpu/rename_impl.hh:
Moved some code into functions to make it easier to read.
cpu/beta_cpu/rename_map.cc:
Changed int and float reg behavior to use a single flat namespace. In
the future, the rename maps can be combined to a single rename map to
save space.
cpu/beta_cpu/rename_map.hh:
Added destructor.
cpu/beta_cpu/rob.hh:
Updated it with change from DynInst to ref counted DynInst.
cpu/beta_cpu/rob_impl.hh:
Formatting, updated to use ref counted DynInst.
cpu/static_inst.hh:
Updated forward declaration for AlphaDynInst now that it is templated.
--HG--
extra : convert_revision : 1045f240ee9b6a4bd368e1806aca029ebbdc6dd3
2004-09-23 20:06:03 +02:00
|
|
|
// Forward declaration.
|
2005-02-26 00:00:49 +01:00
|
|
|
template <class ISA>
|
Update to make multiple instruction issue and different latencies work.
Also change to ref counted DynInst.
SConscript:
Add branch predictor, BTB, load store queue, and storesets.
arch/isa_parser.py:
Specify the template parameter for AlphaDynInst
base/traceflags.py:
Add load store queue, store set, and mem dependence unit to the
list of trace flags.
cpu/base_dyn_inst.cc:
Change formating, add in debug statement.
cpu/base_dyn_inst.hh:
Change DynInst to be RefCounted, add flag to clear whether or not this
instruction can commit. This is likely to be removed in the future.
cpu/beta_cpu/alpha_dyn_inst.cc:
AlphaDynInst has been changed to be templated, so now this CC file
is just used to force instantiations of AlphaDynInst.
cpu/beta_cpu/alpha_dyn_inst.hh:
Changed AlphaDynInst to be templated on Impl. Removed some unnecessary
functions.
cpu/beta_cpu/alpha_full_cpu.cc:
AlphaFullCPU has been changed to be templated, so this CC file is now
just used to force instantation of AlphaFullCPU.
cpu/beta_cpu/alpha_full_cpu.hh:
Change AlphaFullCPU to be templated on Impl.
cpu/beta_cpu/alpha_impl.hh:
Update it to reflect AlphaDynInst and AlphaFullCPU being templated
on Impl. Also removed time buffers from here, as they are really
a part of the CPU and are thus in the CPU policy now.
cpu/beta_cpu/alpha_params.hh:
Make AlphaSimpleParams inherit from the BaseFullCPU so that it doesn't
need to specifically declare any parameters that are already in the
BaseFullCPU.
cpu/beta_cpu/comm.hh:
Changed the structure of the time buffer communication structs. Now
they include the size of the packet of instructions it is sending.
Added some parameters to the backwards communication struct, mainly
for squashing.
cpu/beta_cpu/commit.hh:
Update typenames to reflect change in location of time buffer structs.
Update DynInst to DynInstPtr (it is refcounted now).
cpu/beta_cpu/commit_impl.hh:
Formatting changes mainly. Also sends back proper information
on branch mispredicts so that the bpred unit can update itself.
Updated behavior for non-speculative instructions (stores, any
other non-spec instructions): once they reach the head of the ROB,
the ROB signals back to the IQ that it can go ahead and issue the
non-speculative instruction. The instruction itself is updated so that
commit won't try to commit it again until it is done executing.
cpu/beta_cpu/cpu_policy.hh:
Added branch prediction unit, mem dependence prediction unit, load
store queue. Moved time buffer structs from AlphaSimpleImpl to here.
cpu/beta_cpu/decode.hh:
Changed typedefs to reflect change in location of time buffer structs
and also the change from DynInst to ref counted DynInstPtr.
cpu/beta_cpu/decode_impl.hh:
Continues to buffer instructions even while unblocking now. Changed
how it loops through groups of instructions so it can properly block
during the middle of a group of instructions.
cpu/beta_cpu/fetch.hh:
Changed typedefs to reflect change in location of time buffer structs
and the change to ref counted DynInsts. Also added in branch
brediction unit.
cpu/beta_cpu/fetch_impl.hh:
Add in branch prediction. Changed how fetch checks inputs and its
current state to make for easier logic.
cpu/beta_cpu/free_list.cc:
Changed int regs and float regs to logically use one flat namespace.
Future change will be moving them to a single scoreboard to conserve
space.
cpu/beta_cpu/free_list.hh:
Mostly debugging statements. Might be removed for performance in future.
cpu/beta_cpu/full_cpu.cc:
Added in some debugging statements. Updated BaseFullCPU to take
a params object.
cpu/beta_cpu/full_cpu.hh:
Added params class within BaseCPU that other param classes will be
able to inherit from. Updated typedefs to reflect change in location
of time buffer structs and ref counted DynInst.
cpu/beta_cpu/iew.hh:
Updated typedefs to reflect change in location of time buffer structs
and use of ref counted DynInsts.
cpu/beta_cpu/iew_impl.hh:
Added in load store queue, updated iew to be able to execute non-
speculative instructions, instead of having them execute in commit.
cpu/beta_cpu/inst_queue.hh:
Updated change to ref counted DynInsts. Changed inst queue to hold
non-speculative instructions as well, which are issued only when
commit signals backwards that a nonspeculative instruction is at
the head of the ROB.
cpu/beta_cpu/inst_queue_impl.hh:
Updated to allow for non-speculative instructions to be in the inst
queue. Also added some debug functions.
cpu/beta_cpu/regfile.hh:
Added debugging statements, changed formatting.
cpu/beta_cpu/rename.hh:
Updated typedefs, added some functions to clean up code.
cpu/beta_cpu/rename_impl.hh:
Moved some code into functions to make it easier to read.
cpu/beta_cpu/rename_map.cc:
Changed int and float reg behavior to use a single flat namespace. In
the future, the rename maps can be combined to a single rename map to
save space.
cpu/beta_cpu/rename_map.hh:
Added destructor.
cpu/beta_cpu/rob.hh:
Updated it with change from DynInst to ref counted DynInst.
cpu/beta_cpu/rob_impl.hh:
Formatting, updated to use ref counted DynInst.
cpu/static_inst.hh:
Updated forward declaration for AlphaDynInst now that it is templated.
--HG--
extra : convert_revision : 1045f240ee9b6a4bd368e1806aca029ebbdc6dd3
2004-09-23 20:06:03 +02:00
|
|
|
class StaticInstPtr;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
template <class Impl>
|
Update to make multiple instruction issue and different latencies work.
Also change to ref counted DynInst.
SConscript:
Add branch predictor, BTB, load store queue, and storesets.
arch/isa_parser.py:
Specify the template parameter for AlphaDynInst
base/traceflags.py:
Add load store queue, store set, and mem dependence unit to the
list of trace flags.
cpu/base_dyn_inst.cc:
Change formating, add in debug statement.
cpu/base_dyn_inst.hh:
Change DynInst to be RefCounted, add flag to clear whether or not this
instruction can commit. This is likely to be removed in the future.
cpu/beta_cpu/alpha_dyn_inst.cc:
AlphaDynInst has been changed to be templated, so now this CC file
is just used to force instantiations of AlphaDynInst.
cpu/beta_cpu/alpha_dyn_inst.hh:
Changed AlphaDynInst to be templated on Impl. Removed some unnecessary
functions.
cpu/beta_cpu/alpha_full_cpu.cc:
AlphaFullCPU has been changed to be templated, so this CC file is now
just used to force instantation of AlphaFullCPU.
cpu/beta_cpu/alpha_full_cpu.hh:
Change AlphaFullCPU to be templated on Impl.
cpu/beta_cpu/alpha_impl.hh:
Update it to reflect AlphaDynInst and AlphaFullCPU being templated
on Impl. Also removed time buffers from here, as they are really
a part of the CPU and are thus in the CPU policy now.
cpu/beta_cpu/alpha_params.hh:
Make AlphaSimpleParams inherit from the BaseFullCPU so that it doesn't
need to specifically declare any parameters that are already in the
BaseFullCPU.
cpu/beta_cpu/comm.hh:
Changed the structure of the time buffer communication structs. Now
they include the size of the packet of instructions it is sending.
Added some parameters to the backwards communication struct, mainly
for squashing.
cpu/beta_cpu/commit.hh:
Update typenames to reflect change in location of time buffer structs.
Update DynInst to DynInstPtr (it is refcounted now).
cpu/beta_cpu/commit_impl.hh:
Formatting changes mainly. Also sends back proper information
on branch mispredicts so that the bpred unit can update itself.
Updated behavior for non-speculative instructions (stores, any
other non-spec instructions): once they reach the head of the ROB,
the ROB signals back to the IQ that it can go ahead and issue the
non-speculative instruction. The instruction itself is updated so that
commit won't try to commit it again until it is done executing.
cpu/beta_cpu/cpu_policy.hh:
Added branch prediction unit, mem dependence prediction unit, load
store queue. Moved time buffer structs from AlphaSimpleImpl to here.
cpu/beta_cpu/decode.hh:
Changed typedefs to reflect change in location of time buffer structs
and also the change from DynInst to ref counted DynInstPtr.
cpu/beta_cpu/decode_impl.hh:
Continues to buffer instructions even while unblocking now. Changed
how it loops through groups of instructions so it can properly block
during the middle of a group of instructions.
cpu/beta_cpu/fetch.hh:
Changed typedefs to reflect change in location of time buffer structs
and the change to ref counted DynInsts. Also added in branch
brediction unit.
cpu/beta_cpu/fetch_impl.hh:
Add in branch prediction. Changed how fetch checks inputs and its
current state to make for easier logic.
cpu/beta_cpu/free_list.cc:
Changed int regs and float regs to logically use one flat namespace.
Future change will be moving them to a single scoreboard to conserve
space.
cpu/beta_cpu/free_list.hh:
Mostly debugging statements. Might be removed for performance in future.
cpu/beta_cpu/full_cpu.cc:
Added in some debugging statements. Updated BaseFullCPU to take
a params object.
cpu/beta_cpu/full_cpu.hh:
Added params class within BaseCPU that other param classes will be
able to inherit from. Updated typedefs to reflect change in location
of time buffer structs and ref counted DynInst.
cpu/beta_cpu/iew.hh:
Updated typedefs to reflect change in location of time buffer structs
and use of ref counted DynInsts.
cpu/beta_cpu/iew_impl.hh:
Added in load store queue, updated iew to be able to execute non-
speculative instructions, instead of having them execute in commit.
cpu/beta_cpu/inst_queue.hh:
Updated change to ref counted DynInsts. Changed inst queue to hold
non-speculative instructions as well, which are issued only when
commit signals backwards that a nonspeculative instruction is at
the head of the ROB.
cpu/beta_cpu/inst_queue_impl.hh:
Updated to allow for non-speculative instructions to be in the inst
queue. Also added some debug functions.
cpu/beta_cpu/regfile.hh:
Added debugging statements, changed formatting.
cpu/beta_cpu/rename.hh:
Updated typedefs, added some functions to clean up code.
cpu/beta_cpu/rename_impl.hh:
Moved some code into functions to make it easier to read.
cpu/beta_cpu/rename_map.cc:
Changed int and float reg behavior to use a single flat namespace. In
the future, the rename maps can be combined to a single rename map to
save space.
cpu/beta_cpu/rename_map.hh:
Added destructor.
cpu/beta_cpu/rob.hh:
Updated it with change from DynInst to ref counted DynInst.
cpu/beta_cpu/rob_impl.hh:
Formatting, updated to use ref counted DynInst.
cpu/static_inst.hh:
Updated forward declaration for AlphaDynInst now that it is templated.
--HG--
extra : convert_revision : 1045f240ee9b6a4bd368e1806aca029ebbdc6dd3
2004-09-23 20:06:03 +02:00
|
|
|
class BaseDynInst : public FastAlloc, public RefCounted
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Typedef for the CPU.
|
|
|
|
typedef typename Impl::FullCPU FullCPU;
|
|
|
|
|
|
|
|
//Typedef to get the ISA.
|
|
|
|
typedef typename Impl::ISA ISA;
|
|
|
|
|
|
|
|
/// Binary machine instruction type.
|
|
|
|
typedef typename ISA::MachInst MachInst;
|
|
|
|
/// Memory address type.
|
|
|
|
typedef typename ISA::Addr Addr;
|
|
|
|
/// Logical register index type.
|
|
|
|
typedef typename ISA::RegIndex RegIndex;
|
|
|
|
/// Integer register index type.
|
Update to make multiple instruction issue and different latencies work.
Also change to ref counted DynInst.
SConscript:
Add branch predictor, BTB, load store queue, and storesets.
arch/isa_parser.py:
Specify the template parameter for AlphaDynInst
base/traceflags.py:
Add load store queue, store set, and mem dependence unit to the
list of trace flags.
cpu/base_dyn_inst.cc:
Change formating, add in debug statement.
cpu/base_dyn_inst.hh:
Change DynInst to be RefCounted, add flag to clear whether or not this
instruction can commit. This is likely to be removed in the future.
cpu/beta_cpu/alpha_dyn_inst.cc:
AlphaDynInst has been changed to be templated, so now this CC file
is just used to force instantiations of AlphaDynInst.
cpu/beta_cpu/alpha_dyn_inst.hh:
Changed AlphaDynInst to be templated on Impl. Removed some unnecessary
functions.
cpu/beta_cpu/alpha_full_cpu.cc:
AlphaFullCPU has been changed to be templated, so this CC file is now
just used to force instantation of AlphaFullCPU.
cpu/beta_cpu/alpha_full_cpu.hh:
Change AlphaFullCPU to be templated on Impl.
cpu/beta_cpu/alpha_impl.hh:
Update it to reflect AlphaDynInst and AlphaFullCPU being templated
on Impl. Also removed time buffers from here, as they are really
a part of the CPU and are thus in the CPU policy now.
cpu/beta_cpu/alpha_params.hh:
Make AlphaSimpleParams inherit from the BaseFullCPU so that it doesn't
need to specifically declare any parameters that are already in the
BaseFullCPU.
cpu/beta_cpu/comm.hh:
Changed the structure of the time buffer communication structs. Now
they include the size of the packet of instructions it is sending.
Added some parameters to the backwards communication struct, mainly
for squashing.
cpu/beta_cpu/commit.hh:
Update typenames to reflect change in location of time buffer structs.
Update DynInst to DynInstPtr (it is refcounted now).
cpu/beta_cpu/commit_impl.hh:
Formatting changes mainly. Also sends back proper information
on branch mispredicts so that the bpred unit can update itself.
Updated behavior for non-speculative instructions (stores, any
other non-spec instructions): once they reach the head of the ROB,
the ROB signals back to the IQ that it can go ahead and issue the
non-speculative instruction. The instruction itself is updated so that
commit won't try to commit it again until it is done executing.
cpu/beta_cpu/cpu_policy.hh:
Added branch prediction unit, mem dependence prediction unit, load
store queue. Moved time buffer structs from AlphaSimpleImpl to here.
cpu/beta_cpu/decode.hh:
Changed typedefs to reflect change in location of time buffer structs
and also the change from DynInst to ref counted DynInstPtr.
cpu/beta_cpu/decode_impl.hh:
Continues to buffer instructions even while unblocking now. Changed
how it loops through groups of instructions so it can properly block
during the middle of a group of instructions.
cpu/beta_cpu/fetch.hh:
Changed typedefs to reflect change in location of time buffer structs
and the change to ref counted DynInsts. Also added in branch
brediction unit.
cpu/beta_cpu/fetch_impl.hh:
Add in branch prediction. Changed how fetch checks inputs and its
current state to make for easier logic.
cpu/beta_cpu/free_list.cc:
Changed int regs and float regs to logically use one flat namespace.
Future change will be moving them to a single scoreboard to conserve
space.
cpu/beta_cpu/free_list.hh:
Mostly debugging statements. Might be removed for performance in future.
cpu/beta_cpu/full_cpu.cc:
Added in some debugging statements. Updated BaseFullCPU to take
a params object.
cpu/beta_cpu/full_cpu.hh:
Added params class within BaseCPU that other param classes will be
able to inherit from. Updated typedefs to reflect change in location
of time buffer structs and ref counted DynInst.
cpu/beta_cpu/iew.hh:
Updated typedefs to reflect change in location of time buffer structs
and use of ref counted DynInsts.
cpu/beta_cpu/iew_impl.hh:
Added in load store queue, updated iew to be able to execute non-
speculative instructions, instead of having them execute in commit.
cpu/beta_cpu/inst_queue.hh:
Updated change to ref counted DynInsts. Changed inst queue to hold
non-speculative instructions as well, which are issued only when
commit signals backwards that a nonspeculative instruction is at
the head of the ROB.
cpu/beta_cpu/inst_queue_impl.hh:
Updated to allow for non-speculative instructions to be in the inst
queue. Also added some debug functions.
cpu/beta_cpu/regfile.hh:
Added debugging statements, changed formatting.
cpu/beta_cpu/rename.hh:
Updated typedefs, added some functions to clean up code.
cpu/beta_cpu/rename_impl.hh:
Moved some code into functions to make it easier to read.
cpu/beta_cpu/rename_map.cc:
Changed int and float reg behavior to use a single flat namespace. In
the future, the rename maps can be combined to a single rename map to
save space.
cpu/beta_cpu/rename_map.hh:
Added destructor.
cpu/beta_cpu/rob.hh:
Updated it with change from DynInst to ref counted DynInst.
cpu/beta_cpu/rob_impl.hh:
Formatting, updated to use ref counted DynInst.
cpu/static_inst.hh:
Updated forward declaration for AlphaDynInst now that it is templated.
--HG--
extra : convert_revision : 1045f240ee9b6a4bd368e1806aca029ebbdc6dd3
2004-09-23 20:06:03 +02:00
|
|
|
typedef typename ISA::IntReg IntReg;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
enum {
|
|
|
|
MaxInstSrcRegs = ISA::MaxInstSrcRegs, //< Max source regs
|
|
|
|
MaxInstDestRegs = ISA::MaxInstDestRegs, //< Max dest regs
|
|
|
|
};
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** The static inst used by this dyn inst. */
|
2004-08-20 20:54:07 +02:00
|
|
|
StaticInstPtr<ISA> staticInst;
|
|
|
|
|
|
|
|
////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// INSTRUCTION EXECUTION
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////
|
|
|
|
Trace::InstRecord *traceData;
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
Fault read(Addr addr, T &data, unsigned flags);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
Fault write(T data, Addr addr, unsigned flags,
|
|
|
|
uint64_t *res);
|
|
|
|
|
|
|
|
void prefetch(Addr addr, unsigned flags);
|
|
|
|
void writeHint(Addr addr, int size, unsigned flags);
|
|
|
|
Fault copySrcTranslate(Addr src);
|
|
|
|
Fault copy(Addr dest);
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** @todo: Consider making this private. */
|
2004-08-20 20:54:07 +02:00
|
|
|
public:
|
|
|
|
/** Is this instruction valid. */
|
|
|
|
bool valid;
|
|
|
|
|
|
|
|
/** The sequence number of the instruction. */
|
|
|
|
InstSeqNum seqNum;
|
|
|
|
|
|
|
|
/** How many source registers are ready. */
|
|
|
|
unsigned readyRegs;
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
/** Is the instruction completed. */
|
|
|
|
bool completed;
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
/** Can this instruction issue. */
|
|
|
|
bool canIssue;
|
|
|
|
|
|
|
|
/** Has this instruction issued. */
|
|
|
|
bool issued;
|
|
|
|
|
|
|
|
/** Has this instruction executed (or made it through execute) yet. */
|
|
|
|
bool executed;
|
|
|
|
|
|
|
|
/** Can this instruction commit. */
|
|
|
|
bool canCommit;
|
|
|
|
|
|
|
|
/** Is this instruction squashed. */
|
|
|
|
bool squashed;
|
|
|
|
|
|
|
|
/** Is this instruction squashed in the instruction queue. */
|
|
|
|
bool squashedInIQ;
|
|
|
|
|
|
|
|
/** Is this a recover instruction. */
|
|
|
|
bool recoverInst;
|
|
|
|
|
|
|
|
/** Is this a thread blocking instruction. */
|
|
|
|
bool blockingInst; /* this inst has called thread_block() */
|
|
|
|
|
|
|
|
/** Is this a thread syncrhonization instruction. */
|
|
|
|
bool threadsyncWait;
|
|
|
|
|
|
|
|
/** The thread this instruction is from. */
|
|
|
|
short threadNumber;
|
|
|
|
|
|
|
|
/** data address space ID, for loads & stores. */
|
|
|
|
short asid;
|
|
|
|
|
|
|
|
/** Pointer to the FullCPU object. */
|
|
|
|
FullCPU *cpu;
|
|
|
|
|
|
|
|
/** Pointer to the exec context. Will not exist in the final version. */
|
|
|
|
ExecContext *xc;
|
|
|
|
|
|
|
|
/** The kind of fault this instruction has generated. */
|
|
|
|
Fault fault;
|
|
|
|
|
|
|
|
/** The effective virtual address (lds & stores only). */
|
|
|
|
Addr effAddr;
|
|
|
|
|
|
|
|
/** The effective physical address. */
|
|
|
|
Addr physEffAddr;
|
|
|
|
|
|
|
|
/** Effective virtual address for a copy source. */
|
|
|
|
Addr copySrcEffAddr;
|
|
|
|
|
|
|
|
/** Effective physical address for a copy source. */
|
|
|
|
Addr copySrcPhysEffAddr;
|
|
|
|
|
|
|
|
/** The memory request flags (from translation). */
|
|
|
|
unsigned memReqFlags;
|
|
|
|
|
|
|
|
/** The size of the data to be stored. */
|
|
|
|
int storeSize;
|
|
|
|
|
|
|
|
/** The data to be stored. */
|
|
|
|
IntReg storeData;
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
union Result {
|
|
|
|
uint64_t integer;
|
|
|
|
float fp;
|
|
|
|
double dbl;
|
|
|
|
};
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
/** The result of the instruction; assumes for now that there's only one
|
|
|
|
* destination register.
|
|
|
|
*/
|
|
|
|
Result instResult;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/** PC of this instruction. */
|
|
|
|
Addr PC;
|
|
|
|
|
|
|
|
/** Next non-speculative PC. It is not filled in at fetch, but rather
|
|
|
|
* once the target of the branch is truly known (either decode or
|
|
|
|
* execute).
|
|
|
|
*/
|
|
|
|
Addr nextPC;
|
|
|
|
|
|
|
|
/** Predicted next PC. */
|
|
|
|
Addr predPC;
|
|
|
|
|
|
|
|
/** Count of total number of dynamic instructions. */
|
|
|
|
static int instcount;
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
/** Whether or not the source register is ready. Not sure this should be
|
|
|
|
* here vs. the derived class.
|
2004-08-20 20:54:07 +02:00
|
|
|
*/
|
|
|
|
bool _readySrcRegIdx[MaxInstSrcRegs];
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** BaseDynInst constructor given a binary instruction. */
|
|
|
|
BaseDynInst(MachInst inst, Addr PC, Addr Pred_PC, InstSeqNum seq_num,
|
|
|
|
FullCPU *cpu);
|
|
|
|
|
|
|
|
/** BaseDynInst constructor given a static inst pointer. */
|
|
|
|
BaseDynInst(StaticInstPtr<ISA> &_staticInst);
|
|
|
|
|
|
|
|
/** BaseDynInst destructor. */
|
|
|
|
~BaseDynInst();
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
private:
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Function to initialize variables in the constructors. */
|
2005-02-26 00:00:49 +01:00
|
|
|
void initVars();
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
public:
|
2004-08-20 20:54:07 +02:00
|
|
|
void
|
|
|
|
trace_mem(Fault fault, // last fault
|
|
|
|
MemCmd cmd, // last command
|
|
|
|
Addr addr, // virtual address of access
|
|
|
|
void *p, // memory accessed
|
|
|
|
int nbytes); // access size
|
|
|
|
|
|
|
|
/** Dumps out contents of this BaseDynInst. */
|
|
|
|
void dump();
|
|
|
|
|
|
|
|
/** Dumps out contents of this BaseDynInst into given string. */
|
|
|
|
void dump(std::string &outstring);
|
|
|
|
|
|
|
|
/** Returns the fault type. */
|
|
|
|
Fault getFault() { return fault; }
|
|
|
|
|
|
|
|
/** Checks whether or not this instruction has had its branch target
|
|
|
|
* calculated yet. For now it is not utilized and is hacked to be
|
|
|
|
* always false.
|
|
|
|
*/
|
|
|
|
bool doneTargCalc() { return false; }
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Returns the next PC. This could be the speculative next PC if it is
|
|
|
|
* called prior to the actual branch target being calculated.
|
|
|
|
*/
|
2004-08-20 20:54:07 +02:00
|
|
|
Addr readNextPC() { return nextPC; }
|
|
|
|
|
|
|
|
/** Set the predicted target of this current instruction. */
|
|
|
|
void setPredTarg(Addr predicted_PC) { predPC = predicted_PC; }
|
|
|
|
|
|
|
|
/** Returns the predicted target of the branch. */
|
|
|
|
Addr readPredTarg() { return predPC; }
|
|
|
|
|
|
|
|
/** Returns whether the instruction was predicted taken or not. */
|
|
|
|
bool predTaken() {
|
|
|
|
return( predPC != (PC + sizeof(MachInst) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Returns whether the instruction mispredicted. */
|
|
|
|
bool mispredicted() { return (predPC != nextPC); }
|
|
|
|
|
|
|
|
//
|
|
|
|
// Instruction types. Forward checks to StaticInst object.
|
|
|
|
//
|
|
|
|
bool isNop() const { return staticInst->isNop(); }
|
|
|
|
bool isMemRef() const { return staticInst->isMemRef(); }
|
|
|
|
bool isLoad() const { return staticInst->isLoad(); }
|
|
|
|
bool isStore() const { return staticInst->isStore(); }
|
|
|
|
bool isInstPrefetch() const { return staticInst->isInstPrefetch(); }
|
|
|
|
bool isDataPrefetch() const { return staticInst->isDataPrefetch(); }
|
|
|
|
bool isCopy() const { return staticInst->isCopy(); }
|
|
|
|
bool isInteger() const { return staticInst->isInteger(); }
|
|
|
|
bool isFloating() const { return staticInst->isFloating(); }
|
|
|
|
bool isControl() const { return staticInst->isControl(); }
|
|
|
|
bool isCall() const { return staticInst->isCall(); }
|
|
|
|
bool isReturn() const { return staticInst->isReturn(); }
|
|
|
|
bool isDirectCtrl() const { return staticInst->isDirectCtrl(); }
|
|
|
|
bool isIndirectCtrl() const { return staticInst->isIndirectCtrl(); }
|
|
|
|
bool isCondCtrl() const { return staticInst->isCondCtrl(); }
|
|
|
|
bool isUncondCtrl() const { return staticInst->isUncondCtrl(); }
|
|
|
|
bool isThreadSync() const { return staticInst->isThreadSync(); }
|
|
|
|
bool isSerializing() const { return staticInst->isSerializing(); }
|
|
|
|
bool isMemBarrier() const { return staticInst->isMemBarrier(); }
|
|
|
|
bool isWriteBarrier() const { return staticInst->isWriteBarrier(); }
|
|
|
|
bool isNonSpeculative() const { return staticInst->isNonSpeculative(); }
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
/** Returns the opclass of this instruction. */
|
|
|
|
OpClass opClass() const { return staticInst->opClass(); }
|
|
|
|
|
|
|
|
/** Returns the branch target address. */
|
|
|
|
Addr branchTarget() const { return staticInst->branchTarget(PC); }
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Number of source registers. */
|
2004-08-20 20:54:07 +02:00
|
|
|
int8_t numSrcRegs() const { return staticInst->numSrcRegs(); }
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Number of destination registers. */
|
2004-08-20 20:54:07 +02:00
|
|
|
int8_t numDestRegs() const { return staticInst->numDestRegs(); }
|
|
|
|
|
|
|
|
// the following are used to track physical register usage
|
|
|
|
// for machines with separate int & FP reg files
|
|
|
|
int8_t numFPDestRegs() const { return staticInst->numFPDestRegs(); }
|
|
|
|
int8_t numIntDestRegs() const { return staticInst->numIntDestRegs(); }
|
|
|
|
|
|
|
|
/** Returns the logical register index of the i'th destination register. */
|
|
|
|
RegIndex destRegIdx(int i) const
|
|
|
|
{
|
|
|
|
return staticInst->destRegIdx(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Returns the logical register index of the i'th source register. */
|
|
|
|
RegIndex srcRegIdx(int i) const
|
|
|
|
{
|
|
|
|
return staticInst->srcRegIdx(i);
|
|
|
|
}
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Returns the result of an integer instruction. */
|
2005-02-26 00:00:49 +01:00
|
|
|
uint64_t readIntResult() { return instResult.integer; }
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Returns the result of a floating point instruction. */
|
2005-02-26 00:00:49 +01:00
|
|
|
float readFloatResult() { return instResult.fp; }
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Returns the result of a floating point (double) instruction. */
|
2005-02-26 00:00:49 +01:00
|
|
|
double readDoubleResult() { return instResult.dbl; }
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
//Push to .cc file.
|
|
|
|
/** Records that one of the source registers is ready. */
|
|
|
|
void markSrcRegReady()
|
|
|
|
{
|
|
|
|
++readyRegs;
|
|
|
|
if(readyRegs == numSrcRegs()) {
|
|
|
|
canIssue = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Marks a specific register as ready.
|
|
|
|
* @todo: Move this to .cc file.
|
|
|
|
*/
|
2004-08-20 20:54:07 +02:00
|
|
|
void markSrcRegReady(RegIndex src_idx)
|
|
|
|
{
|
|
|
|
++readyRegs;
|
|
|
|
|
|
|
|
_readySrcRegIdx[src_idx] = 1;
|
|
|
|
|
|
|
|
if(readyRegs == numSrcRegs()) {
|
|
|
|
canIssue = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Returns if a source register is ready. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool isReadySrcRegIdx(int idx) const
|
|
|
|
{
|
|
|
|
return this->_readySrcRegIdx[idx];
|
|
|
|
}
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Sets this instruction as completed. */
|
2005-02-26 00:00:49 +01:00
|
|
|
void setCompleted() { completed = true; }
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Returns whethe or not this instruction is completed. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool isCompleted() const { return completed; }
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
/** Sets this instruction as ready to issue. */
|
|
|
|
void setCanIssue() { canIssue = true; }
|
|
|
|
|
|
|
|
/** Returns whether or not this instruction is ready to issue. */
|
|
|
|
bool readyToIssue() const { return canIssue; }
|
|
|
|
|
|
|
|
/** Sets this instruction as issued from the IQ. */
|
|
|
|
void setIssued() { issued = true; }
|
|
|
|
|
|
|
|
/** Returns whether or not this instruction has issued. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool isIssued() const { return issued; }
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/** Sets this instruction as executed. */
|
|
|
|
void setExecuted() { executed = true; }
|
|
|
|
|
|
|
|
/** Returns whether or not this instruction has executed. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool isExecuted() const { return executed; }
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/** Sets this instruction as ready to commit. */
|
|
|
|
void setCanCommit() { canCommit = true; }
|
|
|
|
|
Update to make multiple instruction issue and different latencies work.
Also change to ref counted DynInst.
SConscript:
Add branch predictor, BTB, load store queue, and storesets.
arch/isa_parser.py:
Specify the template parameter for AlphaDynInst
base/traceflags.py:
Add load store queue, store set, and mem dependence unit to the
list of trace flags.
cpu/base_dyn_inst.cc:
Change formating, add in debug statement.
cpu/base_dyn_inst.hh:
Change DynInst to be RefCounted, add flag to clear whether or not this
instruction can commit. This is likely to be removed in the future.
cpu/beta_cpu/alpha_dyn_inst.cc:
AlphaDynInst has been changed to be templated, so now this CC file
is just used to force instantiations of AlphaDynInst.
cpu/beta_cpu/alpha_dyn_inst.hh:
Changed AlphaDynInst to be templated on Impl. Removed some unnecessary
functions.
cpu/beta_cpu/alpha_full_cpu.cc:
AlphaFullCPU has been changed to be templated, so this CC file is now
just used to force instantation of AlphaFullCPU.
cpu/beta_cpu/alpha_full_cpu.hh:
Change AlphaFullCPU to be templated on Impl.
cpu/beta_cpu/alpha_impl.hh:
Update it to reflect AlphaDynInst and AlphaFullCPU being templated
on Impl. Also removed time buffers from here, as they are really
a part of the CPU and are thus in the CPU policy now.
cpu/beta_cpu/alpha_params.hh:
Make AlphaSimpleParams inherit from the BaseFullCPU so that it doesn't
need to specifically declare any parameters that are already in the
BaseFullCPU.
cpu/beta_cpu/comm.hh:
Changed the structure of the time buffer communication structs. Now
they include the size of the packet of instructions it is sending.
Added some parameters to the backwards communication struct, mainly
for squashing.
cpu/beta_cpu/commit.hh:
Update typenames to reflect change in location of time buffer structs.
Update DynInst to DynInstPtr (it is refcounted now).
cpu/beta_cpu/commit_impl.hh:
Formatting changes mainly. Also sends back proper information
on branch mispredicts so that the bpred unit can update itself.
Updated behavior for non-speculative instructions (stores, any
other non-spec instructions): once they reach the head of the ROB,
the ROB signals back to the IQ that it can go ahead and issue the
non-speculative instruction. The instruction itself is updated so that
commit won't try to commit it again until it is done executing.
cpu/beta_cpu/cpu_policy.hh:
Added branch prediction unit, mem dependence prediction unit, load
store queue. Moved time buffer structs from AlphaSimpleImpl to here.
cpu/beta_cpu/decode.hh:
Changed typedefs to reflect change in location of time buffer structs
and also the change from DynInst to ref counted DynInstPtr.
cpu/beta_cpu/decode_impl.hh:
Continues to buffer instructions even while unblocking now. Changed
how it loops through groups of instructions so it can properly block
during the middle of a group of instructions.
cpu/beta_cpu/fetch.hh:
Changed typedefs to reflect change in location of time buffer structs
and the change to ref counted DynInsts. Also added in branch
brediction unit.
cpu/beta_cpu/fetch_impl.hh:
Add in branch prediction. Changed how fetch checks inputs and its
current state to make for easier logic.
cpu/beta_cpu/free_list.cc:
Changed int regs and float regs to logically use one flat namespace.
Future change will be moving them to a single scoreboard to conserve
space.
cpu/beta_cpu/free_list.hh:
Mostly debugging statements. Might be removed for performance in future.
cpu/beta_cpu/full_cpu.cc:
Added in some debugging statements. Updated BaseFullCPU to take
a params object.
cpu/beta_cpu/full_cpu.hh:
Added params class within BaseCPU that other param classes will be
able to inherit from. Updated typedefs to reflect change in location
of time buffer structs and ref counted DynInst.
cpu/beta_cpu/iew.hh:
Updated typedefs to reflect change in location of time buffer structs
and use of ref counted DynInsts.
cpu/beta_cpu/iew_impl.hh:
Added in load store queue, updated iew to be able to execute non-
speculative instructions, instead of having them execute in commit.
cpu/beta_cpu/inst_queue.hh:
Updated change to ref counted DynInsts. Changed inst queue to hold
non-speculative instructions as well, which are issued only when
commit signals backwards that a nonspeculative instruction is at
the head of the ROB.
cpu/beta_cpu/inst_queue_impl.hh:
Updated to allow for non-speculative instructions to be in the inst
queue. Also added some debug functions.
cpu/beta_cpu/regfile.hh:
Added debugging statements, changed formatting.
cpu/beta_cpu/rename.hh:
Updated typedefs, added some functions to clean up code.
cpu/beta_cpu/rename_impl.hh:
Moved some code into functions to make it easier to read.
cpu/beta_cpu/rename_map.cc:
Changed int and float reg behavior to use a single flat namespace. In
the future, the rename maps can be combined to a single rename map to
save space.
cpu/beta_cpu/rename_map.hh:
Added destructor.
cpu/beta_cpu/rob.hh:
Updated it with change from DynInst to ref counted DynInst.
cpu/beta_cpu/rob_impl.hh:
Formatting, updated to use ref counted DynInst.
cpu/static_inst.hh:
Updated forward declaration for AlphaDynInst now that it is templated.
--HG--
extra : convert_revision : 1045f240ee9b6a4bd368e1806aca029ebbdc6dd3
2004-09-23 20:06:03 +02:00
|
|
|
/** Clears this instruction as being ready to commit. */
|
|
|
|
void clearCanCommit() { canCommit = false; }
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
/** Returns whether or not this instruction is ready to commit. */
|
|
|
|
bool readyToCommit() const { return canCommit; }
|
|
|
|
|
|
|
|
/** Sets this instruction as squashed. */
|
|
|
|
void setSquashed() { squashed = true; }
|
|
|
|
|
|
|
|
/** Returns whether or not this instruction is squashed. */
|
|
|
|
bool isSquashed() const { return squashed; }
|
|
|
|
|
|
|
|
/** Sets this instruction as squashed in the IQ. */
|
|
|
|
void setSquashedInIQ() { squashedInIQ = true; }
|
|
|
|
|
|
|
|
/** Returns whether or not this instruction is squashed in the IQ. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool isSquashedInIQ() const { return squashedInIQ; }
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/** Read the PC of this instruction. */
|
2005-02-26 00:00:49 +01:00
|
|
|
const Addr readPC() const { return PC; }
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/** Set the next PC of this instruction (its actual target). */
|
|
|
|
void setNextPC(uint64_t val) { nextPC = val; }
|
|
|
|
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Returns the exec context.
|
|
|
|
* @todo: Remove this once the ExecContext is no longer used.
|
|
|
|
*/
|
2004-08-20 20:54:07 +02:00
|
|
|
ExecContext *xcBase() { return xc; }
|
2005-02-26 00:00:49 +01:00
|
|
|
|
|
|
|
private:
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Instruction effective address.
|
|
|
|
* @todo: Consider if this is necessary or not.
|
|
|
|
*/
|
2005-02-26 00:00:49 +01:00
|
|
|
Addr instEffAddr;
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Whether or not the effective address calculation is completed.
|
|
|
|
* @todo: Consider if this is necessary or not.
|
|
|
|
*/
|
2005-02-26 00:00:49 +01:00
|
|
|
bool eaCalcDone;
|
|
|
|
|
|
|
|
public:
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Sets the effective address. */
|
2005-02-26 00:00:49 +01:00
|
|
|
void setEA(Addr &ea) { instEffAddr = ea; eaCalcDone = true; }
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Returns the effective address. */
|
2005-02-26 00:00:49 +01:00
|
|
|
const Addr &getEA() const { return instEffAddr; }
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Returns whether or not the eff. addr. calculation has been completed. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool doneEACalc() { return eaCalcDone; }
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Returns whether or not the eff. addr. source registers are ready. */
|
2005-02-26 00:00:49 +01:00
|
|
|
bool eaSrcsReady();
|
2005-05-03 16:56:47 +02:00
|
|
|
|
|
|
|
public:
|
2005-05-19 07:28:25 +02:00
|
|
|
/** Load queue index. */
|
2005-05-03 16:56:47 +02:00
|
|
|
int16_t lqIdx;
|
2005-05-19 07:28:25 +02:00
|
|
|
|
|
|
|
/** Store queue index. */
|
2005-05-03 16:56:47 +02:00
|
|
|
int16_t sqIdx;
|
2004-08-20 20:54:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<class Impl>
|
|
|
|
template<class T>
|
|
|
|
inline Fault
|
|
|
|
BaseDynInst<Impl>::read(Addr addr, T &data, unsigned flags)
|
|
|
|
{
|
|
|
|
MemReqPtr req = new MemReq(addr, xc, sizeof(T), flags);
|
|
|
|
req->asid = asid;
|
|
|
|
|
|
|
|
fault = cpu->translateDataReadReq(req);
|
|
|
|
|
|
|
|
// Record key MemReq parameters so we can generate another one
|
|
|
|
// just like it for the timing access without calling translate()
|
|
|
|
// again (which might mess up the TLB).
|
2005-05-03 16:56:47 +02:00
|
|
|
// Do I ever really need this? -KTL 3/05
|
2004-08-20 20:54:07 +02:00
|
|
|
effAddr = req->vaddr;
|
|
|
|
physEffAddr = req->paddr;
|
|
|
|
memReqFlags = req->flags;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @todo
|
|
|
|
* Replace the disjoint functional memory with a unified one and remove
|
|
|
|
* this hack.
|
|
|
|
*/
|
|
|
|
#ifndef FULL_SYSTEM
|
|
|
|
req->paddr = req->vaddr;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (fault == No_Fault) {
|
2005-05-03 16:56:47 +02:00
|
|
|
fault = cpu->read(req, data, lqIdx);
|
2005-05-19 07:28:25 +02:00
|
|
|
} else {
|
2004-08-20 20:54:07 +02:00
|
|
|
// Return a fixed value to keep simulation deterministic even
|
|
|
|
// along misspeculated paths.
|
|
|
|
data = (T)-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (traceData) {
|
|
|
|
traceData->setAddr(addr);
|
|
|
|
traceData->setData(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class Impl>
|
|
|
|
template<class T>
|
|
|
|
inline Fault
|
|
|
|
BaseDynInst<Impl>::write(T data, Addr addr, unsigned flags, uint64_t *res)
|
|
|
|
{
|
|
|
|
if (traceData) {
|
|
|
|
traceData->setAddr(addr);
|
|
|
|
traceData->setData(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
MemReqPtr req = new MemReq(addr, xc, sizeof(T), flags);
|
|
|
|
|
|
|
|
req->asid = asid;
|
|
|
|
|
|
|
|
fault = cpu->translateDataWriteReq(req);
|
|
|
|
|
|
|
|
// Record key MemReq parameters so we can generate another one
|
|
|
|
// just like it for the timing access without calling translate()
|
|
|
|
// again (which might mess up the TLB).
|
|
|
|
effAddr = req->vaddr;
|
|
|
|
physEffAddr = req->paddr;
|
|
|
|
memReqFlags = req->flags;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @todo
|
|
|
|
* Replace the disjoint functional memory with a unified one and remove
|
|
|
|
* this hack.
|
|
|
|
*/
|
|
|
|
#ifndef FULL_SYSTEM
|
|
|
|
req->paddr = req->vaddr;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (fault == No_Fault) {
|
2005-05-03 16:56:47 +02:00
|
|
|
fault = cpu->write(req, data, sqIdx);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
// always return some result to keep misspeculated paths
|
|
|
|
// (which will ignore faults) deterministic
|
|
|
|
*res = (fault == No_Fault) ? req->result : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
#endif // __CPU_BASE_DYN_INST_HH__
|