configs: Fix baremetal platform
[gem5.git] / configs / common / cpu2000.py
index 7dc7a7afee51b9e461a1419a28b1d74317aa8706..730a478783d6df722953b6002742f655ce952db5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 The Regents of The University of Michigan
+# Copyright (c) 2006-2008 The Regents of The University of Michigan
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 #
 # Authors: Nathan Binkert
 
+from __future__ import print_function
+from __future__ import absolute_import
+
 import os
 import sys
 from os.path import basename, exists, join as joinpath, normpath
 from os.path import isdir, isfile, islink
 
-spec_dist = '/dist/m5/cpu2000'
+spec_dist = os.environ.get('M5_CPU2000', '/dist/m5/cpu2000')
 
 def copyfiles(srcdir, dstdir):
     from filecmp import cmp as filecmp
@@ -85,16 +88,19 @@ class Benchmark(object):
         if not hasattr(self.__class__, 'output'):
             self.output = '%s.out' % self.name
 
+        if not hasattr(self.__class__, 'simpoint'):
+            self.simpoint = None
+
         try:
             func = getattr(self.__class__, input_set)
         except AttributeError:
-            raise AttributeError, \
-                  'The benchmark %s does not have the %s input set' % \
-                  (self.name, input_set)
+            raise AttributeError(
+                'The benchmark %s does not have the %s input set' % \
+                (self.name, input_set))
 
         executable = joinpath(spec_dist, 'binaries', isa, os, self.binary)
         if not isfile(executable):
-            raise AttributeError, '%s not found' % executable
+            raise AttributeError('%s not found' % executable)
         self.executable = executable
 
         # root of tree for input & output data files
@@ -104,9 +110,11 @@ class Benchmark(object):
         # dirs for input & output files for this input set
         inputs_dir = joinpath(data_dir, input_set, 'input')
         outputs_dir = joinpath(data_dir, input_set, 'output')
+        # keep around which input set was specified
+        self.input_set = input_set
 
         if not isdir(inputs_dir):
-            raise AttributeError, '%s not found' % inputs_dir
+            raise AttributeError('%s not found' % inputs_dir)
 
         self.inputs_dir = [ inputs_dir ]
         if isdir(all_dir):
@@ -126,29 +134,31 @@ class Benchmark(object):
 
         func(self, isa, os)
 
-    def makeLiveProcessArgs(self, **kwargs):
-        # set up default args for LiveProcess object
+    def makeProcessArgs(self, **kwargs):
+        # set up default args for Process object
         process_args = {}
-        process_args['cmd'] = self.name + ' ' + ' '.join(self.args)
+        process_args['cmd'] = [ self.name ] + self.args
         process_args['executable'] = self.executable
         if self.stdin:
             process_args['input'] = self.stdin
         if self.stdout:
             process_args['output'] = self.stdout
-
+        if self.simpoint:
+            process_args['simpoint'] = self.simpoint
         # explicit keywords override defaults
         process_args.update(kwargs)
 
         return process_args
 
-    def makeLiveProcess(self, **kwargs):
-        process_args = self.makeLiveProcessArgs(**kwargs)
+    def makeProcess(self, **kwargs):
+        process_args = self.makeProcessArgs(**kwargs)
 
         # figure out working directory: use m5's outdir unless
-        # overridden by LiveProcess's cwd param
+        # overridden by Process's cwd param
         cwd = process_args.get('cwd')
+
         if not cwd:
-            from m5.main import options
+            from m5 import options
             cwd = options.outdir
             process_args['cwd'] = cwd
         if not isdir(cwd):
@@ -156,9 +166,9 @@ class Benchmark(object):
         # copy input files to working directory
         for d in self.inputs_dir:
             copyfiles(d, cwd)
-        # generate LiveProcess object
-        from m5.objects import LiveProcess
-        return LiveProcess(**process_args)
+        # generate Process object
+        from m5.objects import Process
+        return Process(**process_args)
 
     def __str__(self):
         return self.name
@@ -177,16 +187,19 @@ class ammp(MinneDefaultBenchmark):
     name = 'ammp'
     number = 188
     lang = 'C'
+    simpoint = 108*100E6
 
 class applu(MinneDefaultBenchmark):
     name = 'applu'
     number = 173
     lang = 'F77'
+    simpoint = 2179*100E6
 
 class apsi(MinneDefaultBenchmark):
     name = 'apsi'
     number = 301
     lang = 'F77'
+    simpoint = 3408*100E6
 
 class art(DefaultBenchmark):
     name = 'art'
@@ -239,6 +252,7 @@ class art110(art):
                       '-endy', '240',
                       '-objects', '10' ]
         self.output = 'ref.1.out'
+        self.simpoint = 340*100E6
 
 class art470(art):
     def ref(self, isa, os):
@@ -252,11 +266,13 @@ class art470(art):
                       '-endy', '180',
                       '-objects', '10' ]
         self.output = 'ref.2.out'
+        self.simpoint = 365*100E6
 
 class equake(DefaultBenchmark):
     name = 'equake'
     number = 183
     lang = 'C'
+    simpoint = 812*100E6
 
     def lgred(self, isa, os): pass
 
@@ -264,21 +280,25 @@ class facerec(MinneDefaultBenchmark):
     name = 'facerec'
     number = 187
     lang = 'F'
+    simpoint = 375*100E6
 
 class fma3d(MinneDefaultBenchmark):
     name = 'fma3d'
     number = 191
     lang = 'F'
+    simpoint = 2541*100E6
 
 class galgel(MinneDefaultBenchmark):
     name = 'galgel'
     number = 178
     lang = 'F'
+    simpoint = 2491*100E6
 
 class lucas(MinneDefaultBenchmark):
     name = 'lucas'
     number = 189
     lang = 'F'
+    simpoint = 545*100E6
 
 class mesa(Benchmark):
     name = 'mesa'
@@ -298,6 +318,7 @@ class mesa(Benchmark):
 
     def ref(self, isa, os):
         self.__set_args('1000')
+        self.simpoint = 1135*100E6
 
     def lgred(self, isa, os):
         self.__set_args('1')
@@ -306,11 +327,13 @@ class mgrid(MinneDefaultBenchmark):
     name = 'mgrid'
     number = 172
     lang = 'F77'
+    simpoint = 3292*100E6
 
 class sixtrack(DefaultBenchmark):
     name = 'sixtrack'
     number = 200
     lang = 'F77'
+    simpoint = 3043*100E6
 
     def lgred(self, isa, os): pass
 
@@ -318,11 +341,13 @@ class swim(MinneDefaultBenchmark):
     name = 'swim'
     number = 171
     lang = 'F77'
+    simpoint = 2079*100E6
 
 class wupwise(DefaultBenchmark):
     name = 'wupwise'
     number = 168
     lang = 'F77'
+    simpoint = 3237*100E6
 
     def lgred(self, isa, os): pass
 
@@ -339,6 +364,7 @@ class bzip2(DefaultBenchmark):
 
 class bzip2_source(bzip2):
     def ref(self, isa, os):
+        self.simpoint = 977*100E6
         self.args = [ 'input.source', '58' ]
 
     def lgred(self, isa, os):
@@ -346,6 +372,7 @@ class bzip2_source(bzip2):
 
 class bzip2_graphic(bzip2):
     def ref(self, isa, os):
+        self.simpoint = 718*100E6
         self.args = [ 'input.graphic', '58' ]
 
     def lgred(self, isa, os):
@@ -353,6 +380,7 @@ class bzip2_graphic(bzip2):
 
 class bzip2_program(bzip2):
     def ref(self, isa, os):
+        self.simpoint = 458*100E6
         self.args = [ 'input.program', '58' ]
 
     def lgred(self, isa, os):
@@ -362,6 +390,7 @@ class crafty(MinneDefaultBenchmark):
     name = 'crafty'
     number = 186
     lang = 'C'
+    simpoint = 774*100E6
 
 class eon(MinneDefaultBenchmark):
     name = 'eon'
@@ -384,6 +413,7 @@ class eon_rushmeier(eon):
     args = [ 'chair.control.rushmeier', 'chair.camera', 'chair.surfaces',
              'chair.rushmeier.ppm', 'ppm', 'pixels_out.rushmeier' ]
     output = 'rushmeier_log.out'
+    simpoint = 403*100E6
 
 class gap(DefaultBenchmark):
     name = 'gap'
@@ -401,6 +431,7 @@ class gap(DefaultBenchmark):
 
     def ref(self, isa, os):
         self.__set_args('192M')
+        self.simpoint = 674*100E6
 
     def lgred(self, isa, os):
         self.__set_args('64M')
@@ -433,22 +464,27 @@ class gcc(DefaultBenchmark):
 
 class gcc_166(gcc):
     def ref(self, isa, os):
+        self.simpoint = 389*100E6
         self.args = [ '166.i', '-o', '166.s' ]
 
 class gcc_200(gcc):
     def ref(self, isa, os):
+        self.simpoint = 736*100E6
         self.args = [ '200.i', '-o', '200.s' ]
 
 class gcc_expr(gcc):
     def ref(self, isa, os):
+        self.simpoint = 36*100E6
         self.args = [ 'expr.i', '-o', 'expr.s' ]
 
 class gcc_integrate(gcc):
     def ref(self, isa, os):
+        self.simpoint = 4*100E6
         self.args = [ 'integrate.i', '-o', 'integrate.s' ]
 
 class gcc_scilab(gcc):
     def ref(self, isa, os):
+        self.simpoint = 207*100E6
         self.args = [ 'scilab.i', '-o', 'scilab.s' ]
 
 class gzip(DefaultBenchmark):
@@ -464,6 +500,7 @@ class gzip(DefaultBenchmark):
 
 class gzip_source(gzip):
     def ref(self, isa, os):
+        self.simpoint = 334*100E6
         self.args = [ 'input.source', '1' ]
     def smred(self, isa, os):
         self.args = [ 'input.source', '1' ]
@@ -474,6 +511,7 @@ class gzip_source(gzip):
 
 class gzip_log(gzip):
     def ref(self, isa, os):
+        self.simpoint = 265*100E6
         self.args = [ 'input.log', '60' ]
     def smred(self, isa, os):
         self.args = [ 'input.log', '1' ]
@@ -484,6 +522,7 @@ class gzip_log(gzip):
 
 class gzip_graphic(gzip):
     def ref(self, isa, os):
+        self.simpoint = 653*100E6
         self.args = [ 'input.graphic', '60' ]
     def smred(self, isa, os):
         self.args = [ 'input.graphic', '1' ]
@@ -494,6 +533,7 @@ class gzip_graphic(gzip):
 
 class gzip_random(gzip):
     def ref(self, isa, os):
+        self.simpoint = 623*100E6
         self.args = [ 'input.random', '60' ]
     def smred(self, isa, os):
         self.args = [ 'input.random', '1' ]
@@ -504,6 +544,7 @@ class gzip_random(gzip):
 
 class gzip_program(gzip):
     def ref(self, isa, os):
+        self.simpoint = 1189*100E6
         self.args = [ 'input.program', '60' ]
     def smred(self, isa, os):
         self.args = [ 'input.program', '1' ]
@@ -516,12 +557,15 @@ class mcf(MinneDefaultBenchmark):
     name = 'mcf'
     number = 181
     lang = 'C'
+    args = [ 'mcf.in' ]
+    simpoint = 553*100E6
 
 class parser(MinneDefaultBenchmark):
     name = 'parser'
     number = 197
     lang = 'C'
     args = [ '2.1.dict', '-batch' ]
+    simpoint = 1146*100E6
 
 class perlbmk(DefaultBenchmark):
     name = 'perlbmk'
@@ -534,6 +578,7 @@ class perlbmk(DefaultBenchmark):
 
 class perlbmk_diffmail(perlbmk):
     def ref(self, isa, os):
+        self.simpoint = 141*100E6
         self.args = [ '-I', 'lib', 'diffmail.pl', '2', '550', '15', '24',
                       '23', '100' ]
 
@@ -548,6 +593,7 @@ class perlbmk_scrabbl(perlbmk):
 
 class perlbmk_makerand(perlbmk):
     def ref(self, isa, os):
+        self.simpoint = 11*100E6
         self.args = [ '-I', 'lib',  'makerand.pl' ]
 
     def lgred(self, isa, os):
@@ -561,6 +607,7 @@ class perlbmk_makerand(perlbmk):
 
 class perlbmk_perfect(perlbmk):
     def ref(self, isa, os):
+        self.simpoint = 5*100E6
         self.args = [ '-I', 'lib',  'perfect.pl', 'b', '3', 'm', '4' ]
 
     def train(self, isa, os):
@@ -568,6 +615,7 @@ class perlbmk_perfect(perlbmk):
 
 class perlbmk_splitmail1(perlbmk):
     def ref(self, isa, os):
+        self.simpoint = 405*100E6
         self.args = [ '-I', 'lib', 'splitmail.pl', '850', '5', '19',
                       '18', '1500' ]
 
@@ -599,6 +647,7 @@ class twolf(Benchmark):
         self.args = [ 'train' ]
 
     def ref(self, isa, os):
+        self.simpoint = 1066*100E6
         self.args = [ 'ref' ]
 
     def smred(self, isa, os):
@@ -617,10 +666,12 @@ class vortex(Benchmark):
     stdin = None
 
     def __init__(self, isa, os, input_set):
-        if isa == 'alpha':
+        if (isa in ('alpha', 'arm', 'thumb', 'aarch64')):
             self.endian = 'lendian'
+        elif (isa == 'sparc' or isa == 'sparc32'):
+            self.endian = 'bendian'
         else:
-            raise AttributeError, "unknown ISA %s" % isa
+            raise AttributeError("unknown ISA %s" % isa)
 
         super(vortex, self).__init__(isa, os, input_set)
 
@@ -648,15 +699,18 @@ class vortex1(vortex):
     def ref(self, isa, os):
         self.args = [ '%s1.raw' % self.endian ]
         self.output = 'vortex1.out'
+        self.simpoint = 271*100E6
 
 
 class vortex2(vortex):
     def ref(self, isa, os):
+        self.simpoint = 1024*100E6
         self.args = [ '%s2.raw' % self.endian ]
         self.output = 'vortex2.out'
 
 class vortex3(vortex):
     def ref(self, isa, os):
+        self.simpoint = 564*100E6
         self.args = [ '%s3.raw' % self.endian ]
         self.output = 'vortex3.out'
 
@@ -673,13 +727,14 @@ class vpr_place(vpr):
     output = 'place_log.out'
 
 class vpr_route(vpr):
+    simpoint = 476*100E6
     args = [ 'net.in', 'arch.in', 'place.in', 'route.out', '-nodisp',
              '-route_only', '-route_chan_width', '15',
              '-pres_fac_mult', '2', '-acc_fac', '1',
              '-first_iter_pres_fac', '4', '-initial_pres_fac', '8' ]
     output = 'route_log.out'
 
-all = [ ammp, applu, apsi, art110, art470, equake, facerec, fma3d, galgel,
+all = [ ammp, applu, apsi, art, art110, art470, equake, facerec, fma3d, galgel,
         lucas, mesa, mgrid, sixtrack, swim, wupwise, bzip2_source,
         bzip2_graphic, bzip2_program, crafty, eon_kajiya, eon_cook,
         eon_rushmeier, gap, gcc_166, gcc_200, gcc_expr, gcc_integrate,
@@ -695,8 +750,8 @@ if __name__ == '__main__':
     from pprint import pprint
     for bench in all:
         for input_set in 'ref', 'test', 'train':
-            print 'class: %s' % bench.__name__
+            print('class: %s' % bench.__name__)
             x = bench('alpha', 'tru64', input_set)
-            print '%s: %s' % (x, input_set)
-            pprint(x.makeLiveProcessArgs())
-            print
+            print('%s: %s' % (x, input_set))
+            pprint(x.makeProcessArgs())
+            print()