gem5
|
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>
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 | |
WriteCluster * | getIncompleteWriteCluster () |
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, Transaction > | outstandingReads |
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 |
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.
|
inline |
Definition at line 207 of file mem_checker.hh.
References MemChecker::DATA_INITIAL, readObservations, MemChecker::SERIAL_INITIAL, and MemChecker::TICK_INITIAL.
void MemChecker::ByteTracker::abortWrite | ( | MemChecker::Serial | serial | ) |
Aborts a write transaction.
Wrapper to abortWrite of WriteCluster instance.
serial | Unique identifier of a write previously started. |
Definition at line 272 of file mem_checker.cc.
Referenced by MemChecker::abortWrite().
bool MemChecker::ByteTracker::completeRead | ( | MemChecker::Serial | serial, |
Tick | complete, | ||
uint8_t | data | ||
) |
Completes a read transaction that is still outstanding.
serial | Unique identifier of a read previously started. |
complete | When the read got a response. |
data | The data returned by the memory subsystem. |
Definition at line 223 of file mem_checker.cc.
References warn.
Referenced by MemChecker::completeRead().
void MemChecker::ByteTracker::completeWrite | ( | MemChecker::Serial | serial, |
Tick | complete | ||
) |
Completes a write transaction.
Wrapper to startWrite of WriteCluster instance.
serial | Unique identifier of a write previously started. |
complete | When the write was sent off to the memory subsystem. |
Definition at line 265 of file mem_checker.cc.
Referenced by MemChecker::completeWrite().
|
private |
Convenience function to return the most recent incomplete write cluster.
Instantiates new write cluster if the most recent one has been completed.
Definition at line 248 of file mem_checker.cc.
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:
start | Start time of transaction to validate. |
complete | End time of transaction to validate. |
data | The value that we have actually seen. |
Definition at line 130 of file mem_checker.cc.
References MemChecker::Transaction::complete, MemChecker::Transaction::data, DPRINTF, MemChecker::Transaction::start, and MemChecker::TICK_INITIAL.
|
inlineprivate |
Helper function to return an iterator to the entry of a container of Transaction compatible classes, before a certain tick.
before | Tick value which should be greater than the completion tick of the returned element. |
Definition at line 323 of file mem_checker.hh.
|
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.
Definition at line 299 of file mem_checker.hh.
References _lastExpectedData.
Referenced by MemChecker::completeRead().
|
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().
void MemChecker::ByteTracker::startRead | ( | MemChecker::Serial | serial, |
Tick | start | ||
) |
Starts a read transaction.
serial | Unique identifier for the read. |
start | When 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().
void MemChecker::ByteTracker::startWrite | ( | MemChecker::Serial | serial, |
Tick | start, | ||
uint8_t | data | ||
) |
Starts a write transaction.
Wrapper to startWrite of WriteCluster instance.
serial | Unique identifier of the write. |
start | When the write was sent off to the memory subsystem. |
data | The data that this write passed to the memory subsystem. |
Definition at line 258 of file mem_checker.cc.
Referenced by MemChecker::startWrite().
|
private |
See lastExpectedData().
Definition at line 370 of file mem_checker.hh.
Referenced by lastExpectedData().
|
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.
|
private |
List of completed reads, i.e.
observations of reads.
Definition at line 360 of file mem_checker.hh.
Referenced by ByteTracker().
|
private |
List of write clusters for this address.
Definition at line 365 of file mem_checker.hh.