41#ifndef __CPU_O3_MEM_DEP_UNIT_HH__
42#define __CPU_O3_MEM_DEP_UNIT_HH__
47#include <unordered_map>
48#include <unordered_set>
55#include "debug/MemDepUnit.hh"
65 unsigned a = (unsigned)seq_num;
66 unsigned hash = (((
a >> 14) ^ ((
a >> 2) & 0xffff))) & 0x7FFFFFFF;
71struct BaseO3CPUParams;
77class InstructionQueue;
192 std::string
name()
const {
return "memdepentry"; }
214 static int memdep_count;
215 static int memdep_insert;
216 static int memdep_erase;
226 typedef std::unordered_map<InstSeqNum, MemDepEntryPtr, SNHash>
MemDepHash;
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
A standard instruction queue class.
Memory dependence entries that track memory operations, marking when the instruction is ready to exec...
bool completed
If the instruction is completed.
std::vector< MemDepEntryPtr > dependInsts
A vector of any dependent instructions.
int memDeps
Number of memory dependencies that need to be satisfied.
~MemDepEntry()
Frees any pointers.
MemDepEntry(const DynInstPtr &new_inst)
Constructs a memory dependence entry.
ListIt listIt
The iterator to the instruction's location inside the list.
bool squashed
If the instruction is squashed.
std::string name() const
Returns the name of the memory dependence entry.
DynInstPtr inst
The instruction being tracked.
bool regsReady
If the registers are ready or not.
Memory dependency unit class.
bool isDrained() const
Determine if we are drained.
void completeInst(const DynInstPtr &inst)
Notifies completion of an instruction.
std::string name() const
Returns the name of the memory dependence unit.
void takeOverFrom()
Takes over from another CPU's thread.
std::list< DynInstPtr > instList[MaxThreads]
A list of all instructions in the memory dependence unit.
void moveToReady(MemDepEntryPtr &ready_inst_entry)
Moves an entry to the ready list.
bool hasStoreBarrier() const
Is there an outstanding store barrier that loads must wait on.
void nonSpecInstReady(const DynInstPtr &inst)
Indicate that a non-speculative instruction is ready.
std::shared_ptr< MemDepEntry > MemDepEntryPtr
std::list< DynInstPtr >::iterator ListIt
MemDepUnit()
Empty constructor.
void completed(const DynInstPtr &inst)
Completes a memory instruction.
~MemDepUnit()
Frees up any memory allocated.
void dumpLists()
Debugging function to dump the lists of instructions.
std::unordered_set< InstSeqNum > loadBarrierSNs
Sequence numbers of outstanding load barriers.
void issue(const DynInstPtr &inst)
Issues the given instruction.
void insert(const DynInstPtr &inst)
Inserts a memory instruction.
void squash(const InstSeqNum &squashed_num, ThreadID tid)
Squashes all instructions up until a given sequence number for a specific thread.
void violation(const DynInstPtr &store_inst, const DynInstPtr &violating_load)
Indicates an ordering violation between a store and a younger load.
StoreSet depPred
The memory dependence predictor.
void replay()
Replays all instructions that have been rescheduled by moving them to the ready list.
void wakeDependents(const DynInstPtr &inst)
Wakes any dependents of a memory instruction.
MemDepHash memDepHash
A hash map of all memory dependence entries.
std::list< DynInstPtr > instsToReplay
A list of all instructions that are going to be replayed.
std::unordered_map< InstSeqNum, MemDepEntryPtr, SNHash > MemDepHash
void regsReady(const DynInstPtr &inst)
Indicate that an instruction has its registers ready.
void insertBarrierSN(const DynInstPtr &barr_inst)
Inserts the SN of a barrier inst.
std::unordered_set< InstSeqNum > storeBarrierSNs
Sequence numbers of outstanding store barriers.
bool hasLoadBarrier() const
Is there an outstanding load barrier that loads must wait on.
MemDepEntryPtr & findInHash(const DynInstConstPtr &inst)
Finds the memory dependence entry in the hash map.
InstructionQueue * iqPtr
Pointer to the IQ.
int id
The thread id of this memory dependence unit.
MemDepHash::iterator MemDepHashIt
gem5::o3::MemDepUnit::MemDepUnitStats stats
void insertNonSpec(const DynInstPtr &inst)
Inserts a non-speculative memory instruction.
void drainSanityCheck() const
Perform sanity checks after a drain.
void reschedule(const DynInstPtr &inst)
Reschedules an instruction to be re-executed.
void insertBarrier(const DynInstPtr &barr_inst)
Inserts a barrier instruction.
void setIQ(InstructionQueue *iq_ptr)
Sets the pointer to the IQ.
Implements a store set predictor for determining if memory instructions are dependent upon each other...
This is a simple scalar statistic, like a counter.
static constexpr int MaxThreads
const FlagsType init
This Stat is Initialized.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
int16_t ThreadID
Thread index/ID type.
Declaration of Statistics objects.
size_t operator()(const InstSeqNum &seq_num) const
statistics::Scalar conflictingLoads
Stat for number of conflicting loads that had to wait for a store.
MemDepUnitStats(statistics::Group *parent)
statistics::Scalar conflictingStores
Stat for number of conflicting stores that had to wait for a store.
statistics::Scalar insertedLoads
Stat for number of inserted loads.
statistics::Scalar insertedStores
Stat for number of inserted stores.