33#include "debug/RubyTest.hh"
53 rng->random(0, ruby::RubyAccessMode_NUM - 1));
60 DPRINTF(RubyTest,
"initiating\n");
64 if (
false && (
rng->random(0, 0xf) == 0)) {
74 if (
m_status == ruby::TesterStatus_Idle) {
76 }
else if (
m_status == ruby::TesterStatus_Ready) {
81 "initiating action/check - failed: action/check is pending\n");
88 DPRINTF(RubyTest,
"initiating prefetch\n");
99 if (
rng->random(0, 0x7) != 0) {
105 (
rng->random(0, 0x1)))) {
117 req->setContext(
index);
123 uint8_t *
data =
new uint8_t[1];
133 DPRINTF(RubyTest,
"successfully initiated prefetch.\n");
140 "prefetch initiation failed because Port was busy.\n");
148 DPRINTF(RubyTest,
"initiating Flush\n");
172 DPRINTF(RubyTest,
"initiating Flush - successful\n");
179 DPRINTF(RubyTest,
"initiating Action\n");
180 assert(
m_status == ruby::TesterStatus_Idle);
195 req->setContext(
index);
206 uint8_t *writeData =
new uint8_t[1];
210 DPRINTF(RubyTest,
"Seq write: index %d data 0x%x check 0x%x\n",
index,
219 DPRINTF(RubyTest,
"initiating action - successful\n");
220 DPRINTF(RubyTest,
"status before action update: %s\n",
221 (ruby::TesterStatus_to_string(
m_status)).c_str());
222 m_status = ruby::TesterStatus_Action_Pending;
232 DPRINTF(RubyTest,
"failed to initiate action - sequencer not ready\n");
235 DPRINTF(RubyTest,
"status after action update: %s\n",
236 (ruby::TesterStatus_to_string(
m_status)).c_str());
242 DPRINTF(RubyTest,
"Initiating Check\n");
243 assert(
m_status == ruby::TesterStatus_Ready);
253 (
rng->random(0, 0x1)))) {
262 req->setContext(
index);
275 DPRINTF(RubyTest,
"initiating check - successful\n");
276 DPRINTF(RubyTest,
"status before check update: %s\n",
277 ruby::TesterStatus_to_string(
m_status).c_str());
278 m_status = ruby::TesterStatus_Check_Pending;
288 DPRINTF(RubyTest,
"failed to initiate check - cpu port not ready\n");
291 DPRINTF(RubyTest,
"status after check update: %s\n",
292 ruby::TesterStatus_to_string(
m_status).c_str());
306 assert(
data != NULL);
308 DPRINTF(RubyTest,
"RubyTester Callback\n");
311 if (
m_status == ruby::TesterStatus_Action_Pending) {
312 DPRINTF(RubyTest,
"Action callback write value: %d, currently %d\n",
318 m_status = ruby::TesterStatus_Ready;
322 DPRINTF(RubyTest,
"Check %#x, State=Idle store_count: %d\n",
325 DPRINTF(RubyTest,
"Action callback return data now %d\n",
327 }
else if (
m_status == ruby::TesterStatus_Check_Pending) {
328 DPRINTF(RubyTest,
"Check callback\n");
330 for (
int byte_number=0; byte_number<
CHECK_SIZE; byte_number++) {
331 if (uint8_t(
m_value + byte_number) !=
data->getByte(byte_number)) {
332 panic(
"Action/check failure: proc: %d address: %#x data: %s "
333 "byte_number: %d m_value+byte_number: %d byte: %d %s"
335 proc, address,
data, byte_number,
337 (
int)
data->getByte(byte_number), *
this, curTime);
340 DPRINTF(RubyTest,
"Action/check success\n");
351 panic(
"Unexpected TesterStatus: %s proc: %d data: %s m_status: %s "
355 DPRINTF(RubyTest,
"proc: %d, Address: 0x%x\n", proc,
357 DPRINTF(RubyTest,
"Callback done\n");
365 assert(
m_status == ruby::TesterStatus_Idle ||
366 m_status == ruby::TesterStatus_Ready);
376 assert(
m_status == ruby::TesterStatus_Idle);
384 assert(
m_status == ruby::TesterStatus_Idle ||
385 m_status == ruby::TesterStatus_Ready);
388 DPRINTF(RubyTest,
"Check %#x, State=Idle, picked initiating node %d\n",
398 << (int)
m_value <<
", status: "
399 <<
m_status <<
", initiating node: "
402 <<
"]" << std::flush;
409 "[%#x, value: %d, status: %s, initiating node: %d, store_count: %d]\n",
411 ruby::TesterStatus_to_string(
m_status).c_str(),
void initiateFlush(Cycles current_time)
void changeAddress(Addr address)
ruby::RubyAccessMode m_access_mode
void pickInitiatingNode()
void print(std::ostream &out) const
void initiatePrefetch(Cycles current_time)
void performCallback(ruby::NodeID proc, ruby::SubBlock *data, Cycles curTime)
void initiate(Cycles current_time)
void initiateCheck(Cycles current_time)
RubyTester * m_tester_ptr
ruby::NodeID m_initiatingNode
ruby::TesterStatus m_status
Check(Addr address, Addr pc, int _num_writers, int _num_readers, RubyTester *_tester)
void initiateAction(Cycles current_time)
Cycles is a wrapper class for representing cycle counts, i.e.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * senderState
This packet's sender state.
const T * getConstPtr() const
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
@ PF_EXCLUSIVE
The request should be prefetched into the exclusive state.
@ INST_FETCH
The request was an instruction fetch.
@ PREFETCH
The request is a prefetch.
gem5::Flags< FlagsType > Flags
void set(Type mask)
Set all flag's bits matching the given mask.
#define panic(...)
This implements a cprintf based panic() function.
Addr makeLineAddress(Addr addr, int cacheLineBits)
Copyright (c) 2024 Arm Limited All rights reserved.
std::shared_ptr< Request > RequestPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
RubyTester::SenderState SenderState
const int CACHE_LINE_BITS