Go to the documentation of this file.
43 #include "config/have_protobuf.hh"
54 #include "debug/Checkpoint.hh"
55 #include "debug/TrafficGen.hh"
56 #include "enums/AddrMap.hh"
57 #include "params/BaseTrafficGen.hh"
72 elasticReq(
p->elastic_req),
73 progressCheck(
p->progress_check),
75 nextTransitionTick(0),
77 maxOutstandingReqs(
p->max_outstanding_reqs),
78 port(
name() +
".port", *
this),
80 retryPktTick(0), blockedWaitingResp(
false),
81 updateEvent([
this]{ update(); },
name()),
83 requestorId(
system->getRequestorId(
this)),
95 if (if_name ==
"port") {
108 fatal(
"The port of %s is not connected!\n",
name());
133 warn(
"%s serialization does not keep all traffic generator"
134 " internal state\n",
name());
136 DPRINTF(Checkpoint,
"Serializing BaseTrafficGen\n");
153 warn(
"%s serialization does not restore all traffic generator"
154 " internal state\n",
name());
188 pkt->
req->setStreamId(sid);
191 pkt->
req->setSubStreamId(ssid);
211 warn(
"%s suppressed %d packets with non-memory addresses\n",
238 if (duration !=
MaxTick && duration != 0) {
330 fatal(
"BaseTrafficGen %s spent %llu ticks without making progress",
335 :
Stats::Group(parent),
337 "Number of suppressed packets to non-memory space"),
338 ADD_STAT(numPackets,
"Number of packets generated"),
339 ADD_STAT(numRetries,
"Number of retries"),
340 ADD_STAT(retryTicks,
"Time spent waiting due to back-pressure (ticks)"),
341 ADD_STAT(bytesRead,
"Number of bytes read"),
342 ADD_STAT(bytesWritten,
"Number of bytes written"),
343 ADD_STAT(totalReadLatency,
"Total latency of read requests"),
344 ADD_STAT(totalWriteLatency,
"Total latency of write requests"),
345 ADD_STAT(totalReads,
"Total num of reads"),
346 ADD_STAT(totalWrites,
"Total num of writes"),
347 ADD_STAT(avgReadLatency,
"Avg latency of read requests",
348 totalReadLatency / totalReads),
349 ADD_STAT(avgWriteLatency,
"Avg latency of write requests",
350 totalWriteLatency / totalWrites),
351 ADD_STAT(readBW,
"Read bandwidth in bytes/s",
353 ADD_STAT(writeBW,
"Write bandwidth in bytes/s",
358 std::shared_ptr<BaseGen>
365 std::shared_ptr<BaseGen>
372 std::shared_ptr<BaseGen>
376 uint8_t read_percent,
Addr data_limit)
379 duration, start_addr,
382 min_period, max_period,
383 read_percent, data_limit));
386 std::shared_ptr<BaseGen>
390 uint8_t read_percent,
Addr data_limit)
393 duration, start_addr,
396 min_period, max_period,
397 read_percent, data_limit));
400 std::shared_ptr<BaseGen>
404 uint8_t read_percent,
Addr data_limit,
405 unsigned int num_seq_pkts,
unsigned int page_size,
406 unsigned int nbr_of_banks,
407 unsigned int nbr_of_banks_util,
408 Enums::AddrMap addr_mapping,
409 unsigned int nbr_of_ranks)
412 duration, start_addr,
415 min_period, max_period,
416 read_percent, data_limit,
417 num_seq_pkts, page_size,
424 std::shared_ptr<BaseGen>
428 uint8_t read_percent,
Addr data_limit,
429 unsigned int num_seq_pkts,
430 unsigned int page_size,
431 unsigned int nbr_of_banks,
432 unsigned int nbr_of_banks_util,
433 Enums::AddrMap addr_mapping,
434 unsigned int nbr_of_ranks,
435 unsigned int max_seq_count_per_rank)
438 duration, start_addr,
441 min_period, max_period,
442 read_percent, data_limit,
443 num_seq_pkts, page_size,
448 max_seq_count_per_rank));
451 std::shared_ptr<BaseGen>
453 Addr start_addr_dram,
Addr end_addr_dram,
455 Addr start_addr_nvm,
Addr end_addr_nvm,
458 uint8_t read_percent,
Addr data_limit,
459 unsigned int num_seq_pkts_dram,
460 unsigned int page_size_dram,
461 unsigned int nbr_of_banks_dram,
462 unsigned int nbr_of_banks_util_dram,
463 unsigned int num_seq_pkts_nvm,
464 unsigned int buffer_size_nvm,
465 unsigned int nbr_of_banks_nvm,
466 unsigned int nbr_of_banks_util_nvm,
467 Enums::AddrMap addr_mapping,
468 unsigned int nbr_of_ranks_dram,
469 unsigned int nbr_of_ranks_nvm,
473 duration, start_addr_dram,
474 end_addr_dram, blocksize_dram,
476 end_addr_nvm, blocksize_nvm,
478 min_period, max_period,
479 read_percent, data_limit,
483 nbr_of_banks_util_dram,
487 nbr_of_banks_util_nvm,
494 std::shared_ptr<BaseGen>
498 uint8_t read_percent,
Addr data_limit,
499 unsigned int num_seq_pkts,
unsigned int buffer_size,
500 unsigned int nbr_of_banks,
501 unsigned int nbr_of_banks_util,
502 Enums::AddrMap addr_mapping,
503 unsigned int nbr_of_ranks)
506 duration, start_addr,
509 min_period, max_period,
510 read_percent, data_limit,
511 num_seq_pkts, buffer_size,
518 std::shared_ptr<BaseGen>
520 const std::string& trace_file,
Addr addr_offset)
523 return std::shared_ptr<BaseGen>(
526 panic(
"Can't instantiate trace generation without Protobuf support!\n");
536 "Received unexpected response [%s reqPtr=%x]\n",
539 assert(iter->second <=
curTick());
Stats::Scalar totalReadLatency
Total num of ticks read reqs took to complete
std::shared_ptr< BaseGen > createDramRot(Tick duration, Addr start_addr, Addr end_addr, Addr blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit, unsigned int num_seq_pkts, unsigned int page_size, unsigned int nbr_of_banks, unsigned int nbr_of_banks_util, Enums::AddrMap addr_mapping, unsigned int nbr_of_ranks, unsigned int max_seq_count_per_rank)
#define fatal(...)
This implements a cprintf based fatal() function.
bool scheduled() const
Determine if the current event is scheduled.
NVM specific generator is for issuing request with variable buffer hit length and bank utilization.
The idle generator does nothing.
#define UNSERIALIZE_SCALAR(scalar)
TrafficGenPort port
The instance of request port used by the traffic generator.
void recvReqRetry()
Receive a retry from the neighbouring port and attempt to resend the waiting packet.
void reschedule(Event &event, Tick when, bool always=false)
std::shared_ptr< BaseGen > createRandom(Tick duration, Addr start_addr, Addr end_addr, Addr blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit)
std::shared_ptr< BaseGen > activeGenerator
Currently active generator.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void transition()
Transition to the next generator.
bool allocateWaitingRespSlot(PacketPtr pkt)
Puts this packet in the waitingResp list and returns true if we are above the maximum number of ousta...
uint64_t Tick
Tick count type.
DRAM specific generator is for issuing request with variable page hit length and bank utilization.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Hybrid NVM + DRAM specific generator is for issuing request with variable buffer hit length and bank ...
RequestPtr req
A pointer to the original request.
const Tick progressCheck
Time to tolerate waiting for retries (not making progress), until we declare things broken.
void deschedule(Event &event)
EventFunctionWrapper noProgressEvent
Event to keep track of our progress, or lack thereof.
Tick when() const
Get the time that the event is scheduled.
std::shared_ptr< BaseGen > createDram(Tick duration, Addr start_addr, Addr end_addr, Addr blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit, unsigned int num_seq_pkts, unsigned int page_size, unsigned int nbr_of_banks, unsigned int nbr_of_banks_util, Enums::AddrMap addr_mapping, unsigned int nbr_of_ranks)
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Stats::Scalar totalWrites
Count the number writes.
Stats::Scalar bytesRead
Count the number of bytes read.
@ Drained
Buffers drained, ready for serialization/handover.
void noProgress()
Method to inform the user we have made no progress.
DrainState
Object drain/handover states.
The linear generator generates sequential requests from a start to an end address,...
BaseTrafficGen(const BaseTrafficGenParams *p)
void schedule(Event &event, Tick when)
std::shared_ptr< BaseGen > createHybrid(Tick duration, Addr start_addr_dram, Addr end_addr_dram, Addr blocksize_dram, Addr start_addr_nvm, Addr end_addr_nvm, Addr blocksize_nvm, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit, unsigned int num_seq_pkts_dram, unsigned int page_size_dram, unsigned int nbr_of_banks_dram, unsigned int nbr_of_banks_util_dram, unsigned int num_seq_pkts_nvm, unsigned int buffer_size_nvm, unsigned int nbr_of_banks_nvm, unsigned int nbr_of_banks_util_nvm, Enums::AddrMap addr_mapping, unsigned int nbr_of_ranks_dram, unsigned int nbr_of_ranks_nvm, uint8_t nvm_percent)
Tick nextTransitionTick
Time of next transition.
Counter value() const
Return the current value of this stat as its base type.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
PacketPtr retryPkt
Packet waiting to be sent.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Stats::Formula simSeconds
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
std::shared_ptr< BaseGen > createLinear(Tick duration, Addr start_addr, Addr end_addr, Addr blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit)
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Ports are used to interface objects to each other.
Stats::Scalar numRetries
Count the number of retries.
virtual std::shared_ptr< BaseGen > nextGenerator()=0
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
std::shared_ptr< BaseGen > createTrace(Tick duration, const std::string &trace_file, Addr addr_offset)
Stats::Scalar totalWriteLatency
Total num of ticks write reqs took to complete
void signalDrainDone() const
Signal that an object is drained.
bool blockedWaitingResp
Set when we blocked waiting for outstanding reqs.
std::unique_ptr< StreamGen > streamGenerator
Stream/SubStreamID Generator.
Stats::Scalar numPackets
Count the number of generated packets.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
static StreamGen * create(const BaseTrafficGenParams *p)
Factory method for constructing a Stream generator.
std::unordered_map< RequestPtr, Tick > waitingResp
Reqs waiting for response.
void serialize(CheckpointOut &cp) const override
Serialize an object.
DrainState drainState() const
Return the current drain state of an object.
virtual const std::string name() const
Stats::Scalar numSuppressed
Count the number of dropped requests.
StatGroup(Stats::Group *parent)
The exit generator exits from the simulation once entered.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void scheduleUpdate()
Schedule the update event based on nextPacketTick and nextTransitionTick.
Tick nextPacketTick
Time of the next packet.
Overload hash function for BasicBlockRange type.
const RequestorID requestorId
RequestorID used in generated requests.
Stats::Scalar totalReads
Count the number reads.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
bool recvTimingResp(PacketPtr pkt)
EventFunctionWrapper updateEvent
Event for scheduling updates.
bool isConnected() const
Is this port currently connected to a peer?
BaseTrafficGen::StatGroup stats
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
std::ostream CheckpointOut
std::shared_ptr< BaseGen > createIdle(Tick duration)
The random generator is similar to the linear one, but does not generate sequential addresses.
Tick retryPktTick
Tick when the stalled packet was meant to be sent.
const bool elasticReq
Determine whether to add elasticity in the request injection, thus responding to backpressure by slow...
Stats::Scalar retryTicks
Count the time incurred from back-pressure.
unsigned int cacheLineSize() const
Get the cache line size of the system.
bool isMemAddr(Addr addr) const
Check if a physical address is within a range of a memory that is part of the global address map.
The trace replay generator reads a trace file and plays back the transactions.
std::shared_ptr< BaseGen > createExit(Tick duration)
The traffic generator is a module that generates stimuli for the memory system, based on a collection...
System *const system
The system used to determine which mode we are currently operating in.
@ Draining
Draining buffers pending serialization/handover.
void update()
Schedules event for next update and generates a new packet or requests a new generatoir depending on ...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::shared_ptr< BaseGen > createNvm(Tick duration, Addr start_addr, Addr end_addr, Addr blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit, unsigned int num_seq_pkts, unsigned int buffer_size, unsigned int nbr_of_banks, unsigned int nbr_of_banks_util, Enums::AddrMap addr_mapping, unsigned int nbr_of_ranks)
Stats::Scalar bytesWritten
Count the number of bytes written.
#define panic(...)
This implements a cprintf based panic() function.
Tick curTick()
The current simulated tick.
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17