gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
RandomGen Class Reference

The random generator is similar to the linear one, but does not generate sequential addresses. More...

#include <generators.hh>

Inheritance diagram for RandomGen:
BaseGen DramGen DramRotGen

Public Member Functions

 RandomGen (const std::string &_name, MasterID master_id, Tick _duration, Addr start_addr, Addr end_addr, Addr _blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit)
 Create a random address sequence generator. More...
 
void enter ()
 Enter this generator state. More...
 
PacketPtr getNextPacket ()
 Get the next generated packet. More...
 
Tick nextPacketTick (bool elastic, Tick delay) const
 Determine the tick when the next packet is available. More...
 
- Public Member Functions inherited from BaseGen
 BaseGen (const std::string &_name, MasterID master_id, Tick _duration)
 Create a base generator. More...
 
virtual ~BaseGen ()
 
std::string name () const
 Get the name, useful for DPRINTFs. More...
 
virtual void exit ()
 Exit this generator state. More...
 

Protected Attributes

const Addr startAddr
 Start of address range. More...
 
const Addr endAddr
 End of address range. More...
 
const Addr blocksize
 Block size. More...
 
const Tick minPeriod
 Request generation period. More...
 
const Tick maxPeriod
 
const uint8_t readPercent
 Percent of generated transactions that should be reads. More...
 
const Addr dataLimit
 Maximum amount of data to manipulate. More...
 
Addr dataManipulated
 Counter to determine the amount of data manipulated. More...
 
- Protected Attributes inherited from BaseGen
const std::string _name
 Name to use for status and debug printing. More...
 
const MasterID masterID
 The MasterID used for generating requests. More...
 

Additional Inherited Members

- Public Attributes inherited from BaseGen
const Tick duration
 Time to spend in this state. More...
 
- Protected Member Functions inherited from BaseGen
PacketPtr getPacket (Addr addr, unsigned size, const MemCmd &cmd, Request::FlagsType flags=0)
 Generate a new request and associated packet. More...
 

Detailed Description

The random generator is similar to the linear one, but does not generate sequential addresses.

Instead it randomly picks an address in the range, aligned to the block size.

Definition at line 241 of file generators.hh.

Constructor & Destructor Documentation

RandomGen::RandomGen ( const std::string &  _name,
MasterID  master_id,
Tick  _duration,
Addr  start_addr,
Addr  end_addr,
Addr  _blocksize,
Tick  min_period,
Tick  max_period,
uint8_t  read_percent,
Addr  data_limit 
)
inline

Create a random address sequence generator.

Set min_period == max_period for a fixed inter-transaction time.

Parameters
_nameName to use for status and debug
master_idMasterID set on each request
_durationduration of this state before transitioning
start_addrStart address
end_addrEnd address
_blocksizeSize used for transactions injected
min_periodLower limit of random inter-transaction time
max_periodUpper limit of random inter-transaction time
read_percentPercent of transactions that are reads
data_limitUpper limit on how much data to read/write

Definition at line 262 of file generators.hh.

Member Function Documentation

void RandomGen::enter ( )
virtual

Enter this generator state.

Implements BaseGen.

Definition at line 149 of file generators.cc.

References dataManipulated.

PacketPtr RandomGen::getNextPacket ( )
virtual

Get the next generated packet.

Returns
A packet to be sent at the current tick

Implements BaseGen.

Reimplemented in DramRotGen, and DramGen.

Definition at line 156 of file generators.cc.

References addr, blocksize, dataManipulated, DPRINTF, endAddr, BaseGen::getPacket(), Random::random(), random_mt, readPercent, MemCmd::ReadReq, startAddr, and MemCmd::WriteReq.

Tick RandomGen::nextPacketTick ( bool  elastic,
Tick  delay 
) const
virtual

Determine the tick when the next packet is available.

MaxTick means that there will not be any further packets in the current activation cycle of the generator.

Parameters
elasticshould the injection respond to flow control or not
delaytime the previous packet spent waiting
Returns
next tick when a packet is available

Implements BaseGen.

Definition at line 384 of file generators.cc.

References curTick(), dataLimit, dataManipulated, DPRINTF, maxPeriod, MaxTick, minPeriod, Random::random(), and random_mt.

Member Data Documentation

const Addr RandomGen::blocksize
protected
const Addr RandomGen::dataLimit
protected

Maximum amount of data to manipulate.

Definition at line 300 of file generators.hh.

Referenced by nextPacketTick().

Addr RandomGen::dataManipulated
protected

Counter to determine the amount of data manipulated.

Used to determine if we should continue generating requests.

Definition at line 307 of file generators.hh.

Referenced by enter(), getNextPacket(), DramGen::getNextPacket(), DramRotGen::getNextPacket(), and nextPacketTick().

const Addr RandomGen::endAddr
protected

End of address range.

Definition at line 285 of file generators.hh.

Referenced by DramGen::genStartAddr(), and getNextPacket().

const Tick RandomGen::maxPeriod
protected

Definition at line 292 of file generators.hh.

Referenced by nextPacketTick().

const Tick RandomGen::minPeriod
protected

Request generation period.

Definition at line 291 of file generators.hh.

Referenced by nextPacketTick().

const uint8_t RandomGen::readPercent
protected

Percent of generated transactions that should be reads.

Definition at line 297 of file generators.hh.

Referenced by DramRotGen::DramRotGen(), getNextPacket(), DramGen::getNextPacket(), and DramRotGen::getNextPacket().

const Addr RandomGen::startAddr
protected

Start of address range.

Definition at line 282 of file generators.hh.

Referenced by DramGen::genStartAddr(), and getNextPacket().


The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:17 for gem5 by doxygen 1.8.6