-# Copyright (c) 2014-2015, 2017 ARM Limited
+# Copyright (c) 2014-2015, 2017, 2019 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
parser.add_argument("--rd-perc", type=int, default=100,
help = "Percentage of read commands")
-parser.add_argument("--addr-map", type=int, default=1,
- help = "0: RoCoRaBaCh; 1: RoRaBaCoCh/RoRaBaChCo")
+parser.add_argument("--addr-map",
+ choices=m5.objects.AddrMap.vals,
+ default="RoRaBaCoCh", help = "DRAM address map policy")
parser.add_argument("--idle-end", type=int, default=50000000,
help = "time in ps of an idle period at the end ")
system.mem_ctrls[0].null = True
# Set the address mapping based on input argument
-# Default to RoRaBaCoCh
-if args.addr_map == 0:
- system.mem_ctrls[0].addr_mapping = "RoCoRaBaCh"
-elif args.addr_map == 1:
- system.mem_ctrls[0].addr_mapping = "RoRaBaCoCh"
-else:
- fatal("Did not specify a valid address map argument")
-
+system.mem_ctrls[0].addr_mapping = args.addr_map
system.mem_ctrls[0].page_policy = args.page_policy
# We create a traffic generator state for each param combination we want to
# read_percent start_addr end_addr req_size min_itt max_itt data_limit
# stride_size page_size #banks #banks_util addr_map #ranks\n""")
+addr_map = m5.objects.AddrMap.map[args.addr_map]
+
nxt_state = 0
for itt_max in itt_max_values:
for bank in bank_util_values:
"%d %d %d %d %d %d %d %d %d\n" %
(nxt_state, period, "DRAM", args.rd_perc, max_addr,
burst_size, itt_min, itt_max, 0, stride_size,
- page_size, nbr_banks, bank, args.addr_map,
+ page_size, nbr_banks, bank, addr_map,
args.mem_ranks))
nxt_state = nxt_state + 1
-# Copyright (c) 2014-2015, 2018 ARM Limited
+# Copyright (c) 2014-2015, 2018-2019 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
help = "DRAM: Random traffic; \
DRAM_ROTATE: Traffic rotating across banks and ranks")
-parser.add_option("--addr_map", type="int", default=1,
- help = "0: RoCoRaBaCh; 1: RoRaBaCoCh/RoRaBaChCo")
+parser.add_argument("--addr-map",
+ choices=m5.objects.AddrMap.vals,
+ default="RoRaBaCoCh", help = "DRAM address map policy")
(options, args) = parser.parse_args()
system.mem_ctrls[0].null = True
# Set the address mapping based on input argument
-# Default to RoRaBaCoCh
-if options.addr_map == 0:
- system.mem_ctrls[0].addr_mapping = "RoCoRaBaCh"
-elif options.addr_map == 1:
- system.mem_ctrls[0].addr_mapping = "RoRaBaCoCh"
-else:
- fatal("Did not specify a valid address map argument")
+system.mem_ctrls[0].addr_mapping = args.addr_map
# stay in each state for 0.25 ms, long enough to warm things up, and
# short enough to avoid hitting a refresh
m5.instantiate()
+addr_map = m5.objects.AddrMap.map[args.addr_map]
+
def trace():
generator = dram_generators[options.mode](system.tgen)
for bank in range(1, nbr_banks + 1):
0, max_addr, burst_size, int(itt), int(itt),
options.rd_perc, 0,
num_seq_pkts, page_size, nbr_banks, bank,
- options.addr_map, options.mem_ranks)
+ addr_map, options.mem_ranks)
yield system.tgen.createExit(0)
system.tgen.start(trace())
#include "cpu/testers/traffic_gen/stream_gen.hh"
#include "debug/Checkpoint.hh"
#include "debug/TrafficGen.hh"
+#include "enums/AddrMap.hh"
#include "params/BaseTrafficGen.hh"
#include "sim/sim_exit.hh"
#include "sim/stats.hh"
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int nbr_of_banks_DRAM,
unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks)
{
return std::shared_ptr<BaseGen>(new DramGen(*this, masterID,
unsigned int page_size,
unsigned int nbr_of_banks_DRAM,
unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks,
unsigned int max_seq_count_per_rank)
{
#include <unordered_map>
#include "base/statistics.hh"
+#include "enums/AddrMap.hh"
#include "mem/qport.hh"
#include "sim/clocked_object.hh"
uint8_t read_percent, Addr data_limit,
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int nbr_of_banks_DRAM, unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks);
std::shared_ptr<BaseGen> createDramRot(
uint8_t read_percent, Addr data_limit,
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int nbr_of_banks_DRAM, unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks,
unsigned int max_seq_count_per_rank);
/*
- * Copyright (c) 2012-2013, 2016-2018 ARM Limited
+ * Copyright (c) 2012-2013, 2016-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#include "base/random.hh"
#include "base/trace.hh"
#include "debug/TrafficGen.hh"
-
+#include "enums/AddrMap.hh"
DramGen::DramGen(SimObject &obj,
MasterID master_id, Tick _duration,
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int nbr_of_banks_DRAM,
unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks)
: RandomGen(obj, master_id, _duration, start_addr, end_addr,
_blocksize, cacheline_size, min_period, max_period,
rankBits(floorLog2(nbr_of_ranks)),
nbrOfRanks(nbr_of_ranks)
{
- if (addrMapping != 1 && addrMapping != 0) {
- addrMapping = 1;
- warn("Unknown address mapping specified, using RoRaBaCoCh\n");
- }
-
if (nbr_of_banks_util > nbr_of_banks_DRAM)
fatal("Attempting to use more banks (%d) than "
"what is available (%d)\n",
} else {
// increment the column by one
- if (addrMapping == 1)
- // addrMapping=1: RoRaBaCoCh/RoRaBaChCo
+ if (addrMapping == Enums::RoRaBaCoCh ||
+ addrMapping == Enums::RoRaBaChCo)
// Simply increment addr by blocksize to increment
// the column by one
addr += blocksize;
- else if (addrMapping == 0) {
- // addrMapping=0: RoCoRaBaCh
+ else if (addrMapping == Enums::RoCoRaBaCh) {
// Explicity increment the column bits
unsigned int new_col = ((addr / blocksize /
nbrOfBanksDRAM / nbrOfRanks) %
unsigned int new_col =
random_mt.random<unsigned int>(0, columns_per_page - numSeqPkts);
- if (addrMapping == 1) {
- // addrMapping=1: RoRaBaCoCh/RoRaBaChCo
+ if (addrMapping == Enums::RoRaBaCoCh ||
+ addrMapping == Enums::RoRaBaChCo) {
// Block bits, then page bits, then bank bits, then rank bits
replaceBits(addr, blockBits + pageBits + bankBits - 1,
blockBits + pageBits, new_bank);
replaceBits(addr, blockBits + pageBits + bankBits +rankBits - 1,
blockBits + pageBits + bankBits, new_rank);
}
- } else if (addrMapping == 0) {
- // addrMapping=0: RoCoRaBaCh
+ } else if (addrMapping == Enums::RoCoRaBaCh) {
// Block bits, then bank bits, then rank bits, then page bits
replaceBits(addr, blockBits + bankBits - 1, blockBits, new_bank);
replaceBits(addr, blockBits + bankBits + rankBits + pageBits - 1,
/*
- * Copyright (c) 2012-2013, 2017-2018 ARM Limited
+ * Copyright (c) 2012-2013, 2017-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#include "base/bitfield.hh"
#include "base/intmath.hh"
+#include "enums/AddrMap.hh"
#include "mem/packet.hh"
#include "random_gen.hh"
* @param nbr_of_banks_util Number of banks to utilized,
* for N banks, we will use banks: 0->(N-1)
* @param addr_mapping Address mapping to be used,
- * 0: RoCoRaBaCh, 1: RoRaBaCoCh/RoRaBaChCo
* assumes single channel system
*/
DramGen(SimObject &obj,
uint8_t read_percent, Addr data_limit,
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int nbr_of_banks_DRAM, unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks);
PacketPtr getNextPacket();
const unsigned int nbrOfBanksUtil;
/** Address mapping to be used */
- unsigned int addrMapping;
+ Enums::AddrMap addrMapping;
/** Number of rank bits in DRAM address*/
const unsigned int rankBits;
/*
- * Copyright (c) 2012-2013, 2016-2017 ARM Limited
+ * Copyright (c) 2012-2013, 2016-2017, 2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#include "base/random.hh"
#include "base/trace.hh"
#include "debug/TrafficGen.hh"
+#include "enums/AddrMap.hh"
PacketPtr
DramRotGen::getNextPacket()
} else {
// increment the column by one
- if (addrMapping == 1)
- // addrMapping=1: RoRaBaCoCh/RoRaBaChCo
+ if (addrMapping == Enums::RoRaBaCoCh ||
+ addrMapping == Enums::RoRaBaChCo)
// Simply increment addr by blocksize to
// increment the column by one
addr += blocksize;
- else if (addrMapping == 0) {
- // addrMapping=0: RoCoRaBaCh
+ else if (addrMapping == Enums::RoCoRaBaCh) {
// Explicity increment the column bits
unsigned int new_col = ((addr / blocksize /
/*
- * Copyright (c) 2012-2013, 2017-2018 ARM Limited
+ * Copyright (c) 2012-2013, 2017-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#include "base/bitfield.hh"
#include "base/intmath.hh"
#include "dram_gen.hh"
+#include "enums/AddrMap.hh"
#include "mem/packet.hh"
class DramRotGen : public DramGen
* for N banks, we will use banks: 0->(N-1)
* @param nbr_of_ranks Number of ranks utilized,
* @param addr_mapping Address mapping to be used,
- * 0: RoCoRaBaCh, 1: RoRaBaCoCh/RoRaBaChCo
* assumes single channel system
*/
DramRotGen(SimObject &obj, MasterID master_id, Tick _duration,
uint8_t read_percent, Addr data_limit,
unsigned int num_seq_pkts, unsigned int page_size,
unsigned int nbr_of_banks_DRAM, unsigned int nbr_of_banks_util,
- unsigned int addr_mapping,
+ Enums::AddrMap addr_mapping,
unsigned int nbr_of_ranks,
unsigned int max_seq_count_per_rank)
: DramGen(obj, master_id, _duration, start_addr, end_addr,
/*
- * Copyright (c) 2012-2013, 2016-2018 ARM Limited
+ * Copyright (c) 2012-2013, 2016-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
unsigned int page_size;
unsigned int nbr_of_banks_DRAM;
unsigned int nbr_of_banks_util;
- unsigned int addr_mapping;
+ unsigned _addr_mapping;
unsigned int nbr_of_ranks;
is >> stride_size >> page_size >> nbr_of_banks_DRAM >>
- nbr_of_banks_util >> addr_mapping >>
+ nbr_of_banks_util >> _addr_mapping >>
nbr_of_ranks;
+ Enums::AddrMap addr_mapping =
+ static_cast<Enums::AddrMap>(_addr_mapping);
if (stride_size > page_size)
warn("DRAM generator stride size (%d) is greater "