38#ifndef __MEM_MEM_CHECKER_HH__
39#define __MEM_MEM_CHECKER_HH__
46#include <unordered_map>
53#include "debug/MemChecker.hh"
54#include "params/MemChecker.hh"
190 std::unordered_map<Serial, Transaction>
writes;
210 :
Named((parent != NULL ? parent->
name() :
"") +
324 template <
class TList>
333 for (--it; it !=
l->begin() && it->complete >= before; --it);
522 "starting read: serial = %d, start = %d, addr = %#llx, "
525 for (
size_t i = 0;
i < size; ++
i) {
536 "starting write: serial = %d, start = %d, addr = %#llx, "
539 for (
size_t i = 0;
i < size; ++
i) {
551 "completing write: serial = %d, complete = %d, "
552 "addr = %#llx, size = %d\n", serial, complete,
addr, size);
554 for (
size_t i = 0;
i < size; ++
i) {
563 "aborting write: serial = %d, addr = %#llx, size = %d\n",
566 for (
size_t i = 0;
i < size; ++
i) {
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
The ByteTracker keeps track of transactions for the same byte – all outstanding reads,...
std::vector< uint8_t > _lastExpectedData
See lastExpectedData().
void abortWrite(Serial serial)
Aborts a write transaction.
void completeWrite(Serial serial, Tick complete)
Completes a write transaction.
bool completeRead(Serial serial, Tick complete, uint8_t data)
Completes a read transaction that is still outstanding.
WriteCluster * getIncompleteWriteCluster()
Convenience function to return the most recent incomplete write cluster.
ByteTracker(Addr addr=0, const MemChecker *parent=NULL)
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 su...
void startWrite(Serial serial, Tick start, uint8_t data)
Starts a write transaction.
std::map< Serial, Transaction > outstandingReads
Maintains a map of Serial -> Transaction for all outstanding reads.
void pruneTransactions()
Prunes no longer needed transactions.
void startRead(Serial serial, Tick start)
Starts a read transaction.
TransactionList readObservations
List of completed reads, i.e.
WriteClusterList writeClusters
List of write clusters for this address.
TList::iterator lastCompletedTransaction(TList *l, Tick before)
Helper function to return an iterator to the entry of a container of Transaction compatible classes,...
const std::vector< uint8_t > & lastExpectedData() const
This function returns the expected data that inExpectedData iterated through in the last call.
The Transaction class captures the lifetimes of read and write operations, and the values they consum...
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)
Serial serial
Unique identifying serial.
bool operator<(const Transaction &rhs) const
Orders Transactions for use with std::map.
Tick complete
Completion tick.
The WriteCluster class captures sets of writes where all writes are overlapping with at least one oth...
void completeWrite(Serial serial, Tick _complete)
Completes a write transaction.
std::unordered_map< Serial, Transaction > writes
Map of Serial --> Transaction of all writes in cluster; contains all, in-flight or already completed.
void abortWrite(Serial serial)
Aborts a write transaction.
void startWrite(Serial serial, Tick _start, uint8_t data)
Starts a write transaction.
Tick start
Start of earliest write in cluster.
Tick complete
Completion of last write in cluster.
Serial nextSerial
Next distinct serial to be assigned to the next transaction to be started.
MemChecker(const MemCheckerParams &p)
void abortWrite(Serial serial, Addr addr, size_t size)
Aborts a previously started write transaction.
const std::string & getErrorMessage() const
In completeRead, if an error is encountered, this does not print nor cause an error,...
bool completeRead(Serial serial, Tick complete, Addr addr, size_t size, uint8_t *data)
Completes a previously started read transaction.
static const uint8_t DATA_INITIAL
Initial data value.
std::unordered_map< Addr, ByteTracker > byte_trackers
Maintain a map of address --> byte-tracker.
static const Tick TICK_FUTURE
The maximum value that curTick() could ever return.
static const Serial SERIAL_INITIAL
Initial serial.
ByteTracker * getByteTracker(Addr addr)
Returns the instance of ByteTracker for the requested location.
std::list< Transaction > TransactionList
void reset()
Resets the entire checker.
Serial startWrite(Tick start, Addr addr, size_t size, const uint8_t *data)
Starts a write transaction.
uint64_t Serial
The Serial type is used to be able to uniquely identify a transaction as it passes through the system...
Serial startRead(Tick start, Addr addr, size_t size)
Starts a read transaction.
std::string errorMessage
Detailed error message of the last violation in completeRead.
void completeWrite(Serial serial, Tick complete, Addr addr, size_t size)
Completes a previously started write transaction.
static const Tick TICK_INITIAL
The initial tick the system starts with.
std::list< WriteCluster > WriteClusterList
Interface for things with names.
virtual std::string name() const
Abstract superclass for simulation objects.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
std::string csprintf(const char *format, const Args &...args)