SConscript revision 2155
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
294762Snate@binkert.orgimport os
30955SN/Aimport os.path
315522Snate@binkert.org
326143Snate@binkert.org# Import build environment variable from SConstruct.
334762Snate@binkert.orgImport('env')
345522Snate@binkert.org
35955SN/Amodels_db = File('cpu_models.py')
365522Snate@binkert.orgexecfile(models_db.srcnode().abspath)
37955SN/A
385522Snate@binkert.orgexec_sig_template = '''
394202Sbinkertn@umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
405742Snate@binkert.org'''
41955SN/A
424381Sbinkertn@umich.edudef gen_cpu_exec_signatures(target, source, env):
434381Sbinkertn@umich.edu    f = open(str(target[0]), 'w')
44955SN/A    print >> f, '''
45955SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
46955SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__
474202Sbinkertn@umich.edu'''
48955SN/A    for cpu in env['CPU_MODELS']:
494382Sbinkertn@umich.edu        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
504382Sbinkertn@umich.edu        print >> f, exec_sig_template % xc_type
514382Sbinkertn@umich.edu    print >> f, '''
526654Snate@binkert.org#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
535517Snate@binkert.org'''
546143Snate@binkert.org
556143Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', models_db, gen_cpu_exec_signatures)
566143Snate@binkert.org
576143Snate@binkert.orgsources = []
586143Snate@binkert.org
596143Snate@binkert.orgif 'SimpleCPU' in env['CPU_MODELS']:
606143Snate@binkert.org    sources += Split('simple/cpu.cc')
616143Snate@binkert.org
626143Snate@binkert.orgif 'FastCPU' in env['CPU_MODELS']:
636143Snate@binkert.org    sources += Split('fast/cpu.cc')
646143Snate@binkert.org
656143Snate@binkert.orgif 'AlphaFullCPU' in env['CPU_MODELS']:
666143Snate@binkert.org    sources += Split('''
676143Snate@binkert.org        o3/2bit_local_pred.cc
686143Snate@binkert.org        o3/alpha_dyn_inst.cc
694762Snate@binkert.org        o3/alpha_cpu.cc
706143Snate@binkert.org        o3/alpha_cpu_builder.cc
716143Snate@binkert.org        o3/bpred_unit.cc
726143Snate@binkert.org        o3/btb.cc
736143Snate@binkert.org        o3/commit.cc
746143Snate@binkert.org        o3/decode.cc
756143Snate@binkert.org        o3/fetch.cc
766143Snate@binkert.org        o3/free_list.cc
776143Snate@binkert.org        o3/cpu.cc
786143Snate@binkert.org        o3/iew.cc
796143Snate@binkert.org        o3/inst_queue.cc
806143Snate@binkert.org        o3/ldstq.cc
816143Snate@binkert.org        o3/mem_dep_unit.cc
826143Snate@binkert.org        o3/ras.cc
836143Snate@binkert.org        o3/rename.cc
846143Snate@binkert.org        o3/rename_map.cc
856143Snate@binkert.org        o3/rob.cc
866143Snate@binkert.org        o3/sat_counter.cc
876143Snate@binkert.org        o3/store_set.cc
886143Snate@binkert.org        o3/tournament_pred.cc
896143Snate@binkert.org        ''')
906143Snate@binkert.org
917065Snate@binkert.org# FullCPU sources are included from m5/SConscript since they're not
926143Snate@binkert.org# below this point in the file hierarchy.
936143Snate@binkert.org
946143Snate@binkert.org# Convert file names to SCons File objects.  This takes care of the
956143Snate@binkert.org# path relative to the top of the directory tree.
966143Snate@binkert.orgsources = [File(s) for s in sources]
976143Snate@binkert.org
986143Snate@binkert.orgReturn('sources')
996143Snate@binkert.org
1006143Snate@binkert.org