diff options
Diffstat (limited to 'configs/example/fs.py')
-rw-r--r-- | configs/example/fs.py | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/configs/example/fs.py b/configs/example/fs.py index 460fb68fb..a5b8772af 100644 --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -42,6 +42,8 @@ parser = optparse.OptionParser() parser.add_option("-d", "--detailed", action="store_true") parser.add_option("-t", "--timing", action="store_true") +parser.add_option("-n", "--num_cpus", type="int", default=1) +parser.add_option("--caches", action="store_true") parser.add_option("-m", "--maxtick", type="int") parser.add_option("--maxtime", type="float") parser.add_option("--dual", action="store_true", @@ -64,53 +66,63 @@ if args: print "Error: script doesn't take any positional arguments" sys.exit(1) +class MyCache(BaseCache): + assoc = 2 + block_size = 64 + latency = 1 + mshrs = 10 + tgts_per_mshr = 5 + protocol = CoherenceProtocol(protocol='moesi') + +# client system CPU is always simple... note this is an assignment of +# a class, not an instance. +ClientCPUClass = AtomicSimpleCPU +client_mem_mode = 'atomic' + if options.detailed: - cpu = DerivO3CPU() - cpu2 = DerivO3CPU() - mem_mode = 'timing' + ServerCPUClass = DerivO3CPU + server_mem_mode = 'timing' elif options.timing: - cpu = TimingSimpleCPU() - cpu2 = TimingSimpleCPU() - mem_mode = 'timing' + ServerCPUClass = TimingSimpleCPU + server_mem_mode = 'timing' else: - cpu = AtomicSimpleCPU() - cpu2 = AtomicSimpleCPU() - mem_mode = 'atomic' + ServerCPUClass = AtomicSimpleCPU + server_mem_mode = 'atomic' -cpu.clock = '2GHz' -cpu2.clock = '2GHz' -cpu.cpu_id = 0 -cpu2.cpu_id = 0 +ServerCPUClass.clock = '2GHz' +ClientCPUClass.clock = '2GHz' if options.benchmark: - if options.benchmark not in Benchmarks: + try: + bm = Benchmarks[options.benchmark] + except KeyError: print "Error benchmark %s has not been defined." % options.benchmark print "Valid benchmarks are: %s" % DefinedBenchmarks sys.exit(1) - - bm = Benchmarks[options.benchmark] else: if options.dual: - bm = [Machine(), Machine()] + bm = [SysConfig(), SysConfig()] else: - bm = [Machine()] + bm = [SysConfig()] + +server_sys = makeLinuxAlphaSystem(server_mem_mode, bm[0]) +np = options.num_cpus +server_sys.cpu = [ServerCPUClass(cpu_id=i) for i in xrange(np)] +for i in xrange(np): + if options.caches: + server_sys.cpu[i].addPrivateSplitL1Caches(MyCache(size = '32kB'), + MyCache(size = '64kB')) + server_sys.cpu[i].connectMemPorts(server_sys.membus) + server_sys.cpu[i].mem = server_sys.physmem if len(bm) == 2: - s1 = makeLinuxAlphaSystem(mem_mode, bm[0]) - s1.cpu = cpu - cpu.connectMemPorts(s1.membus) - cpu.mem = s1.physmem - s2 = makeLinuxAlphaSystem(mem_mode, bm[1]) - s2.cpu = cpu2 - cpu2.connectMemPorts(s2.membus) - cpu2.mem = s2.physmem - root = makeDualRoot(s1, s2, options.etherdump) + client_sys = makeLinuxAlphaSystem(client_mem_mode, bm[1]) + client_sys.cpu = ClientCPUClass(cpu_id=0) + client_sys.cpu.connectMemPorts(client_sys.membus) + client_sys.cpu.mem = client_sys.physmem + root = makeDualRoot(server_sys, client_sys, options.etherdump) elif len(bm) == 1: - root = Root(clock = '1THz', - system = makeLinuxAlphaSystem(mem_mode, bm[0])) - root.system.cpu = cpu - cpu.connectMemPorts(root.system.membus) - cpu.mem = root.system.physmem + root = Root(clock = '1THz', system = server_sys) else: print "Error I don't know how to create more than 2 systems." sys.exit(1) |