38 #ifndef __MEM_MEM_CHECKER_HH__ 39 #define __MEM_MEM_CHECKER_HH__ 44 #include <unordered_map> 50 #include "debug/MemChecker.hh" 51 #include "params/MemChecker.hh" 108 uint8_t _data = DATA_INITIAL)
130 {
return serial < rhs.
serial; }
143 completeMax(TICK_INITIAL), numIncomplete(0)
185 std::unordered_map<Serial, Transaction>
writes;
205 :
Named((parent != NULL ? parent->
name() :
"") +
211 readObservations.emplace_back(
212 Transaction(SERIAL_INITIAL, TICK_INITIAL, TICK_INITIAL,
297 {
return _lastExpectedData; }
319 template <
class TList>
328 for (--it; it != l->begin() && it->complete >= before; --it);
342 void pruneTransactions();
416 Addr addr,
size_t size, uint8_t *data);
482 std::make_pair(addr,
ByteTracker(addr,
this))).first;
517 "starting read: serial = %d, start = %d, addr = %#llx, " 518 "size = %d\n",
nextSerial, start, addr , size);
520 for (
size_t i = 0;
i < size; ++
i) {
531 "starting write: serial = %d, start = %d, addr = %#llx, " 532 "size = %d\n",
nextSerial, start, addr, size);
534 for (
size_t i = 0;
i < size; ++
i) {
546 "completing write: serial = %d, complete = %d, " 547 "addr = %#llx, size = %d\n", serial, complete, addr, size);
549 for (
size_t i = 0;
i < size; ++
i) {
558 "aborting write: serial = %d, addr = %#llx, size = %d\n",
561 for (
size_t i = 0;
i < size; ++
i) {
566 #endif // __MEM_MEM_CHECKER_HH__
std::list< WriteCluster > WriteClusterList
static const Serial SERIAL_INITIAL
Initial serial.
void completeWrite(Serial serial, Tick complete, Addr addr, size_t size)
Completes a previously started write transaction.
ByteTracker(Addr addr=0, const MemChecker *parent=NULL)
static const uint8_t DATA_INITIAL
Initial data value.
Tick complete
Completion tick.
void abortWrite(Serial serial, Addr addr, size_t size)
Aborts a previously started write transaction.
bool completeRead(Serial serial, Tick complete, Addr addr, size_t size, uint8_t *data)
Completes a previously started read transaction.
TransactionList readObservations
List of completed reads, i.e.
ByteTracker * getByteTracker(Addr addr)
Returns the instance of ByteTracker for the requested location.
WriteClusterList writeClusters
List of write clusters for this address.
std::vector< uint8_t > _lastExpectedData
See lastExpectedData().
The Transaction class captures the lifetimes of read and write operations, and the values they consum...
std::unordered_map< Serial, Transaction > writes
Map of Serial –> Transaction of all writes in cluster; contains all, in-flight or already completed...
Serial nextSerial
Next distinct serial to be assigned to the next transaction to be started.
bool operator<(const Transaction &rhs) const
Orders Transactions for use with std::map.
const std::vector< uint8_t > & lastExpectedData() const
This function returns the expected data that inExpectedData iterated through in the last call...
uint64_t Serial
The Serial type is used to be able to uniquely identify a transaction as it passes through the system...
MemChecker(const MemCheckerParams *p)
const std::string & getErrorMessage() const
In completeRead, if an error is encountered, this does not print nor cause an error, but instead should be handled by the caller.
std::string csprintf(const char *format, const Args &...args)
std::unordered_map< Addr, ByteTracker > byte_trackers
Maintain a map of address –> byte-tracker.
uint64_t Tick
Tick count type.
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).
void reset()
Resets the entire checker.
std::string errorMessage
Detailed error message of the last violation in completeRead.
void completeWrite(Serial serial, Tick complete)
Completes a write transaction.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
TList::iterator lastCompletedTransaction(TList *l, Tick before)
Helper function to return an iterator to the entry of a container of Transaction compatible classes...
void startWrite(Serial serial, Tick start, uint8_t data)
Starts a write transaction.
static const Tick TICK_INITIAL
The initial tick the system starts with.
virtual const std::string name() const
The WriteCluster class captures sets of writes where all writes are overlapping with at least one oth...
Tick start
Start of earliest write in cluster.
std::list< Transaction > TransactionList
void abortWrite(Serial serial)
Aborts a write transaction.
Serial startWrite(Tick start, Addr addr, size_t size, const uint8_t *data)
Starts a write transaction.
uint8_t data
Depending on the memory operation, the data value either represents: for writes, the value written up...
Transaction(Serial _serial, Tick _start, Tick _complete, uint8_t _data=DATA_INITIAL)
std::map< Serial, Transaction > outstandingReads
Maintains a map of Serial -> Transaction for all outstanding reads.
Serial serial
Unique identifying serial.
static const Tick TICK_FUTURE
The maximum value that curTick() could ever return.
Tick complete
Completion of last write in cluster.
Serial startRead(Tick start, Addr addr, size_t size)
Starts a read transaction.
Abstract superclass for simulation objects.
void startRead(Serial serial, Tick start)
Starts a read transaction.