gem5
|
#include <lsq.hh>
Public Types | |
enum | LSQPolicy { Dynamic, Partitioned, Threshold } |
SMT policy. More... | |
typedef Impl::O3CPU | O3CPU |
typedef Impl::DynInstPtr | DynInstPtr |
typedef Impl::CPUPol::IEW | IEW |
typedef Impl::CPUPol::LSQUnit | LSQUnit |
Public Member Functions | |
LSQ (O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) | |
Constructs an LSQ with the given parameters. More... | |
~LSQ () | |
std::string | name () const |
Returns the name of the LSQ. More... | |
void | regStats () |
Registers statistics of each LSQ unit. More... | |
void | setActiveThreads (std::list< ThreadID > *at_ptr) |
Sets the pointer to the list of active threads. More... | |
void | drainSanityCheck () const |
Perform sanity checks after a drain. More... | |
bool | isDrained () const |
Has the LSQ drained? More... | |
void | takeOverFrom () |
Takes over execution from another CPU's thread. More... | |
int | entryAmount (ThreadID num_threads) |
Number of entries needed for the given amount of threads. More... | |
void | removeEntries (ThreadID tid) |
void | resetEntries () |
Reset the max entries for each thread. More... | |
void | resizeEntries (unsigned size, ThreadID tid) |
Resize the max entries for a thread. More... | |
void | tick () |
Ticks the LSQ. More... | |
void | tick (ThreadID tid) |
Ticks a specific LSQ Unit. More... | |
void | insertLoad (DynInstPtr &load_inst) |
Inserts a load into the LSQ. More... | |
void | insertStore (DynInstPtr &store_inst) |
Inserts a store into the LSQ. More... | |
Fault | executeLoad (DynInstPtr &inst) |
Executes a load. More... | |
Fault | executeStore (DynInstPtr &inst) |
Executes a store. More... | |
void | commitLoads (InstSeqNum &youngest_inst, ThreadID tid) |
Commits loads up until the given sequence number for a specific thread. More... | |
void | commitStores (InstSeqNum &youngest_inst, ThreadID tid) |
Commits stores up until the given sequence number for a specific thread. More... | |
void | writebackStores () |
Attempts to write back stores until all cache ports are used or the interface becomes blocked. More... | |
void | writebackStores (ThreadID tid) |
Same as above, but only for one thread. More... | |
void | squash (const InstSeqNum &squashed_num, ThreadID tid) |
Squash instructions from a thread until the specified sequence number. More... | |
bool | violation () |
Returns whether or not there was a memory ordering violation. More... | |
bool | violation (ThreadID tid) |
Returns whether or not there was a memory ordering violation for a specific thread. More... | |
DynInstPtr | getMemDepViolator (ThreadID tid) |
Gets the instruction that caused the memory ordering violation. More... | |
int | getLoadHead (ThreadID tid) |
Returns the head index of the load queue for a specific thread. More... | |
InstSeqNum | getLoadHeadSeqNum (ThreadID tid) |
Returns the sequence number of the head of the load queue. More... | |
int | getStoreHead (ThreadID tid) |
Returns the head index of the store queue. More... | |
InstSeqNum | getStoreHeadSeqNum (ThreadID tid) |
Returns the sequence number of the head of the store queue. More... | |
int | getCount () |
Returns the number of instructions in all of the queues. More... | |
int | getCount (ThreadID tid) |
Returns the number of instructions in the queues of one thread. More... | |
int | numLoads () |
Returns the total number of loads in the load queue. More... | |
int | numLoads (ThreadID tid) |
Returns the total number of loads for a single thread. More... | |
int | numStores () |
Returns the total number of stores in the store queue. More... | |
int | numStores (ThreadID tid) |
Returns the total number of stores for a single thread. More... | |
unsigned | numFreeLoadEntries () |
Returns the number of free load entries. More... | |
unsigned | numFreeStoreEntries () |
Returns the number of free store entries. More... | |
unsigned | numFreeEntries (ThreadID tid) |
Returns the number of free entries for a specific thread. More... | |
unsigned | numFreeLoadEntries (ThreadID tid) |
Returns the number of free entries in the LQ for a specific thread. More... | |
unsigned | numFreeStoreEntries (ThreadID tid) |
Returns the number of free entries in the SQ for a specific thread. More... | |
bool | isFull () |
Returns if the LSQ is full (either LQ or SQ is full). More... | |
bool | isFull (ThreadID tid) |
Returns if the LSQ is full for a specific thread (either LQ or SQ is full). More... | |
bool | isEmpty () const |
Returns if the LSQ is empty (both LQ and SQ are empty). More... | |
bool | lqEmpty () const |
Returns if all of the LQs are empty. More... | |
bool | sqEmpty () const |
Returns if all of the SQs are empty. More... | |
bool | lqFull () |
Returns if any of the LQs are full. More... | |
bool | lqFull (ThreadID tid) |
Returns if the LQ of a given thread is full. More... | |
bool | sqFull () |
Returns if any of the SQs are full. More... | |
bool | sqFull (ThreadID tid) |
Returns if the SQ of a given thread is full. More... | |
bool | isStalled () |
Returns if the LSQ is stalled due to a memory operation that must be replayed. More... | |
bool | isStalled (ThreadID tid) |
Returns if the LSQ of a specific thread is stalled due to a memory operation that must be replayed. More... | |
bool | hasStoresToWB () |
Returns whether or not there are any stores to write back to memory. More... | |
bool | hasStoresToWB (ThreadID tid) |
Returns whether or not a specific thread has any stores to write back to memory. More... | |
int | numStoresToWB (ThreadID tid) |
Returns the number of stores a specific thread has to write back. More... | |
bool | willWB () |
Returns if the LSQ will write back to memory this cycle. More... | |
bool | willWB (ThreadID tid) |
Returns if the LSQ of a specific thread will write back to memory this cycle. More... | |
void | dumpInsts () const |
Debugging function to print out all instructions. More... | |
void | dumpInsts (ThreadID tid) const |
Debugging function to print out instructions from a specific thread. More... | |
Fault | read (RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, int load_idx) |
Executes a read operation, using the load specified at the load index. More... | |
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. More... | |
void | recvReqRetry () |
Retry the previous send that failed. More... | |
bool | recvTimingResp (PacketPtr pkt) |
Handles writing back and completing the load or store that has returned from memory. More... | |
void | recvTimingSnoopReq (PacketPtr pkt) |
Public Attributes | |
O3CPU * | cpu |
The CPU pointer. More... | |
IEW * | iewStage |
The IEW stage pointer. More... | |
Protected Attributes | |
LSQPolicy | lsqPolicy |
The LSQ policy for SMT mode. More... | |
LSQUnit * | thread |
The LSQ units for individual threads. More... | |
std::list< ThreadID > * | activeThreads |
List of Active Threads in System. More... | |
unsigned | LQEntries |
Total Size of LQ Entries. More... | |
unsigned | SQEntries |
Total Size of SQ Entries. More... | |
unsigned | maxLQEntries |
Max LQ Size - Used to Enforce Sharing Policies. More... | |
unsigned | maxSQEntries |
Max SQ Size - Used to Enforce Sharing Policies. More... | |
ThreadID | numThreads |
Number of Threads. More... | |
typedef Impl::DynInstPtr LSQ< Impl >::DynInstPtr |
enum LSQ::LSQPolicy |
LSQ< Impl >::LSQ | ( | O3CPU * | cpu_ptr, |
IEW * | iew_ptr, | ||
DerivO3CPUParams * | params | ||
) |
Constructs an LSQ with the given parameters.
Definition at line 61 of file lsq_impl.hh.
References LSQ< Impl >::cpu, DPRINTF, LSQ< Impl >::Dynamic, LSQUnit< Impl >::init(), LSQ< Impl >::LQEntries, LSQ< Impl >::lsqPolicy, LSQ< Impl >::maxLQEntries, LSQ< Impl >::maxSQEntries, LSQ< Impl >::numThreads, LSQ< Impl >::Partitioned, LSQUnit< Impl >::setDcachePort(), LSQ< Impl >::SQEntries, LSQ< Impl >::thread, and LSQ< Impl >::Threshold.
Definition at line 74 of file lsq.hh.
References LSQ< Impl >::thread.
|
inline |
Commits loads up until the given sequence number for a specific thread.
Definition at line 122 of file lsq.hh.
References LSQUnit< Impl >::commitLoads(), and LSQ< Impl >::thread.
|
inline |
Commits stores up until the given sequence number for a specific thread.
Definition at line 128 of file lsq.hh.
References LSQUnit< Impl >::commitStores(), and LSQ< Impl >::thread.
void LSQ< Impl >::drainSanityCheck | ( | ) | const |
Perform sanity checks after a drain.
Definition at line 153 of file lsq_impl.hh.
void LSQ< Impl >::dumpInsts | ( | ) | const |
Debugging function to print out all instructions.
Definition at line 690 of file lsq_impl.hh.
Debugging function to print out instructions from a specific thread.
Definition at line 271 of file lsq.hh.
References LSQUnit< Impl >::dumpInsts(), and LSQ< Impl >::thread.
Number of entries needed for the given amount of threads.
Definition at line 191 of file lsq_impl.hh.
Fault LSQ< Impl >::executeLoad | ( | DynInstPtr & | inst | ) |
Executes a load.
Definition at line 278 of file lsq_impl.hh.
Fault LSQ< Impl >::executeStore | ( | DynInstPtr & | inst | ) |
Executes a store.
Definition at line 287 of file lsq_impl.hh.
int LSQ< Impl >::getCount | ( | ) |
Returns the number of instructions in all of the queues.
Definition at line 397 of file lsq_impl.hh.
References Stats::total.
Returns the number of instructions in the queues of one thread.
Definition at line 181 of file lsq.hh.
References LSQUnit< Impl >::getCount(), and LSQ< Impl >::thread.
Returns the head index of the load queue for a specific thread.
Definition at line 159 of file lsq.hh.
References LSQUnit< Impl >::getLoadHead(), and LSQ< Impl >::thread.
|
inline |
Returns the sequence number of the head of the load queue.
Definition at line 163 of file lsq.hh.
References LSQUnit< Impl >::getLoadHeadSeqNum(), and LSQ< Impl >::thread.
|
inline |
Gets the instruction that caused the memory ordering violation.
Definition at line 155 of file lsq.hh.
References LSQUnit< Impl >::getMemDepViolator(), and LSQ< Impl >::thread.
Returns the head index of the store queue.
Definition at line 169 of file lsq.hh.
References LSQUnit< Impl >::getStoreHead(), and LSQ< Impl >::thread.
|
inline |
Returns the sequence number of the head of the store queue.
Definition at line 173 of file lsq.hh.
References LSQUnit< Impl >::getStoreHeadSeqNum(), and LSQ< Impl >::thread.
bool LSQ< Impl >::hasStoresToWB | ( | ) |
Returns whether or not there are any stores to write back to memory.
Definition at line 656 of file lsq_impl.hh.
Referenced by DefaultIEW< Impl >::hasStoresToWB().
Returns whether or not a specific thread has any stores to write back to memory.
Definition at line 253 of file lsq.hh.
References LSQUnit< Impl >::hasStoresToWB(), and LSQ< Impl >::thread.
void LSQ< Impl >::insertLoad | ( | DynInstPtr & | load_inst | ) |
Inserts a load into the LSQ.
Definition at line 260 of file lsq_impl.hh.
void LSQ< Impl >::insertStore | ( | DynInstPtr & | store_inst | ) |
Inserts a store into the LSQ.
Definition at line 269 of file lsq_impl.hh.
bool LSQ< Impl >::isDrained | ( | ) | const |
bool LSQ< Impl >::isEmpty | ( | ) | const |
Returns if the LSQ is empty (both LQ and SQ are empty).
Definition at line 530 of file lsq_impl.hh.
bool LSQ< Impl >::isFull | ( | ) |
Returns if the LSQ is full (either LQ or SQ is full).
Definition at line 501 of file lsq_impl.hh.
Returns if the LSQ is full for a specific thread (either LQ or SQ is full).
Definition at line 518 of file lsq_impl.hh.
bool LSQ< Impl >::isStalled | ( | ) |
Returns if the LSQ is stalled due to a memory operation that must be replayed.
Definition at line 629 of file lsq_impl.hh.
Returns if the LSQ of a specific thread is stalled due to a memory operation that must be replayed.
Definition at line 646 of file lsq_impl.hh.
bool LSQ< Impl >::lqEmpty | ( | ) | const |
Returns if all of the LQs are empty.
Definition at line 537 of file lsq_impl.hh.
bool LSQ< Impl >::lqFull | ( | ) |
Returns if any of the LQs are full.
Definition at line 571 of file lsq_impl.hh.
Returns if the LQ of a given thread is full.
Definition at line 588 of file lsq_impl.hh.
std::string LSQ< Impl >::name | ( | ) | const |
Returns the name of the LSQ.
Definition at line 128 of file lsq_impl.hh.
Returns the number of free entries for a specific thread.
unsigned LSQ< Impl >::numFreeLoadEntries | ( | ) |
Returns the number of free load entries.
Definition at line 451 of file lsq_impl.hh.
References Stats::total.
Returns the number of free entries in the LQ for a specific thread.
Definition at line 487 of file lsq_impl.hh.
unsigned LSQ< Impl >::numFreeStoreEntries | ( | ) |
Returns the number of free store entries.
Definition at line 469 of file lsq_impl.hh.
References Stats::total.
Returns the number of free entries in the SQ for a specific thread.
Definition at line 494 of file lsq_impl.hh.
int LSQ< Impl >::numLoads | ( | ) |
Returns the total number of loads in the load queue.
Definition at line 415 of file lsq_impl.hh.
References Stats::total.
Returns the total number of loads for a single thread.
Definition at line 187 of file lsq.hh.
References LSQUnit< Impl >::numLoads(), and LSQ< Impl >::thread.
int LSQ< Impl >::numStores | ( | ) |
Returns the total number of stores in the store queue.
Definition at line 433 of file lsq_impl.hh.
References Stats::total.
Returns the total number of stores for a single thread.
Definition at line 193 of file lsq.hh.
References LSQUnit< Impl >::numStores(), and LSQ< Impl >::thread.
Returns the number of stores a specific thread has to write back.
Definition at line 257 of file lsq.hh.
References LSQUnit< Impl >::numStoresToWB(), and LSQ< Impl >::thread.
Fault LSQ< Impl >::read | ( | RequestPtr | req, |
RequestPtr | sreqLow, | ||
RequestPtr | sreqHigh, | ||
int | load_idx | ||
) |
Executes a read operation, using the load specified at the load index.
Definition at line 334 of file lsq.hh.
References Request::contextId().
void LSQ< Impl >::recvReqRetry | ( | ) |
Retry the previous send that failed.
Definition at line 333 of file lsq_impl.hh.
Handles writing back and completing the load or store that has returned from memory.
pkt | Response packet from the memory sub-system |
Definition at line 344 of file lsq_impl.hh.
References Request::contextId(), DPRINTF, Packet::getAddr(), Packet::isError(), Packet::isInvalidate(), and Packet::req.
Definition at line 380 of file lsq_impl.hh.
References Packet::cmdString(), DPRINTF, Packet::getAddr(), and Packet::isInvalidate().
void LSQ< Impl >::regStats | ( | ) |
Registers statistics of each LSQ unit.
Definition at line 135 of file lsq_impl.hh.
Definition at line 230 of file lsq_impl.hh.
void LSQ< Impl >::resetEntries | ( | ) |
Reset the max entries for each thread.
Definition at line 202 of file lsq_impl.hh.
Resize the max entries for a thread.
Definition at line 238 of file lsq_impl.hh.
Sets the pointer to the list of active threads.
Definition at line 145 of file lsq_impl.hh.
bool LSQ< Impl >::sqEmpty | ( | ) | const |
Returns if all of the SQs are empty.
Definition at line 554 of file lsq_impl.hh.
bool LSQ< Impl >::sqFull | ( | ) |
Returns if any of the SQs are full.
Definition at line 600 of file lsq_impl.hh.
Returns if the SQ of a given thread is full.
Definition at line 617 of file lsq_impl.hh.
|
inline |
Squash instructions from a thread until the specified sequence number.
Definition at line 142 of file lsq.hh.
References LSQUnit< Impl >::squash(), and LSQ< Impl >::thread.
void LSQ< Impl >::takeOverFrom | ( | ) |
Takes over execution from another CPU's thread.
Definition at line 182 of file lsq_impl.hh.
void LSQ< Impl >::tick | ( | ) |
Ticks the LSQ.
Definition at line 246 of file lsq_impl.hh.
Ticks a specific LSQ Unit.
Definition at line 105 of file lsq.hh.
References LSQ< Impl >::thread, and LSQUnit< Impl >::tick().
bool LSQ< Impl >::violation | ( | ) |
Returns whether or not there was a memory ordering violation.
Definition at line 315 of file lsq_impl.hh.
Returns whether or not there was a memory ordering violation for a specific thread.
Definition at line 151 of file lsq.hh.
References LSQ< Impl >::thread, and LSQUnit< Impl >::violation().
bool LSQ< Impl >::willWB | ( | ) |
Returns if the LSQ will write back to memory this cycle.
Definition at line 673 of file lsq_impl.hh.
Returns if the LSQ of a specific thread will write back to memory this cycle.
Definition at line 265 of file lsq.hh.
References LSQ< Impl >::thread, and LSQUnit< Impl >::willWB().
Fault LSQ< Impl >::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.
Definition at line 344 of file lsq.hh.
References Request::contextId().
void LSQ< Impl >::writebackStores | ( | ) |
Attempts to write back stores until all cache ports are used or the interface becomes blocked.
Definition at line 296 of file lsq_impl.hh.
References DPRINTF.
Same as above, but only for one thread.
|
protected |
The LSQ policy for SMT mode.
Definition at line 309 of file lsq.hh.
Referenced by LSQ< Impl >::LSQ().
|
protected |
Max LQ Size - Used to Enforce Sharing Policies.
Definition at line 323 of file lsq.hh.
Referenced by LSQ< Impl >::LSQ().
|
protected |
Max SQ Size - Used to Enforce Sharing Policies.
Definition at line 326 of file lsq.hh.
Referenced by LSQ< Impl >::LSQ().
|
protected |
The LSQ units for individual threads.
Definition at line 312 of file lsq.hh.
Referenced by LSQ< Impl >::commitLoads(), LSQ< Impl >::commitStores(), LSQ< Impl >::dumpInsts(), LSQ< Impl >::getCount(), LSQ< Impl >::getLoadHead(), LSQ< Impl >::getLoadHeadSeqNum(), LSQ< Impl >::getMemDepViolator(), LSQ< Impl >::getStoreHead(), LSQ< Impl >::getStoreHeadSeqNum(), LSQ< Impl >::hasStoresToWB(), LSQ< Impl >::LSQ(), LSQ< Impl >::numLoads(), LSQ< Impl >::numStores(), LSQ< Impl >::numStoresToWB(), LSQ< Impl >::squash(), LSQ< Impl >::tick(), LSQ< Impl >::violation(), LSQ< Impl >::willWB(), and LSQ< Impl >::~LSQ().