gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::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 gem5::MemChecker::ByteTracker:
gem5::Named

Public Member Functions

 ByteTracker (Addr addr=0, const MemChecker *parent=NULL)
 
void startRead (Serial serial, Tick start)
 Starts a read transaction.
 
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.
 
bool completeRead (Serial serial, Tick complete, uint8_t data)
 Completes a read transaction that is still outstanding.
 
void startWrite (Serial serial, Tick start, uint8_t data)
 Starts a write transaction.
 
void completeWrite (Serial serial, Tick complete)
 Completes a write transaction.
 
void abortWrite (Serial serial)
 Aborts a write transaction.
 
const std::vector< uint8_t > & lastExpectedData () const
 This function returns the expected data that inExpectedData iterated through in the last call.
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 

Private Member Functions

WriteClustergetIncompleteWriteCluster ()
 Convenience function to return the most recent incomplete write cluster.
 
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.
 
void pruneTransactions ()
 Prunes no longer needed transactions.
 

Private Attributes

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

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

Constructor & Destructor Documentation

◆ ByteTracker()

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

Member Function Documentation

◆ abortWrite()

void gem5::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 276 of file mem_checker.cc.

Referenced by gem5::MemChecker::abortWrite().

◆ completeRead()

bool gem5::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 226 of file mem_checker.cc.

References data, and warn.

Referenced by gem5::MemChecker::completeRead().

◆ completeWrite()

void gem5::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 268 of file mem_checker.cc.

Referenced by gem5::MemChecker::completeWrite().

◆ getIncompleteWriteCluster()

MemChecker::WriteCluster * gem5::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 251 of file mem_checker.cc.

◆ inExpectedData()

bool gem5::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 132 of file mem_checker.cc.

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

◆ lastCompletedTransaction()

template<class TList >
TList::iterator gem5::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 325 of file mem_checker.hh.

References gem5::MipsISA::l.

◆ lastExpectedData()

const std::vector< uint8_t > & gem5::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 301 of file mem_checker.hh.

References _lastExpectedData.

Referenced by gem5::MemChecker::completeRead().

◆ pruneTransactions()

void gem5::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 282 of file mem_checker.cc.

References gem5::curTick().

◆ startRead()

void gem5::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 125 of file mem_checker.cc.

References gem5::MemChecker::TICK_FUTURE.

Referenced by gem5::MemChecker::startRead().

◆ startWrite()

void gem5::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 261 of file mem_checker.cc.

References data, and gem5::MemChecker::WriteCluster::startWrite().

Referenced by gem5::MemChecker::startWrite().

Member Data Documentation

◆ _lastExpectedData

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

See lastExpectedData().

Definition at line 372 of file mem_checker.hh.

Referenced by lastExpectedData().

◆ outstandingReads

std::map<Serial, Transaction> gem5::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 357 of file mem_checker.hh.

◆ readObservations

TransactionList gem5::MemChecker::ByteTracker::readObservations
private

List of completed reads, i.e.

observations of reads.

Definition at line 362 of file mem_checker.hh.

Referenced by ByteTracker().

◆ writeClusters

WriteClusterList gem5::MemChecker::ByteTracker::writeClusters
private

List of write clusters for this address.

Definition at line 367 of file mem_checker.hh.


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

Generated on Tue Jun 18 2024 16:24:12 for gem5 by doxygen 1.11.0