config: Add a system clock command-line option
authorAkash Bagdia <akash.bagdia@arm.com>
Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)
committerAkash Bagdia <akash.bagdia@arm.com>
Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)
This patch adds a 'sys_clock' command-line option and use it to assign
clocks to the system during instantiation.

As part of this change, the default clock in the System class is
removed and whenever a system is instantiated a system clock value
must be set. A default value is provided for the command-line option.

The configs and tests are updated accordingly.

33 files changed:
configs/common/Options.py
configs/example/fs.py
configs/example/memtest.py
configs/example/ruby_direct_test.py
configs/example/ruby_fs.py
configs/example/ruby_mem_test.py
configs/example/ruby_network_test.py
configs/example/ruby_random_test.py
configs/example/se.py
configs/splash2/cluster.py
configs/splash2/run.py
src/sim/System.py
tests/configs/base_config.py
tests/configs/inorder-timing.py
tests/configs/memtest-ruby.py
tests/configs/memtest.py
tests/configs/o3-timing-checker.py
tests/configs/o3-timing-mp-ruby.py
tests/configs/o3-timing-mp.py
tests/configs/o3-timing-ruby.py
tests/configs/o3-timing.py
tests/configs/rubytest-ruby.py
tests/configs/simple-atomic-dummychecker.py
tests/configs/simple-atomic-mp-ruby.py
tests/configs/simple-atomic-mp.py
tests/configs/simple-atomic.py
tests/configs/simple-timing-mp-ruby.py
tests/configs/simple-timing-mp.py
tests/configs/simple-timing-ruby.py
tests/configs/simple-timing.py
tests/configs/tgen-simple-dram.py
tests/configs/tgen-simple-mem.py
tests/configs/twosys-tsunami-simple-atomic.py

index 08881cf11921bfd86c5579310b0cf1de0a020e04..aa4d65ead68726eb566b0b24e1e0eeb6b0a013a3 100644 (file)
@@ -78,6 +78,10 @@ def addCommonOptions(parser):
     parser.add_option("--simpoint-interval", type="int", default=10000000,
                       help="SimPoint interval in num of instructions")
     parser.add_option("--clock", action="store", type="string", default='2GHz')
+    parser.add_option("--sys-clock", action="store", type="string",
+                      default='1GHz',
+                      help = """Top-level clock for blocks running at system
+                      speed""")
     parser.add_option("--cpu-clock", action="store", type="string",
                       default='2GHz',
                       help="Clock for blocks running at CPU speed")
index 31106cba7e89eebe60e88f851fdf27b4061deb05..cbcacd6d4be1a443c3642bfda8557b284d407e5e 100644 (file)
@@ -120,6 +120,8 @@ elif buildEnv['TARGET_ISA'] == "arm":
 else:
     fatal("Incapable of building %s full system!", buildEnv['TARGET_ISA'])
 
+test_sys.clock = options.sys_clock
+
 if options.kernel is not None:
     test_sys.kernel = binary(options.kernel)
 
@@ -172,6 +174,8 @@ if len(bm) == 2:
         drive_sys = makeArmSystem(drive_mem_mode, options.machine_type,
                                   DriveMemClass, bm[1])
 
+    drive_sys.clock = options.sys_clock
+
     drive_sys.cpu = DriveCPUClass(cpu_id=0)
     drive_sys.cpu.createThreads()
     drive_sys.cpu.createInterruptController()
index b29a612e9c1f4be5befe1704602bf95d709b8b5f..e8dc52fb522add832087cc5213fec9ca7d2329e0 100644 (file)
@@ -144,6 +144,7 @@ for scale in treespec[:-2]:
 system = System(funcmem = SimpleMemory(in_addr_map = False),
                 funcbus = NoncoherentBus(),
                 physmem = SimpleMemory(latency = "100ns"))
+system.clock = options.sys_clock
 
 def make_level(spec, prototypes, attach_obj, attach_port):
      fanout = spec[0]
index 170e774dc9bd7a82d917e135daf6ed5efe67a086..a607252305d9a7d8b43c3575a3c32a9f16dee9d5 100644 (file)
@@ -93,7 +93,7 @@ else:
 # M5 memory size == Ruby memory size checks
 #
 system = System(physmem = SimpleMemory())
-
+system.clock = options.sys_clock
 #
 # Create the ruby random tester
 #
index e6239caf4975bf6b9848753b6344f5e34fd36c30..403e55584f7a1528a40ec03098ae284559a62177 100644 (file)
@@ -93,6 +93,8 @@ elif buildEnv['TARGET_ISA'] == "x86":
 else:
     fatal("incapable of building non-alpha or non-x86 full system!")
 
+system.clock = options.sys_clock
+
 if options.kernel is not None:
     system.kernel = binary(options.kernel)
 
index 1d3e20412867f069b8d760e365336c14c0394801..14db9d40b50fd9ff35823eb4c2e8ed3ea2590408 100644 (file)
@@ -108,6 +108,7 @@ system = System(cpu = cpus,
                 funcmem = SimpleMemory(in_addr_map = False),
                 funcbus = NoncoherentBus(),
                 physmem = SimpleMemory())
+system.clock = options.sys_clock
 
 if options.num_dmas > 0:
     dmas = [ MemTest(atomic = False,
index 58e8b2e40caea5d2ba4e76e930423e7b339ab167..74bdd5504dd04caf1faeb85c01826e520015b420 100644 (file)
@@ -105,6 +105,7 @@ cpus = [ NetworkTest(fixed_pkts=options.fixed_pkts,
 # create the desired simulated system
 system = System(cpu = cpus,
                 physmem = SimpleMemory())
+system.clock = options.sys_clock
 
 Ruby.create_system(options, system)
 
index 3f6bd72e208fc4c970dc0d15ef688fad21415592..646863e88e0dfad9379063c4ef4bca7dd7830548 100644 (file)
@@ -98,6 +98,7 @@ tester = RubyTester(check_flush = check_flush,
 # M5 memory size == Ruby memory size checks
 #
 system = System(tester = tester, physmem = SimpleMemory())
+system.clock = options.sys_clock
 
 Ruby.create_system(options, system)
 
index 000390080066d98ee8e46dbae59c875d861fc17b..3ff3f0c7de132d20b66210504e2eb4d5d2adc25f 100644 (file)
@@ -160,6 +160,7 @@ np = options.num_cpus
 system = System(cpu = [CPUClass(cpu_id=i) for i in xrange(np)],
                 physmem = MemClass(range=AddrRange("512MB")),
                 mem_mode = test_mem_mode)
+system.clock = options.sys_clock
 
 # Sanity check
 if options.fastmem:
index d7e32a41460513a4f858f0021f1a61ce1a5c91b7..1b9397d6d187445bef5c4f37fbc675bb208679fc 100644 (file)
@@ -214,6 +214,7 @@ else:
 system = System(cpu = all_cpus, l1_ = all_l1s, l1bus_ = all_l1buses,
                 physmem = SimpleMemory(),
                 membus = CoherentBus(clock = busFrequency))
+system.clock = '1GHz'
 
 system.toL2bus = CoherentBus(clock = busFrequency)
 system.l2 = L2(size = options.l2size, assoc = 8)
index 48e255c52ea78c52785aa16cfbdae7650be5ad92..6880f8db54ff49656a23404adfc4a47ebd4aa47c 100644 (file)
@@ -199,6 +199,7 @@ else:
 # ----------------------
 system = System(cpu = cpus, physmem = SimpleMemory(),
                 membus = CoherentBus(clock = busFrequency))
+system.clock = '1GHz'
 
 system.toL2bus = CoherentBus(clock = busFrequency)
 system.l2 = L2(size = options.l2size, assoc = 8)
index 031331375c2494316222669b1d9331f58fd4f18e..2cc1718814d98f72de4b3c587143a7da6ddf4025 100644 (file)
@@ -43,12 +43,6 @@ class System(MemObject):
     cxx_header = "sim/system.hh"
     system_port = MasterPort("System port")
 
-    # Override the clock from the ClockedObject which looks at the
-    # parent clock by default. The 1 GHz default system clock serves
-    # as a start for the modules that rely on the parent to provide
-    # the clock.
-    clock = '1GHz'
-
     @classmethod
     def export_method_cxx_predecls(cls, code):
         code('#include "sim/system.hh"')
index 60ba3166577dbbfee1c22c7678d536ab8c7da252..a4b3969ef05c6a3cb30ac10dc7a135b8d9a7f073 100644 (file)
@@ -131,6 +131,7 @@ class BaseSystem(object):
         Arguments:
           system -- System to initialize.
         """
+        system.clock = '1GHz'
         system.cpu = self.create_cpus()
 
         if _have_kvm_support and \
index b19014328cf3512b0aeef3ce8f89bd3aa156ca85..30e12f7774c6cf9681efedc4f35a431379245308 100644 (file)
@@ -42,6 +42,7 @@ system = System(cpu = cpu,
                 physmem = DDR3_1600_x64(),
                 membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 system.system_port = system.membus.slave
 system.physmem.port = system.membus.master
 # create the interrupt controller
index a252bc8813a94517add515f85cc62bc05866c39f..dbd1082d10ca9278f3692b84b6b5a20f38bf56e8 100644 (file)
@@ -81,6 +81,7 @@ system = System(cpu = cpus,
                 funcmem = SimpleMemory(in_addr_map = False),
                 physmem = SimpleMemory(null = True),
                 funcbus = NoncoherentBus())
+system.clock = options.sys_clock
 
 Ruby.create_system(options, system)
 
index 379b1e4217cab4417619583ef827f5a55d8c98bb..efaae61330b1f64cd52a6585e83762d85d35742b 100644 (file)
@@ -40,6 +40,7 @@ system = System(cpu = cpus, funcmem = SimpleMemory(in_addr_map = False),
                 funcbus = NoncoherentBus(),
                 physmem = SimpleMemory(),
                 membus = CoherentBus(width=16))
+system.clock = '1GHz'
 
 # l2cache & bus
 system.toL2Bus = CoherentBus(clock="2GHz", width=16)
index 84fcb0f83aac032b891c54e65e8f1e38816b34cc..14948fc87f4347b73524da6e965e462980c5d87d 100644 (file)
@@ -55,6 +55,7 @@ system = System(cpu = cpu,
                 physmem = DDR3_1600_x64(),
                 membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 system.system_port = system.membus.slave
 system.physmem.port = system.membus.master
 cpu.connectAllPorts(system.membus)
index 126e71ed570c8df11d31de8996a8b5c5d3227854..0060689b8d124dae201bf71151e909fd2ac84fef 100644 (file)
@@ -40,6 +40,7 @@ ruby_memory = ruby_config.generate("TwoLevel_SplitL1UnifiedL2.rb", nb_cores)
 # system simulated
 system = System(cpu = cpus, physmem = ruby_memory, membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 
 for cpu in cpus:
     # create the interrupt controller
index b7401f6293300f2ef2110e59b5bafd6136ff4887..9b4f362e76298db8776853c71cbf1ccee27df440 100644 (file)
@@ -39,6 +39,7 @@ system = System(cpu = cpus,
                 physmem = DDR3_1600_x64(),
                 membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 
 # l2cache & bus
 system.toL2Bus = CoherentBus(clock = '2GHz')
index 26dbb000b3eecd0d933c030a6cce95fbc400a952..22e1047a397a65ec152cd5f14384d1d69a1c6a83 100644 (file)
@@ -42,6 +42,7 @@ system = System(cpu = cpu,
                 physmem = ruby_memory,
                 membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 system.physmem.port = system.membus.master
 # create the interrupt controller
 cpu.createInterruptController()
index a370beef468efc23b8174740321be85ff074d2db..2be0556a69ef97ccced0a0dbafb2b8f78be4bd35 100644 (file)
@@ -44,6 +44,7 @@ system = System(cpu = cpu,
                 physmem = DDR3_1600_x64(),
                 membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 system.system_port = system.membus.slave
 system.physmem.port = system.membus.master
 # create the interrupt controller
index 861205accff7ff071a6c9a4d8448a661a79797cc..328337190a44e7e131c70ea8aa31ad243bba8ab4 100644 (file)
@@ -78,6 +78,7 @@ tester = RubyTester(check_flush = check_flush, checks_to_complete = 100,
                     wakeup_frequency = 10, num_cpus = options.num_cpus)
 
 system = System(tester = tester, physmem = SimpleMemory(null = True))
+system.clock = options.sys_clock
 
 Ruby.create_system(options, system)
 
index 5192afb1c3ec1e605f9b7b2681f7b5b0d0228048..d285014037a4331b680b7cc7f7ce516db57d790f 100644 (file)
@@ -41,6 +41,7 @@ from m5.objects import *
 system = System(cpu = AtomicSimpleCPU(cpu_id=0),
                 physmem = SimpleMemory(),
                 membus = CoherentBus())
+system.clock = '1GHz'
 system.system_port = system.membus.slave
 system.physmem.port = system.membus.master
 system.cpu.addCheckerCpu()
index 9cb3f9eb487b1b6d1cbf63001083204a1db37e6d..12c26d97b0c10c8586988cd040f528b1663f9068 100644 (file)
@@ -39,6 +39,7 @@ ruby_memory = ruby_config.generate("TwoLevel_SplitL1UnifiedL2.rb", nb_cores)
 
 # system simulated
 system = System(cpu = cpus, physmem = ruby_memory, membus = CoherentBus())
+system.clock = '1GHz'
 
 # add L1 caches
 for cpu in cpus:
index 0324bcc04a29d4f503f48557e694dae7f87cc1a5..d43371eb557d26f34187c947f3fe4496dd8766f1 100644 (file)
@@ -38,7 +38,7 @@ cpus = [ AtomicSimpleCPU(cpu_id=i) for i in xrange(nb_cores) ]
 system = System(cpu = cpus,
                 physmem = SimpleMemory(range = AddrRange('1024MB')),
                 membus = CoherentBus())
-
+system.clock = '1GHz'
 # l2cache & bus
 system.toL2Bus = CoherentBus(clock = '2GHz')
 system.l2c = L2Cache(clock = '2GHz', size='4MB', assoc=8)
index 3b81d97696669453849a4499b18c6c89eb402576..b9baba1645a79fd22339286f70357e6a091e0a38 100644 (file)
@@ -32,6 +32,7 @@ from m5.objects import *
 system = System(cpu = AtomicSimpleCPU(cpu_id=0),
                 physmem = SimpleMemory(),
                 membus = CoherentBus())
+system.clock = '1GHz'
 system.system_port = system.membus.slave
 system.physmem.port = system.membus.master
 # create the interrupt controller
index 6e3489fa8db548e6e613a9fe67e569feb9fba335..2fa314d09b23c9bbe8db4567aa2dbea06bc74383 100644 (file)
@@ -72,6 +72,7 @@ options.num_cpus = nb_cores
 
 # system simulated
 system = System(cpu = cpus, physmem = SimpleMemory())
+system.clock = options.sys_clock
 
 Ruby.create_system(options, system)
 
index aad15a2ac0ffbf8bea226494a9678953192af5f0..1acfacbdf9b267c04d56af705887b15416ea629f 100644 (file)
@@ -36,6 +36,7 @@ cpus = [ TimingSimpleCPU(cpu_id=i) for i in xrange(nb_cores) ]
 
 # system simulated
 system = System(cpu = cpus, physmem = SimpleMemory(), membus = CoherentBus())
+system.clock = '1GHz'
 
 # l2cache & bus
 system.toL2Bus = CoherentBus(clock = '2GHz')
index 41b4fdb1fcd7f12d9dc2787abe5f33fcd814d848..9057475a5e905ad7aa2c724b6f662e0b6c1b46e6 100644 (file)
@@ -68,6 +68,7 @@ options.num_cpus = 1
 
 cpu = TimingSimpleCPU(cpu_id=0)
 system = System(cpu = cpu, physmem = SimpleMemory(null = True))
+system.clock = options.sys_clock
 
 Ruby.create_system(options, system)
 
index b366f01e5b384ea5d6fe3dbe04f1e3b771c6c24f..046ee96ddab26d603c1954fa45cda1880ddb1fe1 100644 (file)
@@ -39,6 +39,7 @@ system = System(cpu = cpu,
                 physmem = SimpleMemory(),
                 membus = CoherentBus(),
                 mem_mode = "timing")
+system.clock = '1GHz'
 system.system_port = system.membus.slave
 system.physmem.port = system.membus.master
 # create the interrupt controller
index b57817c95e78b037e095cea4c5ac283bdba01641..a79b65d43862f4ef7671149c9371ad1b8bb0c95b 100644 (file)
@@ -50,6 +50,7 @@ cpu = TrafficGen(config_file = "tests/quick/se/70.tgen/tgen-simple-dram.cfg")
 # system simulated
 system = System(cpu = cpu, physmem = DDR3_1600_x64(),
                 membus = NoncoherentBus(width = 16))
+system.clock = '1GHz'
 
 # add a communication monitor
 system.monitor = CommMonitor()
index 200834ec3e6a905a5e329539759621b924b26eba..b93165f509dc8dc09cbc06453511e59468df7e52 100644 (file)
@@ -50,6 +50,7 @@ cpu = TrafficGen(config_file = "tests/quick/se/70.tgen/tgen-simple-mem.cfg")
 # system simulated
 system = System(cpu = cpu, physmem = SimpleMemory(),
                 membus = NoncoherentBus(width = 16))
+system.clock = '1GHz'
 
 # add a communication monitor, and also trace all the packets
 system.monitor = CommMonitor(trace_file = "monitor.ptrc.gz")
index 484236fae724591ac2e76d3c95539767368c1585..8025b4e7b0bbe881edbaa5bd74bf9e8ad2d28458 100644 (file)
@@ -34,6 +34,7 @@ from Benchmarks import *
 
 test_sys = makeLinuxAlphaSystem('atomic', SimpleMemory,
                                  SysConfig('netperf-stream-client.rcS'))
+test_sys.clock = '1GHz'
 test_sys.cpu = AtomicSimpleCPU(cpu_id=0)
 # create the interrupt controller
 test_sys.cpu.createInterruptController()
@@ -48,6 +49,7 @@ test_sys.iobridge.master = test_sys.membus.slave
 
 drive_sys = makeLinuxAlphaSystem('atomic', SimpleMemory,
                                  SysConfig('netperf-server.rcS'))
+drive_sys.clock = '1GHz'
 drive_sys.cpu = AtomicSimpleCPU(cpu_id=0)
 # create the interrupt controller
 drive_sys.cpu.createInterruptController()