gem5  v20.1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MemChecker::ByteTracker Class Reference

The ByteTracker keeps track of transactions for the same byte – all outstanding reads, the completed reads (and what they observed) and write clusters (see WriteCluster). More...

#include <mem_checker.hh>

Inheritance diagram for MemChecker::ByteTracker:
Named

Public Member Functions

 ByteTracker (Addr addr=0, const MemChecker *parent=NULL)
 
void startRead (Serial serial, Tick start)
 Starts a read transaction. More...
 
bool inExpectedData (Tick start, Tick complete, uint8_t data)
 Given a start and end time (of any read transaction), this function iterates through all data that such a read is expected to see. More...
 
bool completeRead (Serial serial, Tick complete, uint8_t data)
 Completes a read transaction that is still outstanding. More...
 
void startWrite (Serial serial, Tick start, uint8_t data)
 Starts a write transaction. More...
 
void completeWrite (Serial serial, Tick complete)
 Completes a write transaction. More...
 
void abortWrite (Serial serial)
 Aborts a write transaction. More...
 
const std::vector< uint8_t > & lastExpectedData () const
 This function returns the expected data that inExpectedData iterated through in the last call. More...
 
- Public Member Functions inherited from Named
 Named (const std::string &name_)
 
const std::string & name () const
 

Private Member Functions

WriteClustergetIncompleteWriteCluster ()
 Convenience function to return the most recent incomplete write cluster. More...
 
template<class TList >
TList::iterator lastCompletedTransaction (TList *l, Tick before)
 Helper function to return an iterator to the entry of a container of Transaction compatible classes, before a certain tick. More...
 
void pruneTransactions ()
 Prunes no longer needed transactions. More...
 

Private Attributes

std::map< Serial, TransactionoutstandingReads
 Maintains a map of Serial -> Transaction for all outstanding reads. More...
 
TransactionList readObservations
 List of completed reads, i.e. More...
 
WriteClusterList writeClusters
 List of write clusters for this address. More...
 
std::vector< uint8_t > _lastExpectedData
 See lastExpectedData(). More...
 

Additional Inherited Members

- Protected Attributes inherited from Named
const std::string _name
 

Detailed Description

The ByteTracker keeps track of transactions for the same byte – all outstanding reads, the completed reads (and what they observed) and write clusters (see WriteCluster).

Definition at line 200 of file mem_checker.hh.

Constructor & Destructor Documentation

◆ ByteTracker()

MemChecker::ByteTracker::ByteTracker ( Addr  addr = 0,
const MemChecker parent = NULL 
)
inline

Member Function Documentation

◆ abortWrite()

void MemChecker::ByteTracker::abortWrite ( MemChecker::Serial  serial)

Aborts a write transaction.

Wrapper to abortWrite of WriteCluster instance.

Parameters
serialUnique identifier of a write previously started.

Definition at line 269 of file mem_checker.cc.

Referenced by MemChecker::abortWrite().

◆ completeRead()

bool MemChecker::ByteTracker::completeRead ( MemChecker::Serial  serial,
Tick  complete,
uint8_t  data 
)

Completes a read transaction that is still outstanding.

Parameters
serialUnique identifier of a read previously started.
completeWhen the read got a response.
dataThe data returned by the memory subsystem.

Definition at line 220 of file mem_checker.cc.

References data, and warn.

Referenced by MemChecker::completeRead().

◆ completeWrite()

void MemChecker::ByteTracker::completeWrite ( MemChecker::Serial  serial,
Tick  complete 
)

Completes a write transaction.

Wrapper to startWrite of WriteCluster instance.

Parameters
serialUnique identifier of a write previously started.
completeWhen the write was sent off to the memory subsystem.

Definition at line 262 of file mem_checker.cc.

Referenced by MemChecker::completeWrite().

◆ getIncompleteWriteCluster()

MemChecker::WriteCluster * MemChecker::ByteTracker::getIncompleteWriteCluster ( )
private

Convenience function to return the most recent incomplete write cluster.

Instantiates new write cluster if the most recent one has been completed.

Returns
The most recent incomplete write cluster.

Definition at line 245 of file mem_checker.cc.

◆ inExpectedData()

bool MemChecker::ByteTracker::inExpectedData ( Tick  start,
Tick  complete,
uint8_t  data 
)

Given a start and end time (of any read transaction), this function iterates through all data that such a read is expected to see.

The data parameter is the actual value that we observed, and the function immediately returns true when a match is found, false otherwise.

The set of expected data are:

  1. The last value observed by a read with a completion time before this start time (if any).
  2. The data produced by write transactions with a completion after the last observed read start time. Only data produced in the closest overlapping / earlier write cluster relative to this check request is considered, as writes in separate clusters are not reordered.
Parameters
startStart time of transaction to validate.
completeEnd time of transaction to validate.
dataThe value that we have actually seen.
Returns
True if a match is found, false otherwise.

Definition at line 127 of file mem_checker.cc.

References MemChecker::Transaction::complete, data, MemChecker::Transaction::data, DPRINTF, MemChecker::Transaction::start, and MemChecker::TICK_INITIAL.

◆ lastCompletedTransaction()

template<class TList >
TList::iterator MemChecker::ByteTracker::lastCompletedTransaction ( TList *  l,
Tick  before 
)
inlineprivate

Helper function to return an iterator to the entry of a container of Transaction compatible classes, before a certain tick.

Parameters
beforeTick value which should be greater than the completion tick of the returned element.
Returns
Iterator into container.

Definition at line 320 of file mem_checker.hh.

References MipsISA::l.

◆ lastExpectedData()

const std::vector<uint8_t>& MemChecker::ByteTracker::lastExpectedData ( ) const
inline

This function returns the expected data that inExpectedData iterated through in the last call.

If inExpectedData last returned true, the set may be incomplete; if inExpectedData last returned false, the vector will contain the full set.

Returns
Reference to internally maintained vector maintaining last expected data that inExpectedData iterated through.

Definition at line 296 of file mem_checker.hh.

References _lastExpectedData.

Referenced by MemChecker::completeRead().

◆ pruneTransactions()

void MemChecker::ByteTracker::pruneTransactions ( )
private

Prunes no longer needed transactions.

We only keep up to the last / most recent of each, readObservations and writeClusters, before the first outstanding read.

It depends on the contention / overlap between memory operations to the same location of a particular workload how large each of them would grow.

Definition at line 275 of file mem_checker.cc.

References curTick().

◆ startRead()

void MemChecker::ByteTracker::startRead ( MemChecker::Serial  serial,
Tick  start 
)

Starts a read transaction.

Parameters
serialUnique identifier for the read.
startWhen the read was sent off to the memory subsystem.

Definition at line 120 of file mem_checker.cc.

References MemChecker::TICK_FUTURE.

Referenced by MemChecker::startRead().

◆ startWrite()

void MemChecker::ByteTracker::startWrite ( MemChecker::Serial  serial,
Tick  start,
uint8_t  data 
)

Starts a write transaction.

Wrapper to startWrite of WriteCluster instance.

Parameters
serialUnique identifier of the write.
startWhen the write was sent off to the memory subsystem.
dataThe data that this write passed to the memory subsystem.

Definition at line 255 of file mem_checker.cc.

References data.

Referenced by MemChecker::startWrite().

Member Data Documentation

◆ _lastExpectedData

std::vector<uint8_t> MemChecker::ByteTracker::_lastExpectedData
private

See lastExpectedData().

Definition at line 367 of file mem_checker.hh.

Referenced by lastExpectedData().

◆ outstandingReads

std::map<Serial, Transaction> MemChecker::ByteTracker::outstandingReads
private

Maintains a map of Serial -> Transaction for all outstanding reads.

Use an ordered map here, as this makes pruneTransactions() more efficient (find first outstanding read).

Definition at line 352 of file mem_checker.hh.

◆ readObservations

TransactionList MemChecker::ByteTracker::readObservations
private

List of completed reads, i.e.

observations of reads.

Definition at line 357 of file mem_checker.hh.

Referenced by ByteTracker().

◆ writeClusters

WriteClusterList MemChecker::ByteTracker::writeClusters
private

List of write clusters for this address.

Definition at line 362 of file mem_checker.hh.


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

Generated on Wed Sep 30 2020 14:02:27 for gem5 by doxygen 1.8.17