38#ifndef __CPU_TRAFFIC_GEN_BASE_HH__
39#define __CPU_TRAFFIC_GEN_BASE_HH__
43#include <unordered_map>
46#include "enums/AddrMap.hh"
56struct BaseTrafficGenParams;
252 void init()
override;
267 uint8_t read_percent,
Addr data_limit);
273 uint8_t read_percent,
Addr data_limit);
279 uint8_t read_percent,
Addr data_limit,
280 unsigned int num_seq_pkts,
unsigned int page_size,
281 unsigned int nbr_of_banks,
unsigned int nbr_of_banks_util,
282 enums::AddrMap addr_mapping,
283 unsigned int nbr_of_ranks);
289 uint8_t read_percent,
Addr data_limit,
290 unsigned int num_seq_pkts,
unsigned int page_size,
291 unsigned int nbr_of_banks,
unsigned int nbr_of_banks_util,
292 enums::AddrMap addr_mapping,
293 unsigned int nbr_of_ranks,
294 unsigned int max_seq_count_per_rank);
298 Addr start_addr_dram,
Addr end_addr_dram,
Addr blocksize_dram,
299 Addr start_addr_nvm,
Addr end_addr_nvm,
Addr blocksize_nvm,
301 uint8_t read_percent,
Addr data_limit,
302 unsigned int num_seq_pkts_dram,
unsigned int page_size_dram,
303 unsigned int nbr_of_banks_dram,
unsigned int nbr_of_banks_util_dram,
304 unsigned int num_seq_pkts_nvm,
unsigned int buffer_size_nvm,
305 unsigned int nbr_of_banks_nvm,
unsigned int nbr_of_banks_util_nvm,
306 enums::AddrMap addr_mapping,
307 unsigned int nbr_of_ranks_dram,
308 unsigned int nbr_of_ranks_nvm,
309 uint8_t nvm_percent);
315 uint8_t read_percent,
Addr data_limit,
316 unsigned int num_seq_pkts,
unsigned int buffer_size,
317 unsigned int nbr_of_banks,
unsigned int nbr_of_banks_util,
318 enums::AddrMap addr_mapping,
319 unsigned int nbr_of_ranks);
324 Addr block_size,
Addr superblock_size,
Addr stride_size,
326 uint8_t read_percent,
Addr data_limit);
330 const std::string& trace_file,
Addr addr_offset);
Base class for all generators, with the shared functionality and virtual functions for entering,...
Request port specialisation for the traffic generator.
BaseTrafficGen & trafficGen
TrafficGenPort(const std::string &name, BaseTrafficGen &traffic_gen)
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Tick recvAtomicSnoop(PacketPtr pkt)
Default implementations.
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
The traffic generator is a module that generates stimuli for the memory system, based on a collection...
void update()
Schedules event for next update and generates a new packet or requests a new generatoir depending on ...
Tick nextPacketTick
Time of the next packet.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
std::shared_ptr< BaseGen > createIdle(Tick duration)
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)
std::shared_ptr< BaseGen > createTrace(Tick duration, const std::string &trace_file, Addr addr_offset)
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)
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
const bool elasticReq
Determine whether to add elasticity in the request injection, thus responding to backpressure by slow...
std::unordered_map< RequestPtr, Tick > waitingResp
Reqs waiting for response.
std::shared_ptr< BaseGen > createStrided(Tick duration, Addr start_addr, Addr end_addr, Addr offset, Addr block_size, Addr superblock_size, Addr stride_size, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit)
void scheduleUpdate()
Schedule the update event based on nextPacketTick and nextTransitionTick.
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)
void transition()
Transition to the next generator.
virtual std::shared_ptr< BaseGen > nextGenerator()=0
bool blockedWaitingResp
Set when we blocked waiting for outstanding reqs.
Tick retryPktTick
Tick when the stalled packet was meant to be sent.
void recvReqRetry()
Receive a retry from the neighbouring port and attempt to resend the waiting packet.
gem5::BaseTrafficGen::StatGroup stats
System *const system
The system used to determine which mode we are currently operating in.
std::shared_ptr< BaseGen > activeGenerator
Currently active generator.
BaseTrafficGen(const BaseTrafficGenParams &p)
Tick nextTransitionTick
Time of next transition.
TrafficGenPort port
The instance of request port used by the traffic generator.
const Tick progressCheck
Time to tolerate waiting for retries (not making progress), until we declare things broken.
bool recvTimingResp(PacketPtr pkt)
std::shared_ptr< BaseGen > createExit(Tick duration)
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)
EventFunctionWrapper noProgressEvent
Event to keep track of our progress, or lack thereof.
const RequestorID requestorId
RequestorID used in generated requests.
EventFunctionWrapper updateEvent
Event for scheduling updates.
void noProgress()
Method to inform the user we have made no progress.
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)
const int maxOutstandingReqs
PacketPtr retryPkt
Packet waiting to be sent.
bool allocateWaitingRespSlot(PacketPtr pkt)
Puts this packet in the waitingResp list and returns true if we are above the maximum number of ousta...
void serialize(CheckpointOut &cp) const override
Serialize an object.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
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::unique_ptr< StreamGen > streamGenerator
Stream/SubstreamID Generator.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
bool needsResponse() const
RequestPtr req
A pointer to the original request.
Ports are used to interface objects to each other.
const std::string name() const
Return port name (for DPRINTF).
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
This is a simple scalar statistic, like a counter.
ClockedObject declaration and implementation.
DrainState
Object drain/handover states.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
Declaration of the queued port.
Declaration of Statistics objects.
statistics::Scalar totalReads
Count the number reads.
statistics::Scalar numRetries
Count the number of retries.
statistics::Scalar retryTicks
Count the time incurred from back-pressure.
statistics::Scalar totalReadLatency
Total num of ticks read reqs took to complete
statistics::Formula writeBW
Write bandwidth in bytes/s
statistics::Formula avgReadLatency
Avg num of ticks each read req took to complete
statistics::Scalar bytesWritten
Count the number of bytes written.
statistics::Formula avgWriteLatency
Avg num of ticks each write reqs took to complete
statistics::Scalar numSuppressed
Count the number of dropped requests.
statistics::Formula readBW
Read bandwidth in bytes/s
statistics::Scalar bytesRead
Count the number of bytes read.
statistics::Scalar totalWrites
Count the number writes.
statistics::Scalar totalWriteLatency
Total num of ticks write reqs took to complete
StatGroup(statistics::Group *parent)
statistics::Scalar numPackets
Count the number of generated packets.