SConscript revision 2632:1bb2f91485ea
1955SN/A# -*- mode:python -*-
2955SN/A
39812Sandreas.hansson@arm.com# Copyright (c) 2006 The Regents of The University of Michigan
49812Sandreas.hansson@arm.com# All rights reserved.
59812Sandreas.hansson@arm.com#
69812Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
79812Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
89812Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
99812Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
109812Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
119812Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
129812Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
139812Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
149812Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
157816Ssteve.reinhardt@amd.com# this software without specific prior written permission.
165871Snate@binkert.org#
171762SN/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.
28955SN/A
29955SN/Aimport os
30955SN/Aimport os.path
31955SN/A
32955SN/A# Import build environment variable from SConstruct.
33955SN/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.
422665Ssaidi@eecs.umich.edu#
432665Ssaidi@eecs.umich.edu#################################################################
445863Snate@binkert.org
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')
48955SN/A# slurp in contents of file
49955SN/Aexecfile(models_db.srcnode().abspath)
508878Ssteve.reinhardt@amd.com
512632Sstever@eecs.umich.edu# Template for execute() signature.
528878Ssteve.reinhardt@amd.comexec_sig_template = '''
532632Sstever@eecs.umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
54955SN/Avirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const
558878Ssteve.reinhardt@amd.com{ panic("initiateAcc not defined!"); };
562632Sstever@eecs.umich.eduvirtual Fault completeAcc(Packet *pkt, %s *xc,
572761Sstever@eecs.umich.edu                          Trace::InstRecord *traceData) const
582632Sstever@eecs.umich.edu{ panic("completeAcc not defined!"); };
592632Sstever@eecs.umich.edu'''
602632Sstever@eecs.umich.edu
612761Sstever@eecs.umich.edu# Generate header.  
622761Sstever@eecs.umich.edudef gen_cpu_exec_signatures(target, source, env):
632761Sstever@eecs.umich.edu    f = open(str(target[0]), 'w')
648878Ssteve.reinhardt@amd.com    print >> f, '''
658878Ssteve.reinhardt@amd.com#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
662761Sstever@eecs.umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__
672761Sstever@eecs.umich.edu'''
682761Sstever@eecs.umich.edu    for cpu in env['CPU_MODELS']:
692761Sstever@eecs.umich.edu        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
702761Sstever@eecs.umich.edu        print >> f, exec_sig_template % (xc_type, xc_type, xc_type)
718878Ssteve.reinhardt@amd.com    print >> f, '''
728878Ssteve.reinhardt@amd.com#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
732632Sstever@eecs.umich.edu'''
742632Sstever@eecs.umich.edu
758878Ssteve.reinhardt@amd.com# Generate string that gets printed when header is rebuilt
768878Ssteve.reinhardt@amd.comdef gen_sigs_string(target, source, env):
772632Sstever@eecs.umich.edu    return "Generating static_inst_exec_sigs.hh: " \
78955SN/A           + ', '.join(env['CPU_MODELS'])
79955SN/A
80955SN/A# Add command to generate header to environment.
815863Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', models_db,
825863Snate@binkert.org            Action(gen_cpu_exec_signatures, gen_sigs_string,
835863Snate@binkert.org                   varlist = ['CPU_MODELS']))
845863Snate@binkert.org
855863Snate@binkert.org#################################################################
865863Snate@binkert.org#
875863Snate@binkert.org# Include CPU-model-specific files based on set of models
885863Snate@binkert.org# specified in CPU_MODELS build option.
895863Snate@binkert.org#
905863Snate@binkert.org#################################################################
915863Snate@binkert.org
928878Ssteve.reinhardt@amd.comsources = []
935863Snate@binkert.org
945863Snate@binkert.orgneed_simple_base = False
955863Snate@binkert.orgif 'AtomicSimpleCPU' in env['CPU_MODELS']:
969812Sandreas.hansson@arm.com    need_simple_base = True
979812Sandreas.hansson@arm.com    sources += Split('simple/atomic.cc')
985863Snate@binkert.org
999812Sandreas.hansson@arm.comif 'TimingSimpleCPU' in env['CPU_MODELS']:
1005863Snate@binkert.org    need_simple_base = True
1015863Snate@binkert.org    sources += Split('simple/timing.cc')
1025863Snate@binkert.org
1039812Sandreas.hansson@arm.comif need_simple_base:
1049812Sandreas.hansson@arm.com    sources += Split('simple/base.cc')
1055863Snate@binkert.org
1065863Snate@binkert.orgif 'FastCPU' in env['CPU_MODELS']:
1078878Ssteve.reinhardt@amd.com    sources += Split('fast/cpu.cc')
1085863Snate@binkert.org
1095863Snate@binkert.orgif 'AlphaFullCPU' in env['CPU_MODELS']:
1105863Snate@binkert.org    sources += Split('''
1116654Snate@binkert.org        o3/2bit_local_pred.cc
11210196SCurtis.Dunham@arm.com        o3/alpha_dyn_inst.cc
113955SN/A        o3/alpha_cpu.cc
1145396Ssaidi@eecs.umich.edu        o3/alpha_cpu_builder.cc
1155863Snate@binkert.org        o3/bpred_unit.cc
1165863Snate@binkert.org        o3/btb.cc
1174202Sbinkertn@umich.edu        o3/commit.cc
1185863Snate@binkert.org        o3/decode.cc
1195863Snate@binkert.org        o3/fetch.cc
1205863Snate@binkert.org        o3/free_list.cc
1215863Snate@binkert.org        o3/cpu.cc
122955SN/A        o3/iew.cc
1236654Snate@binkert.org        o3/inst_queue.cc
1245273Sstever@gmail.com        o3/ldstq.cc
1255871Snate@binkert.org        o3/mem_dep_unit.cc
1265273Sstever@gmail.com        o3/ras.cc
1276655Snate@binkert.org        o3/rename.cc
1288878Ssteve.reinhardt@amd.com        o3/rename_map.cc
1296655Snate@binkert.org        o3/rob.cc
1306655Snate@binkert.org        o3/sat_counter.cc
1319219Spower.jg@gmail.com        o3/store_set.cc
1326655Snate@binkert.org        o3/tournament_pred.cc
1335871Snate@binkert.org        ''')
1346654Snate@binkert.org
1358947Sandreas.hansson@arm.com# FullCPU sources are included from m5/SConscript since they're not
1365396Ssaidi@eecs.umich.edu# below this point in the file hierarchy.
1378120Sgblack@eecs.umich.edu
1388120Sgblack@eecs.umich.edu# Convert file names to SCons File objects.  This takes care of the
1398120Sgblack@eecs.umich.edu# path relative to the top of the directory tree.
1408120Sgblack@eecs.umich.edusources = [File(s) for s in sources]
1418120Sgblack@eecs.umich.edu
1428120Sgblack@eecs.umich.eduReturn('sources')
1438120Sgblack@eecs.umich.edu
1448120Sgblack@eecs.umich.edu