gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
LSQ< Impl > Class Template Reference

#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

O3CPUcpu
 The CPU pointer. More...
 
IEWiewStage
 The IEW stage pointer. More...
 

Protected Attributes

LSQPolicy lsqPolicy
 The LSQ policy for SMT mode. More...
 
LSQUnitthread
 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...
 

Detailed Description

template<class Impl>
class LSQ< Impl >

Definition at line 58 of file lsq.hh.

Member Typedef Documentation

template<class Impl>
typedef Impl::DynInstPtr LSQ< Impl >::DynInstPtr

Definition at line 61 of file lsq.hh.

template<class Impl>
typedef Impl::CPUPol::IEW LSQ< Impl >::IEW

Definition at line 62 of file lsq.hh.

template<class Impl>
typedef Impl::CPUPol::LSQUnit LSQ< Impl >::LSQUnit

Definition at line 63 of file lsq.hh.

template<class Impl>
typedef Impl::O3CPU LSQ< Impl >::O3CPU

Definition at line 60 of file lsq.hh.

Member Enumeration Documentation

template<class Impl>
enum LSQ::LSQPolicy

SMT policy.

Enumerator
Dynamic 
Partitioned 
Threshold 

Definition at line 66 of file lsq.hh.

Constructor & Destructor Documentation

template<class Impl >
LSQ< Impl >::LSQ ( O3CPU cpu_ptr,
IEW iew_ptr,
DerivO3CPUParams *  params 
)
template<class Impl>
LSQ< Impl >::~LSQ ( )
inline

Definition at line 74 of file lsq.hh.

References LSQ< Impl >::thread.

Member Function Documentation

template<class Impl>
void LSQ< Impl >::commitLoads ( InstSeqNum youngest_inst,
ThreadID  tid 
)
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.

template<class Impl>
void LSQ< Impl >::commitStores ( InstSeqNum youngest_inst,
ThreadID  tid 
)
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.

template<class Impl >
void LSQ< Impl >::drainSanityCheck ( ) const

Perform sanity checks after a drain.

Definition at line 153 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::dumpInsts ( ) const

Debugging function to print out all instructions.

Definition at line 690 of file lsq_impl.hh.

template<class Impl>
void LSQ< Impl >::dumpInsts ( ThreadID  tid) const
inline

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.

template<class Impl >
int LSQ< Impl >::entryAmount ( ThreadID  num_threads)

Number of entries needed for the given amount of threads.

Definition at line 191 of file lsq_impl.hh.

template<class Impl >
Fault LSQ< Impl >::executeLoad ( DynInstPtr inst)

Executes a load.

Definition at line 278 of file lsq_impl.hh.

template<class Impl >
Fault LSQ< Impl >::executeStore ( DynInstPtr inst)

Executes a store.

Definition at line 287 of file lsq_impl.hh.

template<class Impl >
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.

template<class Impl>
int LSQ< Impl >::getCount ( ThreadID  tid)
inline

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.

template<class Impl>
int LSQ< Impl >::getLoadHead ( ThreadID  tid)
inline

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.

template<class Impl>
InstSeqNum LSQ< Impl >::getLoadHeadSeqNum ( ThreadID  tid)
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.

template<class Impl>
DynInstPtr LSQ< Impl >::getMemDepViolator ( ThreadID  tid)
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.

template<class Impl>
int LSQ< Impl >::getStoreHead ( ThreadID  tid)
inline

Returns the head index of the store queue.

Definition at line 169 of file lsq.hh.

References LSQUnit< Impl >::getStoreHead(), and LSQ< Impl >::thread.

template<class Impl>
InstSeqNum LSQ< Impl >::getStoreHeadSeqNum ( ThreadID  tid)
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.

template<class Impl >
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().

template<class Impl>
bool LSQ< Impl >::hasStoresToWB ( ThreadID  tid)
inline

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.

template<class Impl >
void LSQ< Impl >::insertLoad ( DynInstPtr load_inst)

Inserts a load into the LSQ.

Definition at line 260 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::insertStore ( DynInstPtr store_inst)

Inserts a store into the LSQ.

Definition at line 269 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::isDrained ( ) const

Has the LSQ drained?

Definition at line 163 of file lsq_impl.hh.

References DPRINTF.

template<class Impl >
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.

template<class Impl >
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.

template<class Impl >
bool LSQ< Impl >::isFull ( ThreadID  tid)

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.

template<class Impl >
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.

template<class Impl >
bool LSQ< Impl >::isStalled ( ThreadID  tid)

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.

template<class Impl >
bool LSQ< Impl >::lqEmpty ( ) const

Returns if all of the LQs are empty.

Definition at line 537 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::lqFull ( )

Returns if any of the LQs are full.

Definition at line 571 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::lqFull ( ThreadID  tid)

Returns if the LQ of a given thread is full.

Definition at line 588 of file lsq_impl.hh.

template<class Impl >
std::string LSQ< Impl >::name ( ) const

Returns the name of the LSQ.

Definition at line 128 of file lsq_impl.hh.

template<class Impl>
unsigned LSQ< Impl >::numFreeEntries ( ThreadID  tid)

Returns the number of free entries for a specific thread.

template<class Impl >
unsigned LSQ< Impl >::numFreeLoadEntries ( )

Returns the number of free load entries.

Definition at line 451 of file lsq_impl.hh.

References Stats::total.

template<class Impl >
unsigned LSQ< Impl >::numFreeLoadEntries ( ThreadID  tid)

Returns the number of free entries in the LQ for a specific thread.

Definition at line 487 of file lsq_impl.hh.

template<class Impl >
unsigned LSQ< Impl >::numFreeStoreEntries ( )

Returns the number of free store entries.

Definition at line 469 of file lsq_impl.hh.

References Stats::total.

template<class Impl >
unsigned LSQ< Impl >::numFreeStoreEntries ( ThreadID  tid)

Returns the number of free entries in the SQ for a specific thread.

Definition at line 494 of file lsq_impl.hh.

template<class Impl >
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.

template<class Impl>
int LSQ< Impl >::numLoads ( ThreadID  tid)
inline

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.

template<class Impl >
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.

template<class Impl>
int LSQ< Impl >::numStores ( ThreadID  tid)
inline

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.

template<class Impl>
int LSQ< Impl >::numStoresToWB ( ThreadID  tid)
inline

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.

template<class Impl >
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().

template<class Impl >
void LSQ< Impl >::recvReqRetry ( )

Retry the previous send that failed.

Definition at line 333 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::recvTimingResp ( PacketPtr  pkt)

Handles writing back and completing the load or store that has returned from memory.

Parameters
pktResponse 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.

template<class Impl >
void LSQ< Impl >::recvTimingSnoopReq ( PacketPtr  pkt)

Definition at line 380 of file lsq_impl.hh.

References Packet::cmdString(), DPRINTF, Packet::getAddr(), and Packet::isInvalidate().

template<class Impl >
void LSQ< Impl >::regStats ( )

Registers statistics of each LSQ unit.

Definition at line 135 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::removeEntries ( ThreadID  tid)

Definition at line 230 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::resetEntries ( )

Reset the max entries for each thread.

Definition at line 202 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::resizeEntries ( unsigned  size,
ThreadID  tid 
)

Resize the max entries for a thread.

Definition at line 238 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::setActiveThreads ( std::list< ThreadID > *  at_ptr)

Sets the pointer to the list of active threads.

Definition at line 145 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::sqEmpty ( ) const

Returns if all of the SQs are empty.

Definition at line 554 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::sqFull ( )

Returns if any of the SQs are full.

Definition at line 600 of file lsq_impl.hh.

template<class Impl >
bool LSQ< Impl >::sqFull ( ThreadID  tid)

Returns if the SQ of a given thread is full.

Definition at line 617 of file lsq_impl.hh.

template<class Impl>
void LSQ< Impl >::squash ( const InstSeqNum squashed_num,
ThreadID  tid 
)
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.

template<class Impl >
void LSQ< Impl >::takeOverFrom ( )

Takes over execution from another CPU's thread.

Definition at line 182 of file lsq_impl.hh.

template<class Impl >
void LSQ< Impl >::tick ( )

Ticks the LSQ.

Definition at line 246 of file lsq_impl.hh.

template<class Impl>
void LSQ< Impl >::tick ( ThreadID  tid)
inline

Ticks a specific LSQ Unit.

Definition at line 105 of file lsq.hh.

References LSQ< Impl >::thread, and LSQUnit< Impl >::tick().

template<class Impl >
bool LSQ< Impl >::violation ( )

Returns whether or not there was a memory ordering violation.

Definition at line 315 of file lsq_impl.hh.

template<class Impl>
bool LSQ< Impl >::violation ( ThreadID  tid)
inline

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().

template<class Impl >
bool LSQ< Impl >::willWB ( )

Returns if the LSQ will write back to memory this cycle.

Definition at line 673 of file lsq_impl.hh.

template<class Impl>
bool LSQ< Impl >::willWB ( ThreadID  tid)
inline

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().

template<class Impl >
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().

template<class Impl >
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.

template<class Impl>
void LSQ< Impl >::writebackStores ( ThreadID  tid)

Same as above, but only for one thread.

Member Data Documentation

template<class Impl>
std::list<ThreadID>* LSQ< Impl >::activeThreads
protected

List of Active Threads in System.

Definition at line 315 of file lsq.hh.

template<class Impl>
O3CPU* LSQ< Impl >::cpu

The CPU pointer.

Definition at line 302 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
IEW* LSQ< Impl >::iewStage

The IEW stage pointer.

Definition at line 305 of file lsq.hh.

template<class Impl>
unsigned LSQ< Impl >::LQEntries
protected

Total Size of LQ Entries.

Definition at line 318 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
LSQPolicy LSQ< Impl >::lsqPolicy
protected

The LSQ policy for SMT mode.

Definition at line 309 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
unsigned LSQ< Impl >::maxLQEntries
protected

Max LQ Size - Used to Enforce Sharing Policies.

Definition at line 323 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
unsigned LSQ< Impl >::maxSQEntries
protected

Max SQ Size - Used to Enforce Sharing Policies.

Definition at line 326 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
ThreadID LSQ< Impl >::numThreads
protected

Number of Threads.

Definition at line 329 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
unsigned LSQ< Impl >::SQEntries
protected

Total Size of SQ Entries.

Definition at line 320 of file lsq.hh.

Referenced by LSQ< Impl >::LSQ().

template<class Impl>
LSQUnit* LSQ< Impl >::thread
protected

The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:14 for gem5 by doxygen 1.8.6