34#include "debug/RubyTest.hh"
44 : m_num_writers(_num_writers), m_num_readers(_num_readers),
61 DPRINTF(RubyTest,
"initiating\n");
73 if (
m_status == ruby::TesterStatus_Idle) {
75 }
else if (
m_status == ruby::TesterStatus_Ready) {
80 "initiating action/check - failed: action/check is pending\n");
87 DPRINTF(RubyTest,
"initiating prefetch\n");
116 req->setContext(
index);
122 uint8_t *
data =
new uint8_t[1];
130 DPRINTF(RubyTest,
"successfully initiated prefetch.\n");
137 "prefetch initiation failed because Port was busy.\n");
145 DPRINTF(RubyTest,
"initiating Flush\n");
167 DPRINTF(RubyTest,
"initiating Flush - successful\n");
174 DPRINTF(RubyTest,
"initiating Action\n");
175 assert(
m_status == ruby::TesterStatus_Idle);
190 req->setContext(
index);
201 uint8_t *writeData =
new uint8_t[1];
205 DPRINTF(RubyTest,
"Seq write: index %d data 0x%x check 0x%x\n",
index,
213 DPRINTF(RubyTest,
"initiating action - successful\n");
214 DPRINTF(RubyTest,
"status before action update: %s\n",
215 (ruby::TesterStatus_to_string(
m_status)).c_str());
216 m_status = ruby::TesterStatus_Action_Pending;
225 DPRINTF(RubyTest,
"failed to initiate action - sequencer not ready\n");
228 DPRINTF(RubyTest,
"status after action update: %s\n",
229 (ruby::TesterStatus_to_string(
m_status)).c_str());
235 DPRINTF(RubyTest,
"Initiating Check\n");
236 assert(
m_status == ruby::TesterStatus_Ready);
255 req->setContext(
index);
267 DPRINTF(RubyTest,
"initiating check - successful\n");
268 DPRINTF(RubyTest,
"status before check update: %s\n",
269 ruby::TesterStatus_to_string(
m_status).c_str());
270 m_status = ruby::TesterStatus_Check_Pending;
279 DPRINTF(RubyTest,
"failed to initiate check - cpu port not ready\n");
282 DPRINTF(RubyTest,
"status after check update: %s\n",
283 ruby::TesterStatus_to_string(
m_status).c_str());
295 assert(
data != NULL);
297 DPRINTF(RubyTest,
"RubyTester Callback\n");
300 if (
m_status == ruby::TesterStatus_Action_Pending) {
301 DPRINTF(RubyTest,
"Action callback write value: %d, currently %d\n",
307 m_status = ruby::TesterStatus_Ready;
311 DPRINTF(RubyTest,
"Check %#x, State=Idle store_count: %d\n",
314 DPRINTF(RubyTest,
"Action callback return data now %d\n",
316 }
else if (
m_status == ruby::TesterStatus_Check_Pending) {
317 DPRINTF(RubyTest,
"Check callback\n");
319 for (
int byte_number=0; byte_number<
CHECK_SIZE; byte_number++) {
320 if (uint8_t(
m_value + byte_number) !=
data->getByte(byte_number)) {
321 panic(
"Action/check failure: proc: %d address: %#x data: %s "
322 "byte_number: %d m_value+byte_number: %d byte: %d %s"
324 proc, address,
data, byte_number,
326 (
int)
data->getByte(byte_number), *
this, curTime);
329 DPRINTF(RubyTest,
"Action/check success\n");
340 panic(
"Unexpected TesterStatus: %s proc: %d data: %s m_status: %s "
344 DPRINTF(RubyTest,
"proc: %d, Address: 0x%x\n", proc,
346 DPRINTF(RubyTest,
"Callback done\n");
353 assert(
m_status == ruby::TesterStatus_Idle ||
354 m_status == ruby::TesterStatus_Ready);
364 assert(
m_status == ruby::TesterStatus_Idle);
372 assert(
m_status == ruby::TesterStatus_Idle ||
373 m_status == ruby::TesterStatus_Ready);
376 DPRINTF(RubyTest,
"Check %#x, State=Idle, picked initiating node %d\n",
386 << (int)
m_value <<
", status: "
387 <<
m_status <<
", initiating node: "
390 <<
"]" << std::flush;
397 "[%#x, value: %d, status: %s, initiating node: %d, store_count: %d]\n",
399 ruby::TesterStatus_to_string(
m_status).c_str(),
void changeAddress(Addr address)
ruby::RubyAccessMode m_access_mode
void pickInitiatingNode()
void print(std::ostream &out) const
void performCallback(ruby::NodeID proc, ruby::SubBlock *data, Cycles curTime)
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)
Cycles is a wrapper class for representing cycle counts, i.e.
Command
List of all commands associated with a packet.
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.
bool isInstOnlyCpuPort(int idx)
void incrementCheckCompletions()
RequestPort * getWritableCpuPort(int idx)
RequestorID requestorId()
bool isInstDataCpuPort(int idx)
RequestPort * getReadableCpuPort(int idx)
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
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)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria 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