44#include "debug/TrafficGen.hh"
45#include "enums/AddrMap.hh"
53 Addr _blocksize,
Addr cacheline_size,
55 uint8_t read_percent,
Addr data_limit,
56 unsigned int num_seq_pkts,
unsigned int buffer_size,
57 unsigned int nbr_of_banks,
58 unsigned int nbr_of_banks_util,
59 enums::AddrMap addr_mapping,
60 unsigned int nbr_of_ranks)
61 :
RandomGen(obj, requestor_id, _duration, start_addr, end_addr,
62 _blocksize, cacheline_size, min_period, max_period,
63 read_percent, data_limit),
64 numSeqPkts(num_seq_pkts), countNumSeqPkts(0),
addr(0),
65 isRead(true), bufferSize(buffer_size),
66 bufferBits(
floorLog2(buffer_size / _blocksize)),
69 nbrOfBanksNVM(nbr_of_banks),
70 nbrOfBanksUtil(nbr_of_banks_util), addrMapping(addr_mapping),
72 nbrOfRanks(nbr_of_ranks)
74 if (nbr_of_banks_util > nbr_of_banks)
75 fatal(
"Attempting to use more banks (%d) than "
76 "what is available (%d)\n",
77 nbr_of_banks_util, nbr_of_banks);
97 unsigned int new_bank =
101 unsigned int new_rank =
129 "size %d, countNumSeqPkts: %d, numSeqPkts: %d\n",
164 unsigned int new_col =
PacketPtr getPacket(Addr addr, unsigned size, const MemCmd &cmd, Request::FlagsType flags=0)
Generate a new request and associated packet.
const unsigned int blockBits
Number of block bits in NVM address.
Addr addr
Address of request.
PacketPtr getNextPacket()
Get the next generated packet.
enums::AddrMap addrMapping
Address mapping to be used.
unsigned int countNumSeqPkts
Track number of sequential packets generated for a request
const unsigned int bufferBits
Number of buffer bits in NVM address.
void genStartAddr(unsigned int new_bank, unsigned int new_rank)
Insert bank, rank, and column bits into packed address to create address for 1st command in a series.
const unsigned int rankBits
Number of rank bits in NVM address.
const unsigned int bufferSize
Buffer size of NVM.
bool isRead
Remember type of requests to be generated in series.
const unsigned int numSeqPkts
Number of sequential NVM packets to be generated per cpu request.
const unsigned int nbrOfBanksUtil
Number of banks to be utilized for a given configuration.
const unsigned int bankBits
Number of bank bits in NVM address.
const unsigned int nbrOfRanks
Number of ranks to be utilized for a given configuration.
NvmGen(SimObject &obj, RequestorID requestor_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 buffer_size, unsigned int nbr_of_banks, unsigned int nbr_of_banks_util, enums::AddrMap addr_mapping, unsigned int nbr_of_ranks)
Create a NVM address sequence generator.
const unsigned int nbrOfBanksNVM
Number of banks in NVM.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
The random generator is similar to the linear one, but does not generate sequential addresses.
Addr dataManipulated
Counter to determine the amount of data manipulated.
Abstract superclass for simulation objects.
const Addr startAddr
Start of address range.
const Addr endAddr
End of address range.
const Addr blocksize
Blocksize and address increment.
const uint8_t readPercent
Percent of generated transactions that should be reads.
The traffic generator is a module that generates stimuli for the memory system, based on a collection...
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
constexpr void replaceBits(T &val, unsigned first, unsigned last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Declaration of the NVM generator for issuing variable buffer hit length requests and bank utilisation...