Andreas Sandberg has submitted this change and it was merged. ( https://gem5-review.googlesource.com/11519 )

Change subject: configs: Update the DRAM sweep script to use PyTrafficGen
......................................................................

configs: Update the DRAM sweep script to use PyTrafficGen

Instead of generating a text configuration, use the new Python-based
traffic generator.

Change-Id: I6fb88ec45b74bb87470aa265af18b5a2ff24c314
Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/11519
Reviewed-by: Jason Lowe-Power <ja...@lowepower.com>
---
M configs/dram/sweep.py
1 file changed, 25 insertions(+), 33 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved



diff --git a/configs/dram/sweep.py b/configs/dram/sweep.py
index 8380f74..10ef748 100644
--- a/configs/dram/sweep.py
+++ b/configs/dram/sweep.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2015 ARM Limited
+# Copyright (c) 2014-2015, 2018 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -37,6 +37,7 @@

 from __future__ import print_function

+import math
 import optparse

 import m5
@@ -55,6 +56,11 @@

 parser = optparse.OptionParser()

+dram_generators = {
+    "DRAM" : lambda x: x.createDram,
+    "DRAM_ROTATE" : lambda x: x.createDramRot,
+}
+
 # Use a single-channel DDR3-1600 x64 (8x8 topology) by default
 parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8",
                   choices=MemConfig.mem_names(),
@@ -67,7 +73,7 @@
                   help = "Percentage of read commands")

 parser.add_option("--mode", type="choice", default="DRAM",
-                  choices=["DRAM", "DRAM_ROTATE"],
+                  choices=dram_generators.keys(),
                   help = "DRAM: Random traffic; \
DRAM_ROTATE: Traffic rotating across banks and ranks")

@@ -127,11 +133,6 @@
 # short enough to avoid hitting a refresh
 period = 250000000

-# this is where we go off piste, and print the traffic generator
-# configuration that we will later use, crazy but it works
-cfg_file_name = "configs/dram/sweep.cfg"
-cfg_file = open(cfg_file_name, 'w')
-
 # stay in each state as long as the dump/reset period, use the entire
 # range, issue transactions of the right DRAM burst size, and match
 # the DRAM maximum bandwidth to ensure that it is saturated
@@ -159,32 +160,8 @@
 # enough
 max_stride = min(512, page_size)

-# now we create the state by iterating over the stride size from burst
-# size to the max stride, and from using only a single bank up to the
-# number of banks available
-nxt_state = 0
-for bank in range(1, nbr_banks + 1):
-    for stride_size in range(burst_size, max_stride + 1, burst_size):
-        cfg_file.write("STATE %d %d %s %d 0 %d %d "
-                       "%d %d %d %d %d %d %d %d %d\n" %
-                       (nxt_state, period, options.mode, options.rd_perc,
-                        max_addr, burst_size, itt, itt, 0, stride_size,
-                        page_size, nbr_banks, bank, options.addr_map,
-                        options.mem_ranks))
-        nxt_state = nxt_state + 1
-
-cfg_file.write("INIT 0\n")
-
-# go through the states one by one
-for state in range(1, nxt_state):
-    cfg_file.write("TRANSITION %d %d 1\n" % (state - 1, state))
-
-cfg_file.write("TRANSITION %d %d 1\n" % (nxt_state - 1, nxt_state - 1))
-
-cfg_file.close()
-
 # create a traffic generator, and point it to the file we just created
-system.tgen = TrafficGen(config_file = cfg_file_name)
+system.tgen = PyTrafficGen()

 # add a communication monitor
 system.monitor = CommMonitor()
@@ -204,7 +181,22 @@
 root.system.mem_mode = 'timing'

 m5.instantiate()
-m5.simulate(nxt_state * period)
+
+def trace():
+    generator = dram_generators[options.mode](system.tgen)
+    for bank in range(1, nbr_banks + 1):
+        for stride_size in range(burst_size, max_stride + 1, burst_size):
+            num_seq_pkts = int(math.ceil(float(stride_size) / burst_size))
+            yield generator(period,
+                            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)
+    yield system.tgen.createExit(0)
+
+system.tgen.start(trace())
+
+m5.simulate()

 print("DRAM sweep with burst: %d, banks: %d, max stride: %d" %
     (burst_size, nbr_banks, max_stride))

--
To view, visit https://gem5-review.googlesource.com/11519
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I6fb88ec45b74bb87470aa265af18b5a2ff24c314
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 3
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to