gem5
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 203 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 272 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 223 of file mem_checker.cc.

References MemChecker::WriteCluster::start, 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 265 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 248 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 130 of file mem_checker.cc.

References MemChecker::Transaction::complete, MemChecker::Transaction::data, DPRINTF, MemChecker::Transaction::start, MemChecker::WriteCluster::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 323 of file mem_checker.hh.

◆ 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 299 of file mem_checker.hh.

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 278 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 123 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 258 of file mem_checker.cc.

Referenced by MemChecker::startWrite().

Member Data Documentation

◆ _lastExpectedData

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

See lastExpectedData().

Definition at line 370 of file mem_checker.hh.

◆ 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 355 of file mem_checker.hh.

◆ readObservations

TransactionList MemChecker::ByteTracker::readObservations
private

List of completed reads, i.e.

observations of reads.

Definition at line 360 of file mem_checker.hh.

◆ writeClusters

WriteClusterList MemChecker::ByteTracker::writeClusters
private

List of write clusters for this address.

Definition at line 365 of file mem_checker.hh.


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

Generated on Fri Apr 20 2018 09:05:08 for gem5 by doxygen 1.8.13