SConscript revision 2178
12139SN/A# -*- mode:python -*-
22139SN/A
32139SN/A# Copyright (c) 2006 The Regents of The University of Michigan
42139SN/A# All rights reserved.
52139SN/A#
62139SN/A# Redistribution and use in source and binary forms, with or without
72139SN/A# modification, are permitted provided that the following conditions are
82139SN/A# met: redistributions of source code must retain the above copyright
92139SN/A# notice, this list of conditions and the following disclaimer;
102139SN/A# redistributions in binary form must reproduce the above copyright
112139SN/A# notice, this list of conditions and the following disclaimer in the
122139SN/A# documentation and/or other materials provided with the distribution;
132139SN/A# neither the name of the copyright holders nor the names of its
142139SN/A# contributors may be used to endorse or promote products derived from
152139SN/A# this software without specific prior written permission.
162139SN/A#
172139SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182139SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192139SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202139SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212139SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222139SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232139SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242139SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252139SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262139SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272139SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu
292665Ssaidi@eecs.umich.eduimport os
302139SN/Aimport os.path
314202Sbinkertn@umich.edu
322139SN/A# Import build environment variable from SConstruct.
334202Sbinkertn@umich.eduImport('env')
342152SN/A
352152SN/A#################################################################
362139SN/A#
372139SN/A# Generate StaticInst execute() method signatures.
382139SN/A#
392139SN/A# There must be one signature for each CPU model compiled in.
402139SN/A# Since the set of compiled-in models is flexible, we generate a
412152SN/A# header containing the appropriate set of signatures on the fly.
422152SN/A#
432139SN/A#################################################################
442139SN/A
452139SN/A# CPU model-specific data is contained in cpu_models.py
464781Snate@binkert.org# Convert to SCons File node to get path handling
474781Snate@binkert.orgmodels_db = File('cpu_models.py')
487799Sgblack@eecs.umich.edu# slurp in contents of file
494781Snate@binkert.orgexecfile(models_db.srcnode().abspath)
504781Snate@binkert.org
513170Sstever@eecs.umich.edu# Template for execute() signature.
525664Sgblack@eecs.umich.eduexec_sig_template = '''
538105Sgblack@eecs.umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
546179Sksewell@umich.edu'''
554781Snate@binkert.org
564781Snate@binkert.org# Generate header.  
576329Sgblack@eecs.umich.edudef gen_cpu_exec_signatures(target, source, env):
584781Snate@binkert.org    f = open(str(target[0]), 'w')
594781Snate@binkert.org    print >> f, '''
604781Snate@binkert.org#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
614781Snate@binkert.org#define __CPU_STATIC_INST_EXEC_SIGS_HH__
624781Snate@binkert.org'''
634781Snate@binkert.org    for cpu in env['CPU_MODELS']:
642139SN/A        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
652139SN/A        print >> f, exec_sig_template % xc_type
663546Sgblack@eecs.umich.edu    print >> f, '''
674202Sbinkertn@umich.edu#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
682152SN/A'''
692152SN/A
702152SN/A# Generate string that gets printed when header is rebuilt
712152SN/Adef gen_sigs_string(target, source, env):
722152SN/A    return "Generating static_inst_exec_sigs.hh: " \
732152SN/A           + ', '.join(env['CPU_MODELS'])
742152SN/A
752152SN/A# Add command to generate header to environment.
762152SN/Aenv.Command('static_inst_exec_sigs.hh', models_db,
772152SN/A            Action(gen_cpu_exec_signatures, gen_sigs_string,
782152SN/A                   varlist = ['CPU_MODELS']))
792152SN/A
802504SN/A#################################################################
812504SN/A#
822504SN/A# Include CPU-model-specific files based on set of models
832504SN/A# specified in CPU_MODELS build option.
842152SN/A#
852504SN/A#################################################################
862152SN/A
872152SN/Asources = []
882152SN/A
892152SN/Aif 'SimpleCPU' in env['CPU_MODELS']:
902152SN/A    sources += Split('simple/cpu.cc')
912152SN/A
926993Snate@binkert.orgif 'FastCPU' in env['CPU_MODELS']:
936993Snate@binkert.org    sources += Split('fast/cpu.cc')
946993Snate@binkert.org
956993Snate@binkert.orgif 'AlphaFullCPU' in env['CPU_MODELS']:
966993Snate@binkert.org    sources += Split('''
976993Snate@binkert.org        o3/2bit_local_pred.cc
986993Snate@binkert.org        o3/alpha_dyn_inst.cc
996993Snate@binkert.org        o3/alpha_cpu.cc
1006993Snate@binkert.org        o3/alpha_cpu_builder.cc
1016993Snate@binkert.org        o3/bpred_unit.cc
1026993Snate@binkert.org        o3/btb.cc
1036993Snate@binkert.org        o3/commit.cc
1046993Snate@binkert.org        o3/decode.cc
1056993Snate@binkert.org        o3/fetch.cc
1066993Snate@binkert.org        o3/free_list.cc
1076993Snate@binkert.org        o3/cpu.cc
1086993Snate@binkert.org        o3/iew.cc
1096998Snate@binkert.org        o3/inst_queue.cc
1106998Snate@binkert.org        o3/ldstq.cc
1116998Snate@binkert.org        o3/mem_dep_unit.cc
1127756SAli.Saidi@ARM.com        o3/ras.cc
1136993Snate@binkert.org        o3/rename.cc
1146993Snate@binkert.org        o3/rename_map.cc
1156993Snate@binkert.org        o3/rob.cc
1166993Snate@binkert.org        o3/sat_counter.cc
1176993Snate@binkert.org        o3/store_set.cc
1186993Snate@binkert.org        o3/tournament_pred.cc
1196993Snate@binkert.org        ''')
1206993Snate@binkert.org
1217816Ssteve.reinhardt@amd.com# FullCPU sources are included from m5/SConscript since they're not
1222152SN/A# below this point in the file hierarchy.
1232766Sktlim@umich.edu
1242766Sktlim@umich.edu# Convert file names to SCons File objects.  This takes care of the
1256993Snate@binkert.org# path relative to the top of the directory tree.
1262152SN/Asources = [File(s) for s in sources]
1272152SN/A
1285944Sgblack@eecs.umich.eduReturn('sources')
1295944Sgblack@eecs.umich.edu
1305944Sgblack@eecs.umich.edu