SConscript revision 2297
12SN/A# -*- mode:python -*-
22188SN/A
32SN/A# Copyright (c) 2006 The Regents of The University of Michigan
42SN/A# All rights reserved.
52SN/A#
62SN/A# Redistribution and use in source and binary forms, with or without
72SN/A# modification, are permitted provided that the following conditions are
82SN/A# met: redistributions of source code must retain the above copyright
92SN/A# notice, this list of conditions and the following disclaimer;
102SN/A# redistributions in binary form must reproduce the above copyright
112SN/A# notice, this list of conditions and the following disclaimer in the
122SN/A# documentation and/or other materials provided with the distribution;
132SN/A# neither the name of the copyright holders nor the names of its
142SN/A# contributors may be used to endorse or promote products derived from
152SN/A# this software without specific prior written permission.
162SN/A#
172SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272665SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665SN/A
292665SN/Aimport os
302665SN/Aimport os.path
312665SN/A
322SN/A# Import build environment variable from SConstruct.
332SN/AImport('env')
342SN/A
352SN/A#################################################################
362465SN/A#
371717SN/A# Generate StaticInst execute() method signatures.
382683Sktlim@umich.edu#
392680SN/A# There must be one signature for each CPU model compiled in.
405529Snate@binkert.org# Since the set of compiled-in models is flexible, we generate a
412SN/A# header containing the appropriate set of signatures on the fly.
421858SN/A#
433565Sgblack@eecs.umich.edu#################################################################
445529Snate@binkert.org
451917SN/A# CPU model-specific data is contained in cpu_models.py
461070SN/A# Convert to SCons File node to get path handling
471917SN/Amodels_db = File('cpu_models.py')
482188SN/A# slurp in contents of file
491917SN/Aexecfile(models_db.srcnode().abspath)
502290SN/A
511070SN/A# Template for execute() signature.
521917SN/Aexec_sig_template = '''
532SN/Avirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
545529Snate@binkert.org'''
55360SN/A
562519SN/Amem_ini_sig_template = '''
572SN/Avirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); };
582SN/A'''
592SN/A
602SN/Amem_comp_sig_template = '''
612SN/Avirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; };
621858SN/A'''
632683Sktlim@umich.edu
643453Sgblack@eecs.umich.edu# Generate header.  
652683Sktlim@umich.edudef gen_cpu_exec_signatures(target, source, env):
665712Shsul@eecs.umich.edu    f = open(str(target[0]), 'w')
672683Sktlim@umich.edu    print >> f, '''
682521SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
692SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__
702683Sktlim@umich.edu'''
712190SN/A    for cpu in env['CPU_MODELS']:
722680SN/A        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
732290SN/A        print >> f, exec_sig_template % xc_type
742526SN/A        print >> f, mem_ini_sig_template % xc_type
751917SN/A        print >> f, mem_comp_sig_template % xc_type
765529Snate@binkert.org    print >> f, '''
771982SN/A#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
781917SN/A'''
792683Sktlim@umich.edu
802683Sktlim@umich.edu# Generate string that gets printed when header is rebuilt
811917SN/Adef gen_sigs_string(target, source, env):
821917SN/A    return "Generating static_inst_exec_sigs.hh: " \
831917SN/A           + ', '.join(env['CPU_MODELS'])
841917SN/A
851917SN/A# Add command to generate header to environment.
861917SN/Aenv.Command('static_inst_exec_sigs.hh', models_db,
871917SN/A            Action(gen_cpu_exec_signatures, gen_sigs_string,
881917SN/A                   varlist = ['CPU_MODELS']))
892521SN/A
905482Snate@binkert.org#################################################################
913548Sgblack@eecs.umich.edu#
922SN/A# Include CPU-model-specific files based on set of models
932SN/A# specified in CPU_MODELS build option.
944997Sgblack@eecs.umich.edu#
954997Sgblack@eecs.umich.edu#################################################################
965712Shsul@eecs.umich.edu
974997Sgblack@eecs.umich.edusources = []
982SN/A
992526SN/Aif 'SimpleCPU' in env['CPU_MODELS']:
1002683Sktlim@umich.edu    sources += Split('simple/cpu.cc')
1012SN/A
1022190SN/Aif 'FastCPU' in env['CPU_MODELS']:
1032862Sktlim@umich.edu    sources += Split('fast/cpu.cc')
1042862Sktlim@umich.edu
1052864Sktlim@umich.eduif 'AlphaFullCPU' in env['CPU_MODELS']:
1062862Sktlim@umich.edu    sources += Split('''
1075712Shsul@eecs.umich.edu        o3/2bit_local_pred.cc
1082862Sktlim@umich.edu        o3/alpha_dyn_inst.cc
1095712Shsul@eecs.umich.edu        o3/alpha_cpu.cc
1102862Sktlim@umich.edu        o3/alpha_cpu_builder.cc
1112190SN/A        o3/bpred_unit.cc
1122683Sktlim@umich.edu        o3/btb.cc
1132862Sktlim@umich.edu        o3/commit.cc
1142190SN/A        o3/decode.cc
1152190SN/A        o3/fetch.cc
1162683Sktlim@umich.edu        o3/free_list.cc
1171070SN/A        o3/fu_pool.cc
1183486Sktlim@umich.edu        o3/cpu.cc
1193486Sktlim@umich.edu        o3/iew.cc
1203486Sktlim@umich.edu        o3/inst_queue.cc
1213486Sktlim@umich.edu        o3/lsq_unit.cc
1222680SN/A        o3/lsq.cc
1231070SN/A        o3/mem_dep_unit.cc
1241070SN/A        o3/ras.cc
1251917SN/A        o3/rename.cc
1262683Sktlim@umich.edu        o3/rename_map.cc
127180SN/A        o3/rob.cc
128180SN/A        o3/sat_counter.cc
1291858SN/A        o3/scoreboard.cc
1302235SN/A        o3/store_set.cc
131180SN/A        o3/tournament_pred.cc
1322235SN/A        ''')
133180SN/A
134180SN/Aif 'OzoneSimpleCPU' in env['CPU_MODELS']:
1352862Sktlim@umich.edu    sources += Split('''
1362862Sktlim@umich.edu        ozone/cpu.cc
1372313SN/A        ozone/cpu_builder.cc
1382313SN/A        ozone/dyn_inst.cc
1392680SN/A        ozone/front_end.cc
1402313SN/A        ozone/inorder_back_end.cc
1412680SN/A        ozone/inst_queue.cc
1422313SN/A        ozone/rename_table.cc
1432313SN/A        ''')
1442680SN/A
1452313SN/Aif 'OzoneCPU' in env['CPU_MODELS']:
1462361SN/A    sources += Split('''
1473548Sgblack@eecs.umich.edu        ozone/back_end.cc
1482361SN/A        ozone/lsq_unit.cc
1492361SN/A        ozone/lw_back_end.cc
1502361SN/A        ozone/lw_lsq.cc
1512235SN/A        ''')
152180SN/A
153180SN/A# FullCPU sources are included from m5/SConscript since they're not
154180SN/A# below this point in the file hierarchy.
1552680SN/A
156180SN/A# Convert file names to SCons File objects.  This takes care of the
157180SN/A# path relative to the top of the directory tree.
1582SN/Asources = [File(s) for s in sources]
1592864Sktlim@umich.edu
1602864Sktlim@umich.eduReturn('sources')
1612864Sktlim@umich.edu
1622864Sktlim@umich.edu