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

Memory dependency unit class. More...

#include <mem_dep_unit.hh>

Classes

class  MemDepEntry
 Memory dependence entries that track memory operations, marking when the instruction is ready to execute and what instructions depend upon it. More...
 

Public Types

typedef Impl::DynInstPtr DynInstPtr
 

Public Member Functions

 MemDepUnit ()
 Empty constructor. More...
 
 MemDepUnit (DerivO3CPUParams *params)
 Constructs a MemDepUnit with given parameters. More...
 
 ~MemDepUnit ()
 Frees up any memory allocated. More...
 
std::string name () const
 Returns the name of the memory dependence unit. More...
 
void init (DerivO3CPUParams *params, ThreadID tid)
 Initializes the unit with parameters and a thread id. More...
 
void regStats ()
 Registers statistics. More...
 
bool isDrained () const
 Determine if we are drained. More...
 
void drainSanityCheck () const
 Perform sanity checks after a drain. More...
 
void takeOverFrom ()
 Takes over from another CPU's thread. More...
 
void setIQ (InstructionQueue< Impl > *iq_ptr)
 Sets the pointer to the IQ. More...
 
void insert (DynInstPtr &inst)
 Inserts a memory instruction. More...
 
void insertNonSpec (DynInstPtr &inst)
 Inserts a non-speculative memory instruction. More...
 
void insertBarrier (DynInstPtr &barr_inst)
 Inserts a barrier instruction. More...
 
void regsReady (DynInstPtr &inst)
 Indicate that an instruction has its registers ready. More...
 
void nonSpecInstReady (DynInstPtr &inst)
 Indicate that a non-speculative instruction is ready. More...
 
void reschedule (DynInstPtr &inst)
 Reschedules an instruction to be re-executed. More...
 
void replay ()
 Replays all instructions that have been rescheduled by moving them to the ready list. More...
 
void completed (DynInstPtr &inst)
 Completes a memory instruction. More...
 
void completeBarrier (DynInstPtr &inst)
 Completes a barrier instruction. More...
 
void wakeDependents (DynInstPtr &inst)
 Wakes any dependents of a memory instruction. More...
 
void squash (const InstSeqNum &squashed_num, ThreadID tid)
 Squashes all instructions up until a given sequence number for a specific thread. More...
 
void violation (DynInstPtr &store_inst, DynInstPtr &violating_load)
 Indicates an ordering violation between a store and a younger load. More...
 
void issue (DynInstPtr &inst)
 Issues the given instruction. More...
 
void dumpLists ()
 Debugging function to dump the lists of instructions. More...
 

Protected Attributes

std::string _name
 

Private Types

typedef std::list< DynInstPtr >
::iterator 
ListIt
 
typedef std::shared_ptr
< MemDepEntry
MemDepEntryPtr
 
typedef std::unordered_map
< InstSeqNum, MemDepEntryPtr,
SNHash
MemDepHash
 
typedef MemDepHash::iterator MemDepHashIt
 

Private Member Functions

MemDepEntryPtrfindInHash (const DynInstPtr &inst)
 Finds the memory dependence entry in the hash map. More...
 
void moveToReady (MemDepEntryPtr &ready_inst_entry)
 Moves an entry to the ready list. More...
 

Private Attributes

MemDepHash memDepHash
 A hash map of all memory dependence entries. More...
 
std::list< DynInstPtrinstList [Impl::MaxThreads]
 A list of all instructions in the memory dependence unit. More...
 
std::list< DynInstPtrinstsToReplay
 A list of all instructions that are going to be replayed. More...
 
MemDepPred depPred
 The memory dependence predictor. More...
 
bool loadBarrier
 Is there an outstanding load barrier that loads must wait on. More...
 
InstSeqNum loadBarrierSN
 The sequence number of the load barrier. More...
 
bool storeBarrier
 Is there an outstanding store barrier that loads must wait on. More...
 
InstSeqNum storeBarrierSN
 The sequence number of the store barrier. More...
 
InstructionQueue< Impl > * iqPtr
 Pointer to the IQ. More...
 
int id
 The thread id of this memory dependence unit. More...
 
Stats::Scalar insertedLoads
 Stat for number of inserted loads. More...
 
Stats::Scalar insertedStores
 Stat for number of inserted stores. More...
 
Stats::Scalar conflictingLoads
 Stat for number of conflicting loads that had to wait for a store. More...
 
Stats::Scalar conflictingStores
 Stat for number of conflicting stores that had to wait for a store. More...
 

Detailed Description

template<class MemDepPred, class Impl>
class MemDepUnit< MemDepPred, Impl >

Memory dependency unit class.

This holds the memory dependence predictor. As memory operations are issued to the IQ, they are also issued to this unit, which then looks up the prediction as to what they are dependent upon. This unit must be checked prior to a memory operation being able to issue. Although this is templated, it's somewhat hard to make a generic memory dependence unit. This one is mostly for store sets; it will be quite limited in what other memory dependence predictions it can also utilize. Thus this class should be most likely be rewritten for other dependence prediction schemes.

Definition at line 81 of file mem_dep_unit.hh.

Member Typedef Documentation

template<class MemDepPred, class Impl>
typedef Impl::DynInstPtr MemDepUnit< MemDepPred, Impl >::DynInstPtr

Definition at line 87 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
typedef std::list<DynInstPtr>::iterator MemDepUnit< MemDepPred, Impl >::ListIt
private

Definition at line 166 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
typedef std::shared_ptr<MemDepEntry> MemDepUnit< MemDepPred, Impl >::MemDepEntryPtr
private

Definition at line 168 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
typedef std::unordered_map<InstSeqNum, MemDepEntryPtr, SNHash> MemDepUnit< MemDepPred, Impl >::MemDepHash
private

Definition at line 240 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
typedef MemDepHash::iterator MemDepUnit< MemDepPred, Impl >::MemDepHashIt
private

Definition at line 242 of file mem_dep_unit.hh.

Constructor & Destructor Documentation

template<class MemDepPred , class Impl >
MemDepUnit< MemDepPred, Impl >::MemDepUnit ( )

Empty constructor.

Must call init() prior to using in this case.

Definition at line 54 of file mem_dep_unit_impl.hh.

template<class MemDepPred , class Impl >
MemDepUnit< MemDepPred, Impl >::MemDepUnit ( DerivO3CPUParams *  params)

Constructs a MemDepUnit with given parameters.

Definition at line 61 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
MemDepUnit< MemDepPred, Impl >::~MemDepUnit ( )

Frees up any memory allocated.

Definition at line 72 of file mem_dep_unit_impl.hh.

Member Function Documentation

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::completeBarrier ( DynInstPtr inst)

Completes a barrier instruction.

Definition at line 431 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::completed ( DynInstPtr inst)

Completes a memory instruction.

Definition at line 407 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::drainSanityCheck ( ) const

Perform sanity checks after a drain.

Definition at line 145 of file mem_dep_unit_impl.hh.

References ArmISA::i.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::dumpLists ( )

Debugging function to dump the lists of instructions.

Definition at line 585 of file mem_dep_unit_impl.hh.

References cprintf(), and X86ISA::size().

template<class MemDepPred , class Impl >
MemDepUnit< MemDepPred, Impl >::MemDepEntryPtr & MemDepUnit< MemDepPred, Impl >::findInHash ( const DynInstPtr inst)
inlineprivate

Finds the memory dependence entry in the hash map.

Definition at line 561 of file mem_dep_unit_impl.hh.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::init ( DerivO3CPUParams *  params,
ThreadID  tid 
)

Initializes the unit with parameters and a thread id.

Definition at line 98 of file mem_dep_unit_impl.hh.

References csprintf(), and DPRINTF.

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

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::insert ( DynInstPtr inst)

Inserts a memory instruction.

Definition at line 174 of file mem_dep_unit_impl.hh.

References DPRINTF, and panic.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::insertBarrier ( DynInstPtr barr_inst)

Inserts a barrier instruction.

Definition at line 307 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::insertNonSpec ( DynInstPtr inst)

Inserts a non-speculative memory instruction.

Definition at line 271 of file mem_dep_unit_impl.hh.

References DPRINTF, and panic.

template<class MemDepPred , class Impl >
bool MemDepUnit< MemDepPred, Impl >::isDrained ( ) const

Determine if we are drained.

Definition at line 132 of file mem_dep_unit_impl.hh.

References ArmISA::i.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::issue ( DynInstPtr inst)

Issues the given instruction.

Definition at line 551 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::moveToReady ( MemDepEntryPtr ready_inst_entry)
inlineprivate

Moves an entry to the ready list.

Definition at line 572 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred, class Impl>
std::string MemDepUnit< MemDepPred, Impl >::name ( ) const
inline

Returns the name of the memory dependence unit.

Definition at line 99 of file mem_dep_unit.hh.

References MemDepUnit< MemDepPred, Impl >::_name.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::nonSpecInstReady ( DynInstPtr inst)

Indicate that a non-speculative instruction is ready.

Definition at line 366 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::regsReady ( DynInstPtr inst)

Indicate that an instruction has its registers ready.

Definition at line 343 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::regStats ( )

Registers statistics.

Definition at line 111 of file mem_dep_unit_impl.hh.

References name().

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::replay ( )

Replays all instructions that have been rescheduled by moving them to the ready list.

Definition at line 386 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::reschedule ( DynInstPtr inst)

Reschedules an instruction to be re-executed.

Definition at line 379 of file mem_dep_unit_impl.hh.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::setIQ ( InstructionQueue< Impl > *  iq_ptr)

Sets the pointer to the IQ.

Definition at line 167 of file mem_dep_unit_impl.hh.

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

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::squash ( const InstSeqNum squashed_num,
ThreadID  tid 
)

Squashes all instructions up until a given sequence number for a specific thread.

Definition at line 485 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::takeOverFrom ( )

Takes over from another CPU's thread.

Definition at line 157 of file mem_dep_unit_impl.hh.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::violation ( DynInstPtr store_inst,
DynInstPtr violating_load 
)

Indicates an ordering violation between a store and a younger load.

Definition at line 539 of file mem_dep_unit_impl.hh.

References DPRINTF.

template<class MemDepPred , class Impl >
void MemDepUnit< MemDepPred, Impl >::wakeDependents ( DynInstPtr inst)

Wakes any dependents of a memory instruction.

Definition at line 452 of file mem_dep_unit_impl.hh.

References DPRINTF, and ArmISA::i.

Member Data Documentation

template<class MemDepPred, class Impl>
std::string MemDepUnit< MemDepPred, Impl >::_name
protected

Definition at line 84 of file mem_dep_unit.hh.

Referenced by MemDepUnit< MemDepPred, Impl >::name().

template<class MemDepPred, class Impl>
Stats::Scalar MemDepUnit< MemDepPred, Impl >::conflictingLoads
private

Stat for number of conflicting loads that had to wait for a store.

Definition at line 280 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
Stats::Scalar MemDepUnit< MemDepPred, Impl >::conflictingStores
private

Stat for number of conflicting stores that had to wait for a store.

Definition at line 282 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
MemDepPred MemDepUnit< MemDepPred, Impl >::depPred
private

The memory dependence predictor.

It is accessed upon new instructions being added to the IQ, and responds by telling this unit what instruction the newly added instruction is dependent upon.

Definition at line 258 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
int MemDepUnit< MemDepPred, Impl >::id
private

The thread id of this memory dependence unit.

Definition at line 273 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
Stats::Scalar MemDepUnit< MemDepPred, Impl >::insertedLoads
private

Stat for number of inserted loads.

Definition at line 276 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
Stats::Scalar MemDepUnit< MemDepPred, Impl >::insertedStores
private

Stat for number of inserted stores.

Definition at line 278 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
std::list<DynInstPtr> MemDepUnit< MemDepPred, Impl >::instList[Impl::MaxThreads]
private

A list of all instructions in the memory dependence unit.

Definition at line 248 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
std::list<DynInstPtr> MemDepUnit< MemDepPred, Impl >::instsToReplay
private

A list of all instructions that are going to be replayed.

Definition at line 251 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
InstructionQueue<Impl>* MemDepUnit< MemDepPred, Impl >::iqPtr
private

Pointer to the IQ.

Definition at line 270 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
bool MemDepUnit< MemDepPred, Impl >::loadBarrier
private

Is there an outstanding load barrier that loads must wait on.

Definition at line 261 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
InstSeqNum MemDepUnit< MemDepPred, Impl >::loadBarrierSN
private

The sequence number of the load barrier.

Definition at line 263 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
MemDepHash MemDepUnit< MemDepPred, Impl >::memDepHash
private

A hash map of all memory dependence entries.

Definition at line 245 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
bool MemDepUnit< MemDepPred, Impl >::storeBarrier
private

Is there an outstanding store barrier that loads must wait on.

Definition at line 265 of file mem_dep_unit.hh.

template<class MemDepPred, class Impl>
InstSeqNum MemDepUnit< MemDepPred, Impl >::storeBarrierSN
private

The sequence number of the store barrier.

Definition at line 267 of file mem_dep_unit.hh.


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