Go to the documentation of this file.
40 #include "debug/GarnetSyntheticTraffic.hh"
76 cachePort(
"GarnetSyntheticTraffic",
this),
79 blockSizeBits(
p.block_offset),
80 numDestinations(
p.num_dest),
81 simCycles(
p.sim_cycles),
82 numPacketsMax(
p.num_packets_max),
84 singleSender(
p.single_sender),
85 singleDest(
p.single_dest),
86 trafficType(
p.traffic_type),
89 precision(
p.precision),
90 responseLimit(
p.response_limit),
91 requestorId(
p.system->getRequestorId(
this))
95 schedule(tickEvent, 0);
98 if (trafficStringToEnum.count(trafficType) == 0) {
99 fatal(
"Unknown Traffic Type: %s!\n", traffic);
101 traffic = trafficStringToEnum[trafficType];
111 if (if_name ==
"test")
128 "Completed injection of %s packet for address %x\n",
129 pkt->
isWrite() ?
"write" :
"read\n",
130 pkt->
req->getPaddr());
149 bool sendAllowedThisCycle;
150 double injRange = pow((
double) 10, (
double)
precision);
152 if (trySending <
injRate*injRange)
153 sendAllowedThisCycle =
true;
155 sendAllowedThisCycle =
false;
158 if (sendAllowedThisCycle) {
159 bool senderEnable =
true;
162 senderEnable =
false;
165 senderEnable =
false;
184 int radix = (int) sqrt(num_destinations);
189 int src_x =
id%radix;
190 int src_y =
id/radix;
198 dest_x = radix - src_x - 1;
199 dest_y = radix - src_y - 1;
202 unsigned int straight = source;
203 unsigned int reverse = source & 1;
205 int num_bits = (int) log2(num_destinations);
207 for (
int i = 1;
i < num_bits;
i++)
220 dest_x = (src_x + 1) % radix;
224 if (source < num_destinations/2)
233 dest_x = (src_x + (int) ceil(radix/2) - 1) % radix;
246 unsigned access_size = 1;
282 if (injReqType < 0 || injReqType > 2)
288 if (injReqType == 0) {
291 req = std::make_shared<Request>(paddr, access_size, flags,
293 }
else if (injReqType == 1) {
297 req = std::make_shared<Request>(
299 req->setPaddr(paddr);
303 req = std::make_shared<Request>(paddr, access_size, flags,
313 "Generated packet with destination %d, embedded in address %x\n",
#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.
GarnetSyntheticTraffic * tester
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.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
std::enable_if_t< std::is_integral< T >::value, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
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 (...
void set(Type mask)
Set all flag's bits matching the given mask.
const sc_lv_base reverse(const sc_proxy< X > &x)
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()
@ INST_FETCH
The request was an instruction fetch.
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...
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.
GarnetSyntheticTraffic(const Params &p)
Tick curTick()
The universal simulation clock.
void completeRequest(PacketPtr pkt)
SenderState * senderState
This packet's sender state.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Generated on Tue Jun 22 2021 15:28:27 for gem5 by doxygen 1.8.17