SConscript revision 2632
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.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const 554781Snate@binkert.org{ panic("initiateAcc not defined!"); }; 564781Snate@binkert.orgvirtual Fault completeAcc(Packet *pkt, %s *xc, 576329Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 584781Snate@binkert.org{ panic("completeAcc not defined!"); }; 594781Snate@binkert.org''' 604781Snate@binkert.org 614781Snate@binkert.org# Generate header. 624781Snate@binkert.orgdef gen_cpu_exec_signatures(target, source, env): 634781Snate@binkert.org f = open(str(target[0]), 'w') 642139SN/A print >> f, ''' 652139SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 663546Sgblack@eecs.umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 674202Sbinkertn@umich.edu''' 682152SN/A for cpu in env['CPU_MODELS']: 692152SN/A xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 702152SN/A print >> f, exec_sig_template % (xc_type, xc_type, xc_type) 712152SN/A print >> f, ''' 722152SN/A#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 732152SN/A''' 742152SN/A 752152SN/A# Generate string that gets printed when header is rebuilt 762152SN/Adef gen_sigs_string(target, source, env): 772152SN/A return "Generating static_inst_exec_sigs.hh: " \ 782152SN/A + ', '.join(env['CPU_MODELS']) 792152SN/A 802504SN/A# Add command to generate header to environment. 812504SN/Aenv.Command('static_inst_exec_sigs.hh', models_db, 822504SN/A Action(gen_cpu_exec_signatures, gen_sigs_string, 832504SN/A varlist = ['CPU_MODELS'])) 842152SN/A 852504SN/A################################################################# 862152SN/A# 872152SN/A# Include CPU-model-specific files based on set of models 882152SN/A# specified in CPU_MODELS build option. 892152SN/A# 902152SN/A################################################################# 912152SN/A 928584Sgblack@eecs.umich.edusources = [] 938584Sgblack@eecs.umich.edu 946993Snate@binkert.orgneed_simple_base = False 956993Snate@binkert.orgif 'AtomicSimpleCPU' in env['CPU_MODELS']: 966993Snate@binkert.org need_simple_base = True 976993Snate@binkert.org sources += Split('simple/atomic.cc') 986993Snate@binkert.org 996993Snate@binkert.orgif 'TimingSimpleCPU' in env['CPU_MODELS']: 1006993Snate@binkert.org need_simple_base = True 1016993Snate@binkert.org sources += Split('simple/timing.cc') 1026993Snate@binkert.org 1036993Snate@binkert.orgif need_simple_base: 1046993Snate@binkert.org sources += Split('simple/base.cc') 1056993Snate@binkert.org 1066993Snate@binkert.orgif 'FastCPU' in env['CPU_MODELS']: 1078584Sgblack@eecs.umich.edu sources += Split('fast/cpu.cc') 1088584Sgblack@eecs.umich.edu 1098584Sgblack@eecs.umich.eduif 'AlphaFullCPU' in env['CPU_MODELS']: 1108584Sgblack@eecs.umich.edu sources += Split(''' 1118584Sgblack@eecs.umich.edu o3/2bit_local_pred.cc 1128584Sgblack@eecs.umich.edu o3/alpha_dyn_inst.cc 1136993Snate@binkert.org o3/alpha_cpu.cc 1146993Snate@binkert.org o3/alpha_cpu_builder.cc 1156993Snate@binkert.org o3/bpred_unit.cc 1166998Snate@binkert.org o3/btb.cc 1176998Snate@binkert.org o3/commit.cc 1186998Snate@binkert.org o3/decode.cc 1197756SAli.Saidi@ARM.com o3/fetch.cc 1206993Snate@binkert.org o3/free_list.cc 1216993Snate@binkert.org o3/cpu.cc 1226993Snate@binkert.org o3/iew.cc 1236993Snate@binkert.org o3/inst_queue.cc 1248585Sgblack@eecs.umich.edu o3/ldstq.cc 1258584Sgblack@eecs.umich.edu o3/mem_dep_unit.cc 1266993Snate@binkert.org o3/ras.cc 1276993Snate@binkert.org o3/rename.cc 1286993Snate@binkert.org o3/rename_map.cc 1297816Ssteve.reinhardt@amd.com o3/rob.cc 1302152SN/A o3/sat_counter.cc 1312766Sktlim@umich.edu o3/store_set.cc 1322766Sktlim@umich.edu o3/tournament_pred.cc 1336993Snate@binkert.org ''') 1342152SN/A 1352152SN/A# FullCPU sources are included from m5/SConscript since they're not 1365944Sgblack@eecs.umich.edu# below this point in the file hierarchy. 1378335Snate@binkert.org 1388335Snate@binkert.org# Convert file names to SCons File objects. This takes care of the 1398335Snate@binkert.org# path relative to the top of the directory tree. 1405944Sgblack@eecs.umich.edusources = [File(s) for s in sources] 141 142Return('sources') 143 144