41#include "debug/TLM.hh"
52 inform(
"%s\n", res_print +
" Success ");
55 inform(
"%s\n", res_print +
" Fail ");
66 panic(
"Failing assertion\n");
102 return !actions.empty();
114 actions.push_back(std::move(action));
121 auto it = actions.begin();
122 while (it != actions.end()) {
123 const bool is_passing = (*it)->run(
this);
127 bool wait = (*it)->wait();
129 it = actions.erase(it);
140 transaction->inject();
146 controller->
bw = [
this] (ARM::CHI::Payload *payload, ARM::CHI::Phase *phase)
148 this->
recv(payload, phase);
169 auto payload = transaction->
payload();
170 ARM::CHI::Phase &phase = transaction->
phase();
185 auto txn_id = phase->txn_id;
189 it->second->phase() = *phase;
192 it->second->runCallbacks();
194 warn(
"Transaction untested\n");
204 if (transaction->failed()) {
205 inform(
" Suite Fail: failed transaction ");
208 if (transaction->hasCallbacks()) {
209 inform(
" Suite Fail: non-empty action queue ");
213 inform(
" Suite Success ");
Abstract superclass for simulation objects.
void sendMsg(ARM::CHI::Payload &payload, ARM::CHI::Phase &phase)
std::function< void(ARM::CHI::Payload *payload, ARM::CHI::Phase *phase)> bw
Set this to send data upstream.
bool run(Transaction *tran) override
bool run(Transaction *tran) override
Transaction object It stores ARM::CHI::Payload and ARM::CHI::Phase objects, and a list of action call...
bool failed() const
Returns true if the transaction has failed, false otherwise.
void addCallback(ActionPtr &&action)
Appends a callback to the list of actions.
std::unique_ptr< Action > ActionPtr
void runCallbacks()
Enters the dispatching loop and runs the callbacks in insertion order until a waiting callback is enc...
ARM::CHI::Payload * _payload
ARM::CHI::Phase & phase()
ARM::CHI::Payload * payload() const
Transaction(const Transaction &rhs)=delete
void setGenerator(TlmGenerator *gen)
Registers the TlmGenerator in the transaction.
bool hasCallbacks() const
Returns true if the transaction has some registered callbacks, false otherwise.
TlmGenerator: this class is basically a CHI-tlm traffic generator.
std::unordered_map< uint16_t, Transaction * > pendingTransactions
Map of pending (injected) transactions indexed by the txn_id.
void scheduleTransaction(Tick when, Transaction *tr)
TlmGenerator(const Params &p)
SchedulingQueue scheduledTransactions
PQ of transactions whose injection needs to be scheduled.
void inject(Transaction *transaction)
void recv(ARM::CHI::Payload *payload, ARM::CHI::Phase *phase)
CacheController * controller
Pointer to the CHI-tlm controller.
uint8_t cpuId
cpuId to mimic the behaviour of a CPU
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
std::string transactionToString(const Payload &payload, const Phase &phase)
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Tick
Tick count type.
std::string csprintf(const char *format, const Args &...args)
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.