69 writes.insert(std::make_pair(serial,
77 auto it = writes.find(serial);
79 if (it == writes.end()) {
80 warn(
"Could not locate write transaction: serial = %d, "
81 "complete = %d\n", serial, _complete);
87 it->second.complete = _complete;
90 if (completeMax < _complete) {
91 completeMax = _complete;
94 if (--numIncomplete == 0) {
101 complete = completeMax;
108 if (!writes.erase(serial)) {
109 warn(
"Could not locate write transaction: serial = %d\n", serial);
113 if (--numIncomplete == 0 && !writes.empty()) {
116 complete = completeMax;
127 outstandingReads.insert(std::make_pair(serial,
135 _lastExpectedData.clear();
137 bool wc_overlap =
true;
141 *lastCompletedTransaction(&readObservations, start);
146 for (
auto cluster = writeClusters.rbegin();
147 cluster != writeClusters.rend() && wc_overlap; ++cluster) {
148 for (
const auto& addr_write : cluster->writes) {
164 _lastExpectedData.push_back(write.
data);
184 last_obs_valid =
false;
191 if (last_obs_valid) {
200 _lastExpectedData.push_back(last_obs.
data);
206 if (!writeClusters.empty() && wc_overlap) {
208 assert(writeClusters.begin()->start < complete &&
209 writeClusters.rbegin()->complete > start);
214 if (_lastExpectedData.empty()) {
219 "complete = %d, data = %#x\n", start, complete,
data);
229 auto it = outstandingReads.find(serial);
231 if (it == outstandingReads.end()) {
233 warn(
"Could not locate read transaction: serial = %d, complete = %d\n",
238 Tick start = it->second.start;
239 outstandingReads.erase(it);
242 const bool result = inExpectedData(start, complete,
data);
244 readObservations.emplace_back(serial, start, complete,
data);
253 if (writeClusters.empty() || writeClusters.back().isComplete()) {
254 writeClusters.emplace_back();
257 return &writeClusters.back();
271 getIncompleteWriteCluster()->completeWrite(serial, complete);
278 getIncompleteWriteCluster()->abortWrite(serial);
287 const Tick before = outstandingReads.empty() ?
curTick() :
288 outstandingReads.begin()->second.start;
291 readObservations.erase(readObservations.begin(),
292 lastCompletedTransaction(&readObservations, before));
295 if (!writeClusters.empty()) {
296 writeClusters.erase(writeClusters.begin(),
297 lastCompletedTransaction(&writeClusters, before));
308 "completing read: serial = %d, complete = %d, "
309 "addr = %#llx, size = %d\n", serial, complete,
addr, size);
311 for (
size_t i = 0;
i < size; ++
i) {
325 "failed: received %#x, expected ",
349 for (
size_t i = 0;
i < size; ++
i) {
The ByteTracker keeps track of transactions for the same byte – all outstanding reads,...
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.
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.
void pruneTransactions()
Prunes no longer needed transactions.
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.
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...
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.
bool completeRead(Serial serial, Tick complete, Addr addr, size_t size, uint8_t *data)
Completes a previously started read transaction.
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.
ByteTracker * getByteTracker(Addr addr)
Returns the instance of ByteTracker for the requested location.
void reset()
Resets the entire checker.
uint64_t Serial
The Serial type is used to be able to uniquely identify a transaction as it passes through the system...
std::string errorMessage
Detailed error message of the last violation in completeRead.
static const Tick TICK_INITIAL
The initial tick the system starts with.
#define gem5_assert(cond,...)
The assert macro will function like a normal assert, but will use panic instead of straight abort().
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
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)