40 #include "debug/GarnetSyntheticTraffic.hh" 55 tester->completeRequest(pkt);
68 if (!cachePort.sendTimingReq(pkt)) {
76 tickEvent([this]{
tick(); },
"GarnetSyntheticTraffic tick",
78 cachePort(
"GarnetSyntheticTraffic",
this),
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;
202 destination = dest_y*radix + dest_x;
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++)
213 reverse |= (straight & 1);
218 destination = source/2;
220 destination = ((source/2) + (num_destinations/2));
222 dest_x = (src_x + 1) % radix;
224 destination = dest_y*radix + dest_x;
226 if (source < num_destinations/2)
227 destination = source*2;
229 destination = (source*2 - num_destinations + 1);
233 destination = dest_y*radix + dest_x;
235 dest_x = (src_x + (int) ceil(radix/2) - 1) % radix;
237 destination = dest_y*radix + dest_x;
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,
masterId);
294 }
else if (injReqType == 1) {
298 req = std::make_shared<Request>(
299 0x0, access_size, flags,
masterId, 0x0, 0);
300 req->setPaddr(paddr);
304 req = std::make_shared<Request>(paddr, access_size, flags,
masterId);
313 "Generated packet with destination %d, embedded in address %x\n",
314 destination, req->getPaddr());
317 pkt->dataDynamic(
new uint8_t[req->getSize()]);
318 pkt->senderState = NULL;
352 GarnetSyntheticTrafficParams::create()
Ports are used to interface objects to each other.
Cycles is a wrapper class for representing cycle counts, i.e.
#define fatal(...)
This implements a cprintf based fatal() function.
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 Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
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 ...
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
The request was an instruction fetch.
void schedule(Event &event, Tick when)
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...
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...
bool scheduled() const
Determine if the current event is scheduled.
virtual const std::string name() const
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.
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