SConscript revision 2178
1955SN/A# -*- mode:python -*-
2955SN/A
31762SN/A# Copyright (c) 2006 The Regents of The University of Michigan
4955SN/A# All rights reserved.
5955SN/A#
6955SN/A# Redistribution and use in source and binary forms, with or without
7955SN/A# modification, are permitted provided that the following conditions are
8955SN/A# met: redistributions of source code must retain the above copyright
9955SN/A# notice, this list of conditions and the following disclaimer;
10955SN/A# redistributions in binary form must reproduce the above copyright
11955SN/A# notice, this list of conditions and the following disclaimer in the
12955SN/A# documentation and/or other materials provided with the distribution;
13955SN/A# neither the name of the copyright holders nor the names of its
14955SN/A# contributors may be used to endorse or promote products derived from
15955SN/A# this software without specific prior written permission.
16955SN/A#
17955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27955SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu
292665Ssaidi@eecs.umich.eduimport os
30955SN/Aimport os.path
31955SN/A
32955SN/A# Import build environment variable from SConstruct.
331608SN/AImport('env')
34955SN/A
35955SN/A#################################################################
36955SN/A#
37955SN/A# Generate StaticInst execute() method signatures.
38955SN/A#
39955SN/A# There must be one signature for each CPU model compiled in.
40955SN/A# Since the set of compiled-in models is flexible, we generate a
41955SN/A# header containing the appropriate set of signatures on the fly.
42955SN/A#
43955SN/A#################################################################
44955SN/A
45955SN/A# CPU model-specific data is contained in cpu_models.py
46955SN/A# Convert to SCons File node to get path handling
47955SN/Amodels_db = File('cpu_models.py')
482023SN/A# slurp in contents of file
49955SN/Aexecfile(models_db.srcnode().abspath)
50955SN/A
51955SN/A# Template for execute() signature.
52955SN/Aexec_sig_template = '''
53955SN/Avirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
54955SN/A'''
55955SN/A
56955SN/A# Generate header.  
57955SN/Adef gen_cpu_exec_signatures(target, source, env):
581031SN/A    f = open(str(target[0]), 'w')
59955SN/A    print >> f, '''
601388SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
61955SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__
62955SN/A'''
631296SN/A    for cpu in env['CPU_MODELS']:
64955SN/A        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
652609SN/A        print >> f, exec_sig_template % xc_type
66955SN/A    print >> f, '''
67955SN/A#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
68955SN/A'''
69955SN/A
70955SN/A# Generate string that gets printed when header is rebuilt
71955SN/Adef gen_sigs_string(target, source, env):
72955SN/A    return "Generating static_inst_exec_sigs.hh: " \
73955SN/A           + ', '.join(env['CPU_MODELS'])
74955SN/A
75955SN/A# Add command to generate header to environment.
76955SN/Aenv.Command('static_inst_exec_sigs.hh', models_db,
77955SN/A            Action(gen_cpu_exec_signatures, gen_sigs_string,
78955SN/A                   varlist = ['CPU_MODELS']))
79955SN/A
80955SN/A#################################################################
81955SN/A#
82955SN/A# Include CPU-model-specific files based on set of models
83955SN/A# specified in CPU_MODELS build option.
842325SN/A#
851717SN/A#################################################################
862652Ssaidi@eecs.umich.edu
87955SN/Asources = []
882736Sktlim@umich.edu
892410SN/Aif 'SimpleCPU' in env['CPU_MODELS']:
90955SN/A    sources += Split('simple/cpu.cc')
912290SN/A
92955SN/Aif 'FastCPU' in env['CPU_MODELS']:
931717SN/A    sources += Split('fast/cpu.cc')
942683Sktlim@umich.edu
952683Sktlim@umich.eduif 'AlphaFullCPU' in env['CPU_MODELS']:
962669Sktlim@umich.edu    sources += Split('''
972568SN/A        o3/2bit_local_pred.cc
982568SN/A        o3/alpha_dyn_inst.cc
992462SN/A        o3/alpha_cpu.cc
1002568SN/A        o3/alpha_cpu_builder.cc
1012395SN/A        o3/bpred_unit.cc
1022405SN/A        o3/btb.cc
103955SN/A        o3/commit.cc
1042811Srdreslin@umich.edu        o3/decode.cc
1052811Srdreslin@umich.edu        o3/fetch.cc
1062811Srdreslin@umich.edu        o3/free_list.cc
1072811Srdreslin@umich.edu        o3/cpu.cc
1082811Srdreslin@umich.edu        o3/iew.cc
1092811Srdreslin@umich.edu        o3/inst_queue.cc
1102811Srdreslin@umich.edu        o3/ldstq.cc
1112811Srdreslin@umich.edu        o3/mem_dep_unit.cc
1122811Srdreslin@umich.edu        o3/ras.cc
1132811Srdreslin@umich.edu        o3/rename.cc
1142811Srdreslin@umich.edu        o3/rename_map.cc
1152811Srdreslin@umich.edu        o3/rob.cc
1162811Srdreslin@umich.edu        o3/sat_counter.cc
1172811Srdreslin@umich.edu        o3/store_set.cc
1182811Srdreslin@umich.edu        o3/tournament_pred.cc
1192811Srdreslin@umich.edu        ''')
1202814Srdreslin@umich.edu
1212811Srdreslin@umich.edu# FullCPU sources are included from m5/SConscript since they're not
1222811Srdreslin@umich.edu# below this point in the file hierarchy.
1232811Srdreslin@umich.edu
1242811Srdreslin@umich.edu# Convert file names to SCons File objects.  This takes care of the
1252811Srdreslin@umich.edu# path relative to the top of the directory tree.
1262811Srdreslin@umich.edusources = [File(s) for s in sources]
1272811Srdreslin@umich.edu
1282813Srdreslin@umich.eduReturn('sources')
1292813Srdreslin@umich.edu
130955SN/A