44 #ifndef __CPU_O3_LSQ_HH__
45 #define __CPU_O3_LSQ_HH__
55 struct DerivO3CPUParams;
60 typedef typename Impl::O3CPU
O3CPU;
62 typedef typename Impl::CPUPol::IEW
IEW;
63 typedef typename Impl::CPUPol::LSQUnit
LSQUnit;
73 LSQ(
O3CPU *cpu_ptr,
IEW *iew_ptr, DerivO3CPUParams *params);
79 std::string
name()
const;
284 uint8_t *
data,
int store_idx);
332 template <
class Impl>
339 return thread[tid].read(req, sreqLow, sreqHigh, load_idx);
342 template <
class Impl>
345 uint8_t *
data,
int store_idx)
349 return thread[tid].write(req, sreqLow, sreqHigh, data, store_idx);
352 #endif // __CPU_O3_LSQ_HH__
IEW * iewStage
The IEW stage pointer.
int getStoreHead()
Returns the index of the head store instruction.
unsigned SQEntries
Total Size of SQ Entries.
void takeOverFrom()
Takes over execution from another CPU's thread.
void squash(const InstSeqNum &squashed_num)
Squashes all instructions younger than a specific sequence number.
void resetEntries()
Reset the max entries for each thread.
ThreadID numThreads
Number of Threads.
int getLoadHead()
Returns the index of the head load instruction.
Impl::DynInstPtr DynInstPtr
bool hasStoresToWB()
Returns if there are any stores to writeback.
int getCount(ThreadID tid)
Returns the number of instructions in the queues of one thread.
unsigned LQEntries
Total Size of LQ Entries.
bool willWB()
Returns if the LSQ will write back to memory this cycle.
void tick(ThreadID tid)
Ticks a specific LSQ Unit.
int numStores()
Returns the number of stores in the SQ.
Fault write(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, uint8_t *data, int store_idx)
Executes a store operation, using the store specified at the store index.
ContextID contextId() const
Accessor function for context ID.
unsigned maxSQEntries
Max SQ Size - Used to Enforce Sharing Policies.
bool violation()
Returns if there is a memory ordering violation.
void dumpInsts() const
Debugging function to print out all instructions.
DynInstPtr getMemDepViolator()
Returns the memory ordering violator.
void removeEntries(ThreadID tid)
void tick()
Ticks the LSQ.
bool sqFull()
Returns if any of the SQs are full.
Fault read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, int load_idx)
Executes a read operation, using the load specified at the load index.
std::string name() const
Returns the name of the LSQ.
bool violation()
Returns whether or not there was a memory ordering violation.
bool hasStoresToWB()
Returns whether or not there are any stores to write back to memory.
Fault executeLoad(DynInstPtr &inst)
Executes a load.
bool isFull()
Returns if the LSQ is full (either LQ or SQ is full).
int numLoads()
Returns the number of loads in the LQ.
int getLoadHead(ThreadID tid)
Returns the head index of the load queue for a specific thread.
bool hasStoresToWB(ThreadID tid)
Returns whether or not a specific thread has any stores to write back to memory.
void writebackStores()
Attempts to write back stores until all cache ports are used or the interface becomes blocked...
void commitStores(InstSeqNum &youngest_inst)
Commits stores older than a specific sequence number.
bool violation(ThreadID tid)
Returns whether or not there was a memory ordering violation for a specific thread.
void drainSanityCheck() const
Perform sanity checks after a drain.
void dumpInsts(ThreadID tid) const
Debugging function to print out instructions from a specific thread.
bool willWB(ThreadID tid)
Returns if the LSQ of a specific thread will write back to memory this cycle.
InstSeqNum getStoreHeadSeqNum()
Returns the sequence number of the head store instruction.
Impl::CPUPol::LSQUnit LSQUnit
bool willWB()
Returns if the LSQ unit will writeback on this cycle.
unsigned numFreeStoreEntries()
Returns the number of free store entries.
InstSeqNum getLoadHeadSeqNum(ThreadID tid)
Returns the sequence number of the head of the load queue.
void insertStore(DynInstPtr &store_inst)
Inserts a store into the LSQ.
void resizeEntries(unsigned size, ThreadID tid)
Resize the max entries for a thread.
int numStores(ThreadID tid)
Returns the total number of stores for a single thread.
void dumpInsts() const
Debugging function to dump instructions in the LSQ.
int numLoads()
Returns the total number of loads in the load queue.
void insertLoad(DynInstPtr &load_inst)
Inserts a load into the LSQ.
void commitLoads(InstSeqNum &youngest_inst)
Commits loads older than a specific sequence number.
Fault executeStore(DynInstPtr &inst)
Executes a store.
unsigned maxLQEntries
Max LQ Size - Used to Enforce Sharing Policies.
int numStoresToWB(ThreadID tid)
Returns the number of stores a specific thread has to write back.
InstSeqNum getLoadHeadSeqNum()
Returns the sequence number of the head load instruction.
LSQUnit * thread
The LSQ units for individual threads.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
InstSeqNum getStoreHeadSeqNum(ThreadID tid)
Returns the sequence number of the head of the store queue.
int getCount()
Returns the number of instructions in all of the queues.
int16_t ThreadID
Thread index/ID type.
void commitStores(InstSeqNum &youngest_inst, ThreadID tid)
Commits stores up until the given sequence number for a specific thread.
unsigned numFreeLoadEntries()
Returns the number of free load entries.
int entryAmount(ThreadID num_threads)
Number of entries needed for the given amount of threads.
void recvReqRetry()
Retry the previous send that failed.
LSQPolicy lsqPolicy
The LSQ policy for SMT mode.
unsigned getCount()
Returns the number of instructions in the LSQ.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets the pointer to the list of active threads.
bool isEmpty() const
Returns if the LSQ is empty (both LQ and SQ are empty).
bool sqEmpty() const
Returns if all of the SQs are empty.
LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params)
Constructs an LSQ with the given parameters.
int numStores()
Returns the total number of stores in the store queue.
bool isDrained() const
Has the LSQ drained?
void regStats()
Registers statistics of each LSQ unit.
bool recvTimingResp(PacketPtr pkt)
Handles writing back and completing the load or store that has returned from memory.
void squash(const InstSeqNum &squashed_num, ThreadID tid)
Squash instructions from a thread until the specified sequence number.
Class that implements the actual LQ and SQ for each specific thread.
O3CPU * cpu
The CPU pointer.
bool lqEmpty() const
Returns if all of the LQs are empty.
std::list< ThreadID > * activeThreads
List of Active Threads in System.
bool isStalled()
Returns if the LSQ is stalled due to a memory operation that must be replayed.
DynInstPtr getMemDepViolator(ThreadID tid)
Gets the instruction that caused the memory ordering violation.
void recvTimingSnoopReq(PacketPtr pkt)
std::shared_ptr< FaultBase > Fault
unsigned numFreeEntries(ThreadID tid)
Returns the number of free entries for a specific thread.
int getStoreHead(ThreadID tid)
Returns the head index of the store queue.
int numLoads(ThreadID tid)
Returns the total number of loads for a single thread.
void commitLoads(InstSeqNum &youngest_inst, ThreadID tid)
Commits loads up until the given sequence number for a specific thread.
int numStoresToWB()
Returns the number of stores to writeback.
bool lqFull()
Returns if any of the LQs are full.
void tick()
Ticks the LSQ unit, which in this case only resets the number of used cache ports.