Go to the documentation of this file.
43 #include "config/have_protobuf.hh"
55 #include "debug/Checkpoint.hh"
56 #include "debug/TrafficGen.hh"
57 #include "enums/AddrMap.hh"
58 #include "params/BaseTrafficGen.hh"
71 elasticReq(
p.elastic_req),
72 progressCheck(
p.progress_check),
74 nextTransitionTick(0),
76 maxOutstandingReqs(
p.max_outstanding_reqs),
77 port(
name() +
".port", *
this),
79 retryPktTick(0), blockedWaitingResp(
false),
80 updateEvent([
this]{ update(); },
name()),
82 requestorId(
system->getRequestorId(
this)),
94 if (if_name ==
"port") {
107 fatal(
"The port of %s is not connected!\n",
name());
132 warn(
"%s serialization does not keep all traffic generator"
133 " internal state\n",
name());
135 DPRINTF(Checkpoint,
"Serializing BaseTrafficGen\n");
152 warn(
"%s serialization does not restore all traffic generator"
153 " internal state\n",
name());
187 pkt->
req->setStreamId(sid);
190 pkt->
req->setSubstreamId(ssid);
210 warn(
"%s suppressed %d packets with non-memory addresses\n",
237 if (duration !=
MaxTick && duration != 0) {
329 fatal(
"BaseTrafficGen %s spent %llu ticks without making progress",
334 :
Stats::Group(parent),
336 "Number of suppressed packets to non-memory space"),
340 "Time spent waiting due to back-pressure"),
344 "Total latency of read requests"),
346 "Total latency of write requests"),
351 "Avg latency of read requests", totalReadLatency / totalReads),
354 "Avg latency of write requests",
355 totalWriteLatency / totalWrites),
363 std::shared_ptr<BaseGen>
370 std::shared_ptr<BaseGen>
377 std::shared_ptr<BaseGen>
381 uint8_t read_percent,
Addr data_limit)
384 duration, start_addr,
387 min_period, max_period,
388 read_percent, data_limit));
391 std::shared_ptr<BaseGen>
395 uint8_t read_percent,
Addr data_limit)
398 duration, start_addr,
401 min_period, max_period,
402 read_percent, data_limit));
405 std::shared_ptr<BaseGen>
409 uint8_t read_percent,
Addr data_limit,
410 unsigned int num_seq_pkts,
unsigned int page_size,
411 unsigned int nbr_of_banks,
412 unsigned int nbr_of_banks_util,
413 Enums::AddrMap addr_mapping,
414 unsigned int nbr_of_ranks)
417 duration, start_addr,
420 min_period, max_period,
421 read_percent, data_limit,
422 num_seq_pkts, page_size,
429 std::shared_ptr<BaseGen>
433 uint8_t read_percent,
Addr data_limit,
434 unsigned int num_seq_pkts,
435 unsigned int page_size,
436 unsigned int nbr_of_banks,
437 unsigned int nbr_of_banks_util,
438 Enums::AddrMap addr_mapping,
439 unsigned int nbr_of_ranks,
440 unsigned int max_seq_count_per_rank)
443 duration, start_addr,
446 min_period, max_period,
447 read_percent, data_limit,
448 num_seq_pkts, page_size,
453 max_seq_count_per_rank));
456 std::shared_ptr<BaseGen>
458 Addr start_addr_dram,
Addr end_addr_dram,
460 Addr start_addr_nvm,
Addr end_addr_nvm,
463 uint8_t read_percent,
Addr data_limit,
464 unsigned int num_seq_pkts_dram,
465 unsigned int page_size_dram,
466 unsigned int nbr_of_banks_dram,
467 unsigned int nbr_of_banks_util_dram,
468 unsigned int num_seq_pkts_nvm,
469 unsigned int buffer_size_nvm,
470 unsigned int nbr_of_banks_nvm,
471 unsigned int nbr_of_banks_util_nvm,
472 Enums::AddrMap addr_mapping,
473 unsigned int nbr_of_ranks_dram,
474 unsigned int nbr_of_ranks_nvm,
478 duration, start_addr_dram,
479 end_addr_dram, blocksize_dram,
481 end_addr_nvm, blocksize_nvm,
483 min_period, max_period,
484 read_percent, data_limit,
488 nbr_of_banks_util_dram,
492 nbr_of_banks_util_nvm,
499 std::shared_ptr<BaseGen>
503 uint8_t read_percent,
Addr data_limit,
504 unsigned int num_seq_pkts,
unsigned int buffer_size,
505 unsigned int nbr_of_banks,
506 unsigned int nbr_of_banks_util,
507 Enums::AddrMap addr_mapping,
508 unsigned int nbr_of_ranks)
511 duration, start_addr,
514 min_period, max_period,
515 read_percent, data_limit,
516 num_seq_pkts, buffer_size,
523 std::shared_ptr<BaseGen>
526 Addr stride_size,
int gen_id,
528 uint8_t read_percent,
Addr data_limit)
531 duration, start_addr,
535 min_period, max_period,
536 read_percent, data_limit));
539 std::shared_ptr<BaseGen>
541 const std::string& trace_file,
Addr addr_offset)
544 return std::shared_ptr<BaseGen>(
547 panic(
"Can't instantiate trace generation without Protobuf support!\n");
557 "Received unexpected response [%s reqPtr=%x]\n",
560 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)
The strided generator generates sequential requests from a start to an end address,...
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,...
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.
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.
static StreamGen * create(const BaseTrafficGenParams &p)
Factory method for constructing a Stream generator.
bool blockedWaitingResp
Set when we blocked waiting for outstanding reqs.
std::unique_ptr< StreamGen > streamGenerator
Stream/SubstreamID Generator.
std::shared_ptr< BaseGen > createStrided(Tick duration, Addr start_addr, Addr end_addr, Addr blocksize, Addr stride_size, int gen_id, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit)
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.
Stats::Formula & simSeconds
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
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.
BaseTrafficGen(const BaseTrafficGenParams &p)
virtual const std::string name() const
Stats::Scalar numSuppressed
Count the number of dropped requests.
#define UNIT_RATE(T1, T2)
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.
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 curTick()
The universal simulation clock.
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.
Generated on Tue Jun 22 2021 15:28:25 for gem5 by doxygen 1.8.17