SConscript revision 2460
13918Ssaidi@eecs.umich.edu# -*- mode:python -*- 22632Sstever@eecs.umich.edu 32632Sstever@eecs.umich.edu# Copyright (c) 2006 The Regents of The University of Michigan 42632Sstever@eecs.umich.edu# All rights reserved. 52632Sstever@eecs.umich.edu# 62632Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 72632Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are 82632Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright 92632Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 102632Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 112632Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 122632Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution; 132632Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its 142632Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from 152632Sstever@eecs.umich.edu# this software without specific prior written permission. 162632Sstever@eecs.umich.edu# 172632Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182632Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192632Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202632Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212632Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222632Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232632Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242632Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252632Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262632Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272632Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282632Sstever@eecs.umich.edu 292632Sstever@eecs.umich.eduimport os 302632Sstever@eecs.umich.eduimport os.path 312022SN/A 322022SN/A# Import build environment variable from SConstruct. 332022SN/AImport('env') 342022SN/A 352022SN/A################################################################# 362022SN/A# 372022SN/A# Generate StaticInst execute() method signatures. 382022SN/A# 392022SN/A# There must be one signature for each CPU model compiled in. 402482SN/A# Since the set of compiled-in models is flexible, we generate a 412022SN/A# header containing the appropriate set of signatures on the fly. 422224SN/A# 432224SN/A################################################################# 442516SN/A 452516SN/A# CPU model-specific data is contained in cpu_models.py 462224SN/A# Convert to SCons File node to get path handling 472224SN/Amodels_db = File('cpu_models.py') 482224SN/A# slurp in contents of file 492022SN/Aexecfile(models_db.srcnode().abspath) 502224SN/A 512469SN/A# Template for execute() signature. 522516SN/Aexec_sig_template = ''' 532516SN/Avirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; 542516SN/A''' 552516SN/A 562516SN/A# Generate header. 572516SN/Adef gen_cpu_exec_signatures(target, source, env): 582516SN/A f = open(str(target[0]), 'w') 592516SN/A print >> f, ''' 602516SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 612516SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 622516SN/A''' 632516SN/A for cpu in env['CPU_MODELS']: 642516SN/A xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 652516SN/A print >> f, exec_sig_template % xc_type 662516SN/A print >> f, ''' 672516SN/A#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 682516SN/A''' 692516SN/A 703042Sgblack@eecs.umich.edu# Generate string that gets printed when header is rebuilt 712516SN/Adef gen_sigs_string(target, source, env): 722516SN/A return "Generating static_inst_exec_sigs.hh: " \ 732516SN/A + ', '.join(env['CPU_MODELS']) 742516SN/A 752516SN/A# Add command to generate header to environment. 762516SN/Aenv.Command('static_inst_exec_sigs.hh', models_db, 772022SN/A Action(gen_cpu_exec_signatures, gen_sigs_string, 782482SN/A varlist = ['CPU_MODELS'])) 792482SN/A 802482SN/A################################################################# 812482SN/A# 822516SN/A# Include CPU-model-specific files based on set of models 832482SN/A# specified in CPU_MODELS build option. 842482SN/A# 852482SN/A################################################################# 862516SN/A 872516SN/Asources = [] 882516SN/A 892482SN/Aif 'SimpleCPU' in env['CPU_MODELS']: 903273Sgblack@eecs.umich.edu sources += Split('simple/cpu.cc') 912482SN/A 922482SN/Aif 'FastCPU' in env['CPU_MODELS']: 932482SN/A sources += Split('fast/cpu.cc') 942482SN/A 952591SN/Aif 'AlphaFullCPU' in env['CPU_MODELS']: 962591SN/A sources += Split(''' 972591SN/A o3/2bit_local_pred.cc 982591SN/A o3/alpha_dyn_inst.cc 992591SN/A o3/alpha_cpu.cc 1002591SN/A o3/alpha_cpu_builder.cc 1012591SN/A o3/bpred_unit.cc 1022591SN/A o3/btb.cc 1032591SN/A o3/commit.cc 1042591SN/A o3/decode.cc 1053273Sgblack@eecs.umich.edu o3/fetch.cc 1062591SN/A o3/free_list.cc 1072591SN/A o3/cpu.cc 1082591SN/A o3/iew.cc 1092591SN/A o3/inst_queue.cc 1102482SN/A o3/ldstq.cc 1112482SN/A o3/mem_dep_unit.cc 1122516SN/A o3/ras.cc 1132482SN/A o3/rename.cc 1142482SN/A o3/rename_map.cc 1152482SN/A o3/rob.cc 1162516SN/A o3/sat_counter.cc 1172516SN/A o3/store_set.cc 1182516SN/A o3/tournament_pred.cc 1192482SN/A ''') 1203273Sgblack@eecs.umich.edu 1212516SN/A# FullCPU sources are included from m5/SConscript since they're not 1222516SN/A# below this point in the file hierarchy. 1232516SN/A 1242516SN/A# Convert file names to SCons File objects. This takes care of the 1252516SN/A# path relative to the top of the directory tree. 1262516SN/Asources = [File(s) for s in sources] 1272516SN/A 1282516SN/AReturn('sources') 1292516SN/A 1302516SN/A