Go to the documentation of this file.
40 #include "debug/GarnetSyntheticTraffic.hh"
55 tester->completeRequest(pkt);
68 if (!cachePort.sendTimingReq(pkt)) {
76 tickEvent([this]{
tick(); },
"GarnetSyntheticTraffic tick",
78 cachePort(
"GarnetSyntheticTraffic",
this),
81 blockSizeBits(
p->block_offset),
82 numDestinations(
p->num_dest),
83 simCycles(
p->sim_cycles),
84 numPacketsMax(
p->num_packets_max),
86 singleSender(
p->single_sender),
87 singleDest(
p->single_dest),
88 trafficType(
p->traffic_type),
91 precision(
p->precision),
92 responseLimit(
p->response_limit),
93 requestorId(
p->system->getRequestorId(
this))
97 schedule(tickEvent, 0);
100 if (trafficStringToEnum.count(trafficType) == 0) {
101 fatal(
"Unknown Traffic Type: %s!\n", traffic);
103 traffic = trafficStringToEnum[trafficType];
113 if (if_name ==
"test")
130 "Completed injection of %s packet for address %x\n",
131 pkt->
isWrite() ?
"write" :
"read\n",
132 pkt->
req->getPaddr());
151 bool sendAllowedThisCycle;
152 double injRange = pow((
double) 10, (
double)
precision);
154 if (trySending <
injRate*injRange)
155 sendAllowedThisCycle =
true;
157 sendAllowedThisCycle =
false;
160 if (sendAllowedThisCycle) {
161 bool senderEnable =
true;
164 senderEnable =
false;
167 senderEnable =
false;
186 int radix = (int) sqrt(num_destinations);
191 int src_x =
id%radix;
192 int src_y =
id/radix;
200 dest_x = radix - src_x - 1;
201 dest_y = radix - src_y - 1;
204 unsigned int straight = source;
205 unsigned int reverse = source & 1;
207 int num_bits = (int) log2(num_destinations);
209 for (
int i = 1;
i < num_bits;
i++)
222 dest_x = (src_x + 1) % radix;
226 if (source < num_destinations/2)
235 dest_x = (src_x + (int) ceil(radix/2) - 1) % radix;
248 unsigned access_size = 1;
284 if (injReqType < 0 || injReqType > 2)
290 if (injReqType == 0) {
293 req = std::make_shared<Request>(paddr, access_size, flags,
295 }
else if (injReqType == 1) {
299 req = std::make_shared<Request>(
301 req->setPaddr(paddr);
305 req = std::make_shared<Request>(paddr, access_size, flags,
315 "Generated packet with destination %d, embedded in address %x\n",
354 GarnetSyntheticTrafficParams::create()
#define fatal(...)
This implements a cprintf based fatal() function.
bool scheduled() const
Determine if the current event is scheduled.
GarnetSyntheticTrafficParams Params
std::map< std::string, TrafficType > trafficStringToEnum
void printAddr(Addr a)
Print state of address in memory system via PrintReq (for debugging).
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
std::shared_ptr< Request > RequestPtr
RequestPtr req
A pointer to the original request.
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
@ INST_FETCH
The request was an instruction fetch.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Command
List of all commands associated with a packet.
void schedule(Event &event, Tick when)
const Cycles responseLimit
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Ports are used to interface objects to each other.
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
const sc_lv_base reverse(const sc_proxy< X > &x)
GarnetSyntheticTraffic(const Params *p)
ProbePointArg< PacketInfo > Packet
Packet probe point.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
EventFunctionWrapper tickEvent
const std::string & name()
virtual const std::string name() const
virtual void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Overload hash function for BasicBlockRange type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void sendPkt(PacketPtr pkt)
void printAddr(Addr a)
Inject a PrintReq for the given address to print the state of that address throughout the memory syst...
Cycles is a wrapper class for representing cycle counts, i.e.
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
void completeRequest(PacketPtr pkt)
SenderState * senderState
This packet's sender state.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Tick curTick()
The current simulated tick.
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17