42 #include "debug/GarnetSyntheticTraffic.hh" 57 tester->completeRequest(pkt);
70 if (!cachePort.sendTimingReq(pkt)) {
78 tickEvent([this]{
tick(); },
"GarnetSyntheticTraffic tick",
80 cachePort(
"GarnetSyntheticTraffic",
this),
115 if (if_name ==
"test")
132 "Completed injection of %s packet for address %x\n",
133 pkt->
isWrite() ?
"write" :
"read\n",
134 pkt->
req->getPaddr());
153 bool sendAllowedThisCycle;
154 double injRange = pow((
double) 10, (
double)
precision);
156 if (trySending <
injRate*injRange)
157 sendAllowedThisCycle =
true;
159 sendAllowedThisCycle =
false;
162 if (sendAllowedThisCycle) {
163 bool senderEnable =
true;
166 senderEnable =
false;
169 senderEnable =
false;
188 int radix = (int) sqrt(num_destinations);
193 int src_x =
id%radix;
194 int src_y =
id/radix;
202 dest_x = radix - src_x - 1;
203 dest_y = radix - src_y - 1;
204 destination = dest_y*radix + dest_x;
206 unsigned int straight = source;
207 unsigned int reverse = source & 1;
209 int num_bits = (int) log2(num_destinations);
211 for (
int i = 1;
i < num_bits;
i++)
215 reverse |= (straight & 1);
220 destination = source/2;
222 destination = ((source/2) + (num_destinations/2));
224 dest_x = (src_x + 1) % radix;
226 destination = dest_y*radix + dest_x;
228 if (source < num_destinations/2)
229 destination = source*2;
231 destination = (source*2 - num_destinations + 1);
235 destination = dest_y*radix + dest_x;
237 dest_x = (src_x + (int) ceil(radix/2) - 1) % radix;
239 destination = dest_y*radix + dest_x;
250 unsigned access_size = 1;
286 if (injReqType < 0 || injReqType > 2)
292 if (injReqType == 0) {
295 req = std::make_shared<Request>(paddr, access_size, flags,
masterId);
296 }
else if (injReqType == 1) {
300 req = std::make_shared<Request>(
301 0, 0x0, access_size, flags,
masterId, 0x0, 0);
302 req->setPaddr(paddr);
306 req = std::make_shared<Request>(paddr, access_size, flags,
masterId);
315 "Generated packet with destination %d, embedded in address %x\n",
316 destination, req->getPaddr());
319 pkt->dataDynamic(
new uint8_t[req->getSize()]);
320 pkt->senderState = NULL;
354 GarnetSyntheticTrafficParams::create()
Ports are used to interface objects to each other.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Cycles is a wrapper class for representing cycle counts, i.e.
#define fatal(...)
This implements a cprintf based fatal() function.
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
std::shared_ptr< Request > RequestPtr
void completeRequest(PacketPtr pkt)
GarnetSyntheticTraffic(const Params *p)
Overload hash function for BasicBlockRange type.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the slave port by calling its corresponding receive function...
Declaration of Statistics objects.
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...
const sc_lv_base reverse(const sc_proxy< X > &x)
RequestPtr req
A pointer to the original request.
Tick curTick()
The current simulated tick.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
bool scheduled() const
Determine if the current event is scheduled.
void sendPkt(PacketPtr pkt)
void printAddr(Addr a)
Print state of address in memory system via PrintReq (for debugging).
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
GarnetSyntheticTrafficParams Params
std::map< std::string, TrafficType > trafficStringToEnum
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void printAddr(Addr a)
Inject a PrintReq for the given address to print the state of that address throughout the memory syst...
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
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...
The request was an instruction fetch.
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 (...
Declaration of the Packet class.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void schedule(Event &event, Tick when)
virtual void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
const Cycles responseLimit
Command
List of all commands associated with a packet.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
ProbePointArg< PacketInfo > Packet
Packet probe point.
EventFunctionWrapper tickEvent