SConscript revision 2171
1# -*- mode:python -*-
2
3# Copyright (c) 2006 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer;
10# redistributions in binary form must reproduce the above copyright
11# notice, this list of conditions and the following disclaimer in the
12# documentation and/or other materials provided with the distribution;
13# neither the name of the copyright holders nor the names of its
14# contributors may be used to endorse or promote products derived from
15# this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29import os
30import os.path
31
32# Import build environment variable from SConstruct.
33Import('env')
34
35models_db = File('cpu_models.py')
36execfile(models_db.srcnode().abspath)
37
38exec_sig_template = '''
39virtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
40'''
41
42def gen_cpu_exec_signatures(target, source, env):
43    f = open(str(target[0]), 'w')
44    print >> f, '''
45#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
46#define __CPU_STATIC_INST_EXEC_SIGS_HH__
47'''
48    for cpu in env['CPU_MODELS']:
49        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
50        print >> f, exec_sig_template % xc_type
51    print >> f, '''
52#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
53'''
54
55env.Command('static_inst_exec_sigs.hh', models_db, gen_cpu_exec_signatures)
56
57sources = []
58
59if 'SimpleCPU' in env['CPU_MODELS']:
60    sources += Split('simple/cpu.cc')
61
62if 'FastCPU' in env['CPU_MODELS']:
63    sources += Split('fast/cpu.cc')
64
65if 'AlphaFullCPU' in env['CPU_MODELS']:
66    sources += Split('''
67        o3/2bit_local_pred.cc
68        o3/alpha_dyn_inst.cc
69        o3/alpha_cpu.cc
70        o3/alpha_cpu_builder.cc
71        o3/bpred_unit.cc
72        o3/btb.cc
73        o3/commit.cc
74        o3/decode.cc
75        o3/fetch.cc
76        o3/free_list.cc
77        o3/cpu.cc
78        o3/iew.cc
79        o3/inst_queue.cc
80        o3/ldstq.cc
81        o3/mem_dep_unit.cc
82        o3/ras.cc
83        o3/rename.cc
84        o3/rename_map.cc
85        o3/rob.cc
86        o3/sat_counter.cc
87        o3/store_set.cc
88        o3/tournament_pred.cc
89        ''')
90
91# FullCPU sources are included from m5/SConscript since they're not
92# below this point in the file hierarchy.
93
94# Convert file names to SCons File objects.  This takes care of the
95# path relative to the top of the directory tree.
96sources = [File(s) for s in sources]
97
98Return('sources')
99
100