41 #ifndef __CPU_O3_MEM_DEP_UNIT_HH__ 42 #define __CPU_O3_MEM_DEP_UNIT_HH__ 47 #include <unordered_map> 48 #include <unordered_set> 52 #include "debug/MemDepUnit.hh" 56 unsigned a = (unsigned)seq_num;
57 unsigned hash = (((a >> 14) ^ ((a >> 2) & 0xffff))) & 0x7FFFFFFF;
63 struct DerivO3CPUParams;
79 template <
class MemDepPred,
class Impl>
99 std::string
name()
const {
return _name; }
108 bool isDrained()
const;
111 void drainSanityCheck()
const;
120 void insert(
const DynInstPtr &inst);
123 void insertNonSpec(
const DynInstPtr &inst);
126 void insertBarrier(
const DynInstPtr &barr_inst);
129 void regsReady(
const DynInstPtr &inst);
132 void nonSpecInstReady(
const DynInstPtr &inst);
135 void reschedule(
const DynInstPtr &inst);
143 void completeInst(
const DynInstPtr &inst);
151 void violation(
const DynInstPtr &store_inst,
152 const DynInstPtr &violating_load);
155 void issue(
const DynInstPtr &inst);
163 void completed(
const DynInstPtr &inst);
166 void wakeDependents(
const DynInstPtr &inst);
182 : inst(new_inst), regsReady(false), memDeps(0),
183 completed(false), squashed(false)
189 "memdep_count=%i %s\n", memdep_count, inst->pcState());
196 for (
int i = 0;
i < dependInsts.size(); ++
i) {
197 dependInsts[
i] = NULL;
203 "memdep_count=%i %s\n", memdep_count, inst->pcState());
208 std::string
name()
const {
return "memdepentry"; }
230 static int memdep_count;
231 static int memdep_insert;
232 static int memdep_erase;
237 inline MemDepEntryPtr &findInHash(
const DynInstConstPtr& inst);
240 inline void moveToReady(MemDepEntryPtr &ready_inst_entry);
242 typedef std::unordered_map<InstSeqNum, MemDepEntryPtr, SNHash>
MemDepHash;
275 void insertBarrierSN(
const DynInstPtr &barr_inst);
293 #endif // __CPU_O3_MEM_DEP_UNIT_HH__
MemDepHash memDepHash
A hash map of all memory dependence entries.
std::unordered_set< InstSeqNum > storeBarrierSNs
Sequence numbers of outstanding store barriers.
std::shared_ptr< MemDepEntry > MemDepEntryPtr
bool hasLoadBarrier() const
Is there an outstanding load barrier that loads must wait on.
std::list< DynInstPtr >::iterator ListIt
ListIt listIt
The iterator to the instruction's location inside the list.
size_t operator()(const InstSeqNum &seq_num) const
void takeOverFrom(ThreadContext &ntc, ThreadContext &otc)
Copy state between thread contexts in preparation for CPU handover.
~MemDepEntry()
Frees any pointers.
int id
The thread id of this memory dependence unit.
int memDeps
Number of memory dependencies that need to be satisfied.
Impl::DynInstConstPtr DynInstConstPtr
std::vector< MemDepEntryPtr > dependInsts
A vector of any dependent instructions.
Declaration of Statistics objects.
std::unordered_set< InstSeqNum > loadBarrierSNs
Sequence numbers of outstanding load barriers.
This is a simple scalar statistic, like a counter.
MemDepEntry(const DynInstPtr &new_inst)
Constructs a memory dependence entry.
Stats::Scalar insertedLoads
Stat for number of inserted loads.
bool squashed
If the instruction is squashed.
InstructionQueue< Impl > * iqPtr
Pointer to the IQ.
Impl::DynInstPtr DynInstPtr
bool regsReady
If the registers are ready or not.
Stats::Scalar conflictingStores
Stat for number of conflicting stores that had to wait for a store.
Stats::Scalar conflictingLoads
Stat for number of conflicting loads that had to wait for a store.
bool completed
If the instruction is completed.
Memory dependence entries that track memory operations, marking when the instruction is ready to exec...
Stats::Scalar insertedStores
Stat for number of inserted stores.
bool hasStoreBarrier() const
Is there an outstanding store barrier that loads must wait on.
MemDepPred depPred
The memory dependence predictor.
Memory dependency unit class.
int16_t ThreadID
Thread index/ID type.
std::string name() const
Returns the name of the memory dependence entry.
std::list< DynInstPtr > instsToReplay
A list of all instructions that are going to be replayed.
std::string name() const
Returns the name of the memory dependence unit.
std::unordered_map< InstSeqNum, MemDepEntryPtr, SNHash > MemDepHash
A standard instruction queue class.
const FlagsType init
This Stat is Initialized.
DynInstPtr inst
The instruction being tracked.
MemDepHash::iterator MemDepHashIt