42#ifndef __CPU_O3_LSQ_UNIT_HH__
43#define __CPU_O3_LSQ_UNIT_HH__
61#include "debug/HtmCpu.hh"
62#include "debug/LSQUnit.hh"
69struct BaseO3CPUParams;
213 LSQUnit(uint32_t lqEntries, uint32_t sqEntries);
221 panic(
"LSQUnit is not copy-able");
225 void init(
CPU *cpu_ptr,
IEW *iew_ptr,
const BaseO3CPUParams ¶ms,
226 LSQ *lsq_ptr,
unsigned id);
229 std::string
name()
const;
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
IEW handles both single threaded and SMT IEW (issue/execute/writeback).
DynInstPtr _inst
The instruction.
void setRequest(LSQRequest *r)
const DynInstPtr & instruction() const
uint32_t _size
The size of the operation.
bool valid() const
Member accessors.
const uint32_t & size() const
void set(const DynInstPtr &new_inst)
LSQRequest * _request
The request.
void set(const DynInstPtr &inst)
bool _isAllZeros
Does this request write all zeros and thus doesn't have any data attached to it.
bool _canWB
Whether or not the store can writeback.
const bool & isAllZeros() const
SQEntry()
Constructs an empty store queue entry.
char _data[MaxDataBytes]
The store data.
bool _committed
Whether or not the store is committed.
const bool & canWB() const
bool & canWB()
Member accessors.
const bool & committed() const
bool _completed
Whether or not the store is completed.
const char * data() const
static constexpr size_t DataSize
const bool & completed() const
Writeback event, specifically for when stores forward data to loads.
WritebackEvent(const DynInstPtr &_inst, PacketPtr pkt, LSQUnit *lsq_ptr)
Constructs a writeback event.
PacketPtr pkt
The packet that would have been sent to memory.
DynInstPtr inst
Instruction whose results are being written back.
const char * description() const
Returns the description of this event.
LSQUnit * lsqPtr
The pointer to the LSQ unit that issued the store.
void process()
Processes the writeback event.
Class that implements the actual LQ and SQ for each specific thread.
void insertStore(const DynInstPtr &store_inst)
Inserts a store instruction.
Fault executeLoad(int lq_idx)
Fault write(LSQRequest *requst, uint8_t *data, ssize_t store_idx)
Executes the store at the given index.
Addr cacheBlockMask
Address Mask for a cache block (e.g.
IEW * iewStage
Pointer to the IEW stage.
bool isStoreBlocked
Whehter or not a store is blocked due to the memory system.
AddrRangeCoverage
Coverage of one address range with another.
@ PartialAddrRangeCoverage
void takeOverFrom()
Takes over from another CPU's thread.
int getLoadHead()
Returns the index of the head load instruction.
bool checkLoads
Should loads be checked for dependency issues.
Fault read(LSQRequest *request, ssize_t load_idx)
Executes the load at the given index.
bool violation()
Returns if there is a memory ordering violation.
bool storeInFlight
Whether or not a store is in flight.
CPU * cpu
Pointer to the CPU.
InstSeqNum getStoreHeadSeqNum()
Returns the sequence number of the head store instruction.
InstSeqNum getLoadHeadSeqNum()
Returns the sequence number of the head load instruction.
unsigned depCheckShift
The number of places to shift addresses in the LSQ before checking for dependency violations.
void storePostSend()
Handles completing the send of a store to memory.
RequestPort * dcachePort
Pointer to the dcache port.
InstSeqNum stallingStoreIsn
The store that causes the stall due to partial store to load forwarding.
bool sqFull()
Returns if the SQ is full.
int numStoresToWB()
Returns the number of stores to writeback.
bool isStalled()
Returns whether or not the LSQ unit is stalled.
void insertLoad(const DynInstPtr &load_inst)
Inserts a load instruction.
Fault executeStore(const DynInstPtr &inst)
Executes a store instruction.
void insert(const DynInstPtr &inst)
Inserts an instruction.
unsigned getCount()
Returns the number of instructions in the LSQ.
bool checkStaleTranslations() const
void setLastRetiredHtmUid(uint64_t htm_uid)
uint64_t getLatestHtmUid() const
void schedule(Event &ev, Tick when)
Schedule event for the cpu.
void writebackStores()
Writes back stores.
Fault checkViolations(typename LoadQueue::iterator &loadIt, const DynInstPtr &inst)
Check for ordering violations in the LSQ.
StoreQueue storeQueue
The store queue.
TimeBuffer< IssueStruct >::wire fromIssue
Wire to read information from the issue stage time queue.
Fault executeLoad(const DynInstPtr &inst)
Executes a load instruction.
void commitLoad()
Commits the head load.
LSQUnit(uint32_t lqEntries, uint32_t sqEntries)
Constructs an LSQ unit.
int getStoreHead()
Returns the index of the head store instruction.
void completeStore(typename StoreQueue::iterator store_idx)
Completes the store at the specified index.
void drainSanityCheck() const
Perform sanity checks after a drain.
int numLoads()
Returns the number of loads in the LQ.
void setDcachePort(RequestPort *dcache_port)
Sets the pointer to the dcache port.
bool sqEmpty() const
Returns if the SQ is empty.
CircularQueue< LQEntry >::iterator LQIterator
unsigned int cacheLineSize()
void resetState()
Reset the LSQ state.
unsigned numFreeStoreEntries()
Returns the number of free SQ entries.
uint64_t lastRetiredHtmUid
int numStores()
Returns the number of stores in the SQ.
LSQ::LSQRequest LSQRequest
LSQUnit(const LSQUnit &l)
We cannot copy LSQUnit because it has stats for which copy contructor is deleted explicitly.
void dumpInsts() const
Debugging function to dump instructions in the LSQ.
bool lqFull()
Returns if the LQ is full.
bool stalled
Whether or not the LSQ is stalled.
ssize_t stallingLoadIdx
The index of the above store.
LoadQueue loadQueue
The load queue.
PacketPtr retryPkt
The packet that needs to be retried.
DynInstPtr getMemDepViolator()
Returns the memory ordering violator.
bool willWB()
Returns if the LSQ unit will writeback on this cycle.
CircularQueue< SQEntry >::iterator SQIterator
bool hasStoresToWB()
Returns if there are any stores to writeback.
DynInstPtr memDepViolator
The oldest load that caused a memory ordering violation.
void squash(const InstSeqNum &squashed_num)
Squashes all instructions younger than a specific sequence number.
std::string name() const
Returns the name of the LSQ unit.
void checkSnoop(PacketPtr pkt)
Check if an incoming invalidate hits in the lsq on a load that might have issued out of order wrt ano...
static constexpr auto MaxDataBytes
void recvRetry()
Handles doing the retry.
int storesToWB
The number of store instructions in the SQ waiting to writeback.
unsigned numFreeLoadEntries()
Returns the number of free LQ entries.
bool trySendPacket(bool isLoad, PacketPtr data_pkt)
Attempts to send a packet to the cache.
StoreQueue::iterator storeWBIt
The index of the first instruction that may be ready to be written back, and has not yet been written...
void writebackBlockedStore()
Try to finish a previously blocked write back attempt.
void commitLoads(InstSeqNum &youngest_inst)
Commits loads older than a specific sequence number.
gem5::o3::LSQUnit::LSQUnitStats stats
void completeDataAccess(PacketPtr pkt)
Completes the data access that has been returned from the memory system.
bool lqEmpty() const
Returns if the LQ is empty.
bool isFull()
Returns if either the LQ or SQ is full.
void startStaleTranslationFlush()
void resetHtmStartsStops()
LSQ * lsq
Pointer to the LSQ.
bool isEmpty() const
Returns if both the LQ and SQ are empty.
bool needsTSO
Flag for memory model.
void commitStores(InstSeqNum &youngest_inst)
Commits stores older than a specific sequence number.
ThreadID lsqID
The LSQUnit thread id.
bool recvTimingResp(PacketPtr pkt)
Handles writing back and completing the load or store that has returned from memory.
Memory operation metadata.
void freeLSQEntry()
The LSQ entry is cleared.
A simple distribution stat.
This is a simple scalar statistic, like a counter.
bool full() const
Is the queue full? A queue is full if the head is the 0^{th} element and the tail is the (size-1)^{th...
#define panic(...)
This implements a cprintf based panic() function.
const FlagsType init
This Stat is Initialized.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
int16_t ThreadID
Thread index/ID type.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
constexpr decltype(nullptr) NoFault
constexpr unsigned MaxVecRegLenInBytes
Declaration of the Packet class.
Iterator to the circular queue.
statistics::Scalar blockedByCache
Number of times the LSQ is blocked due to the cache.
statistics::Scalar forwLoads
Total number of loads forwaded from LSQ stores.
LSQUnitStats(statistics::Group *parent)
statistics::Scalar ignoredResponses
Total number of responses from the memory system that are ignored due to the instruction already bein...
statistics::Distribution loadToUse
Distribution of cycle latency between the first time a load is issued and its completion.
statistics::Scalar rescheduledLoads
Number of loads that were rescheduled.
statistics::Scalar squashedStores
Total number of squashed stores.
statistics::Scalar squashedLoads
Total number of squashed loads.
statistics::Scalar memOrderViolation
Tota number of memory ordering violations.
Vector Registers layout specification.