Go to the documentation of this file.
65 writes.insert(std::make_pair(serial,
72 auto it = writes.find(serial);
74 if (it == writes.end()) {
75 warn(
"Could not locate write transaction: serial = %d, complete = %d\n",
82 it->second.complete = _complete;
85 if (completeMax < _complete) {
86 completeMax = _complete;
89 if (--numIncomplete == 0) {
96 complete = completeMax;
103 if (!writes.erase(serial)) {
104 warn(
"Could not locate write transaction: serial = %d\n", serial);
108 if (--numIncomplete == 0 && !writes.empty()) {
111 complete = completeMax;
122 outstandingReads.insert(std::make_pair(serial,
129 _lastExpectedData.clear();
131 bool wc_overlap =
true;
135 *lastCompletedTransaction(&readObservations, start);
140 for (
auto cluster = writeClusters.rbegin();
141 cluster != writeClusters.rend() && wc_overlap; ++cluster) {
142 for (
const auto& addr_write : cluster->writes) {
158 _lastExpectedData.push_back(write.
data);
178 last_obs_valid =
false;
185 if (last_obs_valid) {
194 _lastExpectedData.push_back(last_obs.
data);
200 if (!writeClusters.empty() && wc_overlap) {
202 assert(writeClusters.begin()->start < complete &&
203 writeClusters.rbegin()->complete > start);
208 if (_lastExpectedData.empty()) {
213 "complete = %d, data = %#x\n", start, complete,
data);
223 auto it = outstandingReads.find(serial);
225 if (it == outstandingReads.end()) {
227 warn(
"Could not locate read transaction: serial = %d, complete = %d\n",
232 Tick start = it->second.start;
233 outstandingReads.erase(it);
236 const bool result = inExpectedData(start, complete,
data);
238 readObservations.emplace_back(serial, start, complete,
data);
247 if (writeClusters.empty() || writeClusters.back().isComplete()) {
248 writeClusters.emplace_back();
251 return &writeClusters.back();
258 getIncompleteWriteCluster()->startWrite(serial, start,
data);
264 getIncompleteWriteCluster()->completeWrite(serial, complete);
271 getIncompleteWriteCluster()->abortWrite(serial);
280 const Tick before = outstandingReads.empty() ?
curTick() :
281 outstandingReads.begin()->second.start;
284 readObservations.erase(readObservations.begin(),
285 lastCompletedTransaction(&readObservations, before));
288 if (!writeClusters.empty()) {
289 writeClusters.erase(writeClusters.begin(),
290 lastCompletedTransaction(&writeClusters, before));
301 "completing read: serial = %d, complete = %d, "
302 "addr = %#llx, size = %d\n", serial, complete,
addr, size);
304 for (
size_t i = 0;
i < size; ++
i) {
318 "failed: received %#x, expected ",
342 for (
size_t i = 0;
i < size; ++
i) {
348 MemCheckerParams::create()
void startRead(Serial serial, Tick start)
Starts a read transaction.
const std::vector< uint8_t > & lastExpectedData() const
This function returns the expected data that inExpectedData iterated through in the last call.
void abortWrite(Serial serial)
Aborts a write transaction.
void abortWrite(Serial serial)
Aborts a write transaction.
uint8_t data
Depending on the memory operation, the data value either represents: for writes, the value written up...
void completeWrite(Serial serial, Tick complete)
Completes a write transaction.
The WriteCluster class captures sets of writes where all writes are overlapping with at least one oth...
uint64_t Tick
Tick count type.
ByteTracker * getByteTracker(Addr addr)
Returns the instance of ByteTracker for the requested location.
void startWrite(Serial serial, Tick start, uint8_t data)
Starts a write transaction.
void startWrite(Serial serial, Tick _start, uint8_t data)
Starts a write transaction.
void completeWrite(Serial serial, Tick _complete)
Completes a write transaction.
MemChecker(const MemCheckerParams *p)
The ByteTracker keeps track of transactions for the same byte – all outstanding reads,...
std::unordered_map< Serial, Transaction > writes
Map of Serial --> Transaction of all writes in cluster; contains all, in-flight or already completed.
void reset()
Resets the entire checker.
Tick start
Start of earliest write in cluster.
std::string errorMessage
Detailed error message of the last violation in completeRead.
#define chatty_assert(cond,...)
The chatty assert macro will function like a normal assert, but will allow the specification of addit...
bool completeRead(Serial serial, Tick complete, uint8_t data)
Completes a read transaction that is still outstanding.
static const Tick TICK_INITIAL
The initial tick the system starts with.
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...
Tick complete
Completion tick.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
The Transaction class captures the lifetimes of read and write operations, and the values they consum...
static const Tick TICK_FUTURE
The maximum value that curTick() could ever return.
void pruneTransactions()
Prunes no longer needed transactions.
std::unordered_map< Addr, ByteTracker > byte_trackers
Maintain a map of address --> byte-tracker.
WriteCluster * getIncompleteWriteCluster()
Convenience function to return the most recent incomplete write cluster.
Tick complete
Completion of last write in cluster.
bool completeRead(Serial serial, Tick complete, Addr addr, size_t size, uint8_t *data)
Completes a previously started read transaction.
std::string csprintf(const char *format, const Args &...args)
uint64_t Serial
The Serial type is used to be able to uniquely identify a transaction as it passes through the system...
Tick curTick()
The current simulated tick.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17