std::shared_ptr<BaseGen>
BaseTrafficGen::createIdle(Tick duration)
{
- return std::shared_ptr<BaseGen>(new IdleGen(*this, duration));
+ return std::shared_ptr<BaseGen>(new IdleGen(*this, masterID, duration));
}
std::shared_ptr<BaseGen>
BaseTrafficGen::createExit(Tick duration)
{
- return std::shared_ptr<BaseGen>(new ExitGen(*this, duration));
+ return std::shared_ptr<BaseGen>(new ExitGen(*this, masterID, duration));
}
std::shared_ptr<BaseGen>
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit)
{
- return std::shared_ptr<BaseGen>(new LinearGen(*this,
+ return std::shared_ptr<BaseGen>(new LinearGen(*this, masterID,
duration, start_addr,
end_addr, blocksize,
+ system->cacheLineSize(),
min_period, max_period,
read_percent, data_limit));
}
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit)
{
- return std::shared_ptr<BaseGen>(new RandomGen(*this,
+ return std::shared_ptr<BaseGen>(new RandomGen(*this, masterID,
duration, start_addr,
end_addr, blocksize,
+ system->cacheLineSize(),
min_period, max_period,
read_percent, data_limit));
}
unsigned int addr_mapping,
unsigned int nbr_of_ranks)
{
- return std::shared_ptr<BaseGen>(new DramGen(*this,
+ return std::shared_ptr<BaseGen>(new DramGen(*this, masterID,
duration, start_addr,
end_addr, blocksize,
+ system->cacheLineSize(),
min_period, max_period,
read_percent, data_limit,
num_seq_pkts, page_size,
unsigned int nbr_of_ranks,
unsigned int max_seq_count_per_rank)
{
- return std::shared_ptr<BaseGen>(new DramRotGen(*this,
+ return std::shared_ptr<BaseGen>(new DramRotGen(*this, masterID,
duration, start_addr,
end_addr, blocksize,
+ system->cacheLineSize(),
min_period, max_period,
read_percent, data_limit,
num_seq_pkts, page_size,
{
#if HAVE_PROTOBUF
return std::shared_ptr<BaseGen>(
- new TraceGen(*this, duration, trace_file, addr_offset));
+ new TraceGen(*this, masterID, duration, trace_file, addr_offset));
#else
panic("Can't instantiate trace generation without Protobuf support!\n");
#endif
#include "debug/TrafficGen.hh"
#include "sim/system.hh"
-BaseGen::BaseGen(BaseTrafficGen &gen, Tick _duration)
- : _name(gen.name()), masterID(gen.masterID),
- cacheLineSize(gen.system->cacheLineSize()),
+BaseGen::BaseGen(SimObject &obj, MasterID master_id, Tick _duration)
+ : _name(obj.name()), masterID(master_id),
duration(_duration)
{
}
return pkt;
}
-StochasticGen::StochasticGen(BaseTrafficGen &gen,
- Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+StochasticGen::StochasticGen(SimObject &obj,
+ MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit)
- : BaseGen(gen, _duration),
+ : BaseGen(obj, master_id, _duration),
startAddr(start_addr), endAddr(end_addr),
- blocksize(_blocksize), minPeriod(min_period),
- maxPeriod(max_period), readPercent(read_percent),
- dataLimit(data_limit)
+ blocksize(_blocksize), cacheLineSize(cacheline_size),
+ minPeriod(min_period), maxPeriod(max_period),
+ readPercent(read_percent), dataLimit(data_limit)
{
if (blocksize > cacheLineSize)
fatal("TrafficGen %s block size (%d) is larger than "
/** The MasterID used for generating requests */
const MasterID masterID;
- /** Cache line size in the simulated system */
- const Addr cacheLineSize;
-
/**
* Generate a new request and associated packet
*
/**
* Create a base generator.
*
- * @param _name Name to use for status and debug
+ * @param obj simobject owning the generator
* @param master_id MasterID set on each request
* @param _duration duration of this state before transitioning
*/
- BaseGen(BaseTrafficGen &gen, Tick _duration);
+ BaseGen(SimObject &obj, MasterID master_id, Tick _duration);
virtual ~BaseGen() { }
class StochasticGen : public BaseGen
{
public:
- StochasticGen(BaseTrafficGen &gen, Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+ StochasticGen(SimObject &obj,
+ MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit);
/** Blocksize and address increment */
const Addr blocksize;
+ /** Cache line size in the simulated system */
+ const Addr cacheLineSize;
+
/** Request generation period */
const Tick minPeriod;
const Tick maxPeriod;
#include "debug/TrafficGen.hh"
-DramGen::DramGen(BaseTrafficGen &gen, Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+DramGen::DramGen(SimObject &obj,
+ MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
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_util,
unsigned int addr_mapping,
unsigned int nbr_of_ranks)
- : RandomGen(gen, _duration, start_addr, end_addr,
- _blocksize, min_period, max_period, read_percent, data_limit),
+ : RandomGen(obj, master_id, _duration, start_addr, end_addr,
+ _blocksize, cacheline_size, min_period, max_period,
+ read_percent, data_limit),
numSeqPkts(num_seq_pkts), countNumSeqPkts(0), addr(0),
isRead(true), pageSize(page_size),
pageBits(floorLog2(page_size / _blocksize)),
/**
* Create a DRAM address sequence generator.
*
- * @param gen Traffic generator owning this sequence generator
+ * @param obj SimObject owning this sequence generator
+ * @param master_id MasterID related to the memory requests
* @param _duration duration of this state before transitioning
* @param start_addr Start address
* @param end_addr End address
* @param _blocksize Size used for transactions injected
+ * @param cacheline_size cache line size in the system
* @param min_period Lower limit of random inter-transaction time
* @param max_period Upper limit of random inter-transaction time
* @param read_percent Percent of transactions that are reads
* 0: RoCoRaBaCh, 1: RoRaBaCoCh/RoRaBaChCo
* assumes single channel system
*/
- DramGen(BaseTrafficGen &gen, Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+ DramGen(SimObject &obj,
+ MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit,
unsigned int num_seq_pkts, unsigned int page_size,
* 2) Command type (if applicable)
* 3) Ranks per channel
*
- * @param gen Traffic generator owning this sequence generator
+ * @param obj SimObject owning this sequence generator
+ * @param master_id MasterID related to the memory requests
* @param _duration duration of this state before transitioning
* @param start_addr Start address
* @param end_addr End address
* @param _blocksize Size used for transactions injected
+ * @param cacheline_size cache line size in the system
* @param min_period Lower limit of random inter-transaction time
* @param max_period Upper limit of random inter-transaction time
* @param read_percent Percent of transactions that are reads
* 0: RoCoRaBaCh, 1: RoRaBaCoCh/RoRaBaChCo
* assumes single channel system
*/
- DramRotGen(BaseTrafficGen &gen, Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+ DramRotGen(SimObject &obj, MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit,
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int addr_mapping,
unsigned int nbr_of_ranks,
unsigned int max_seq_count_per_rank)
- : DramGen(gen, _duration, start_addr, end_addr,
- _blocksize, min_period, max_period, read_percent, data_limit,
+ : DramGen(obj, master_id, _duration, start_addr, end_addr,
+ _blocksize, cacheline_size, min_period, max_period,
+ read_percent, data_limit,
num_seq_pkts, page_size, nbr_of_banks_DRAM,
nbr_of_banks_util, addr_mapping,
nbr_of_ranks),
public:
- ExitGen(BaseTrafficGen &gen, Tick _duration)
- : BaseGen(gen, _duration)
+ ExitGen(SimObject &obj, MasterID master_id, Tick _duration)
+ : BaseGen(obj, master_id, _duration)
{ }
void enter();
public:
- IdleGen(BaseTrafficGen &gen, Tick _duration)
- : BaseGen(gen, _duration)
+ IdleGen(SimObject &obj, MasterID master_id, Tick _duration)
+ : BaseGen(obj, master_id, _duration)
{ }
void enter();
* min_period == max_period for a fixed inter-transaction
* time.
*
- * @param gen Traffic generator owning this sequence generator
+ * @param obj SimObject owning this sequence generator
+ * @param master_id MasterID related to the memory requests
* @param _duration duration of this state before transitioning
* @param start_addr Start address
* @param end_addr End address
* @param _blocksize Size used for transactions injected
+ * @param cacheline_size cache line size in the system
* @param min_period Lower limit of random inter-transaction time
* @param max_period Upper limit of random inter-transaction time
* @param read_percent Percent of transactions that are reads
* @param data_limit Upper limit on how much data to read/write
*/
- LinearGen(BaseTrafficGen &gen, Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+ LinearGen(SimObject &obj,
+ MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit)
- : StochasticGen(gen, _duration, start_addr, end_addr,
- _blocksize, min_period, max_period, read_percent,
- data_limit),
+ : StochasticGen(obj, master_id, _duration, start_addr, end_addr,
+ _blocksize, cacheline_size, min_period, max_period,
+ read_percent, data_limit),
nextAddr(0),
dataManipulated(0)
{ }
* @param read_percent Percent of transactions that are reads
* @param data_limit Upper limit on how much data to read/write
*/
- RandomGen(BaseTrafficGen &gen, Tick _duration,
- Addr start_addr, Addr end_addr, Addr _blocksize,
+ RandomGen(SimObject &obj,
+ MasterID master_id, Tick _duration,
+ Addr start_addr, Addr end_addr,
+ Addr _blocksize, Addr cacheline_size,
Tick min_period, Tick max_period,
uint8_t read_percent, Addr data_limit)
- : StochasticGen(gen, _duration, start_addr, end_addr, _blocksize,
- min_period, max_period, read_percent, data_limit),
+ : StochasticGen(obj, master_id, _duration, start_addr, end_addr,
+ _blocksize, cacheline_size, min_period, max_period,
+ read_percent, data_limit),
dataManipulated(0)
{ }
/**
* Create a trace generator.
*
- * @param gen Traffic generator owning this sequence generator
+ * @param obj SimObject owning this sequence generator
+ * @param master_id MasterID related to the memory requests
* @param _duration duration of this state before transitioning
* @param trace_file File to read the transactions from
* @param addr_offset Positive offset to add to trace address
*/
- TraceGen(BaseTrafficGen &gen, Tick _duration,
+ TraceGen(SimObject &obj, MasterID master_id, Tick _duration,
const std::string& trace_file, Addr addr_offset)
- : BaseGen(gen, _duration),
+ : BaseGen(obj, master_id, _duration),
trace(trace_file),
tickOffset(0),
addrOffset(addr_offset),