SConscript revision 2499
16157Snate@binkert.org# -*- mode:python -*- 26157Snate@binkert.org 36157Snate@binkert.org# Copyright (c) 2006 The Regents of The University of Michigan 46157Snate@binkert.org# All rights reserved. 56157Snate@binkert.org# 66157Snate@binkert.org# Redistribution and use in source and binary forms, with or without 76157Snate@binkert.org# modification, are permitted provided that the following conditions are 86157Snate@binkert.org# met: redistributions of source code must retain the above copyright 96157Snate@binkert.org# notice, this list of conditions and the following disclaimer; 106157Snate@binkert.org# redistributions in binary form must reproduce the above copyright 116157Snate@binkert.org# notice, this list of conditions and the following disclaimer in the 126157Snate@binkert.org# documentation and/or other materials provided with the distribution; 136157Snate@binkert.org# neither the name of the copyright holders nor the names of its 146157Snate@binkert.org# contributors may be used to endorse or promote products derived from 156157Snate@binkert.org# this software without specific prior written permission. 166157Snate@binkert.org# 176157Snate@binkert.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 186157Snate@binkert.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 196157Snate@binkert.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 206157Snate@binkert.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 216157Snate@binkert.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 226157Snate@binkert.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 236157Snate@binkert.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 246157Snate@binkert.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 256157Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 266157Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 276157Snate@binkert.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 286157Snate@binkert.org 296157Snate@binkert.orgimport os 306157Snate@binkert.orgimport os.path 316157Snate@binkert.org 328453Snate@binkert.org# Import build environment variable from SConstruct. 336157Snate@binkert.orgImport('env') 346157Snate@binkert.org 356657Snate@binkert.org################################################################# 366157Snate@binkert.org# 378453Snate@binkert.org# Generate StaticInst execute() method signatures. 388453Snate@binkert.org# 396157Snate@binkert.org# There must be one signature for each CPU model compiled in. 406157Snate@binkert.org# Since the set of compiled-in models is flexible, we generate a 416168Snate@binkert.org# header containing the appropriate set of signatures on the fly. 426168Snate@binkert.org# 436168Snate@binkert.org################################################################# 446157Snate@binkert.org 456157Snate@binkert.org# CPU model-specific data is contained in cpu_models.py 466657Snate@binkert.org# Convert to SCons File node to get path handling 476657Snate@binkert.orgmodels_db = File('cpu_models.py') 486657Snate@binkert.org# slurp in contents of file 496657Snate@binkert.orgexecfile(models_db.srcnode().abspath) 506657Snate@binkert.org 516657Snate@binkert.org# Template for execute() signature. 526657Snate@binkert.orgexec_sig_template = ''' 536657Snate@binkert.orgvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; 546657Snate@binkert.org''' 556657Snate@binkert.org 566157Snate@binkert.org# Generate header. 576157Snate@binkert.orgdef gen_cpu_exec_signatures(target, source, env): 586157Snate@binkert.org f = open(str(target[0]), 'w') 596157Snate@binkert.org print >> f, ''' 608453Snate@binkert.org#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 618453Snate@binkert.org#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 628453Snate@binkert.org''' 638453Snate@binkert.org for cpu in env['CPU_MODELS']: 646657Snate@binkert.org xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 656657Snate@binkert.org print >> f, exec_sig_template % xc_type 666999Snate@binkert.org print >> f, ''' 676657Snate@binkert.org#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 688453Snate@binkert.org''' 698453Snate@binkert.org 708453Snate@binkert.org# Generate string that gets printed when header is rebuilt 718453Snate@binkert.orgdef gen_sigs_string(target, source, env): 728453Snate@binkert.org return "Generating static_inst_exec_sigs.hh: " \ 738453Snate@binkert.org + ', '.join(env['CPU_MODELS']) 746657Snate@binkert.org 758453Snate@binkert.org# Add command to generate header to environment. 766657Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', models_db, 776657Snate@binkert.org Action(gen_cpu_exec_signatures, gen_sigs_string, 786657Snate@binkert.org varlist = ['CPU_MODELS'])) 796657Snate@binkert.org 808453Snate@binkert.org################################################################# 818453Snate@binkert.org# 828453Snate@binkert.org# Include CPU-model-specific files based on set of models 838453Snate@binkert.org# specified in CPU_MODELS build option. 848453Snate@binkert.org# 858453Snate@binkert.org################################################################# 868453Snate@binkert.org 876157Snate@binkert.orgsources = [] 888453Snate@binkert.org 898453Snate@binkert.orgif 'SimpleCPU' in env['CPU_MODELS']: 906157Snate@binkert.org sources += Split('simple/cpu.cc') 916157Snate@binkert.org 926157Snate@binkert.orgif 'FastCPU' in env['CPU_MODELS']: 936157Snate@binkert.org sources += Split('fast/cpu.cc') 946157Snate@binkert.org 956657Snate@binkert.orgif 'AlphaFullCPU' in env['CPU_MODELS']: 966657Snate@binkert.org sources += Split(''' 976657Snate@binkert.org o3/2bit_local_pred.cc 986157Snate@binkert.org o3/alpha_dyn_inst.cc 996877Ssteve.reinhardt@amd.com o3/alpha_cpu.cc 1006877Ssteve.reinhardt@amd.com o3/alpha_cpu_builder.cc 1016877Ssteve.reinhardt@amd.com o3/bpred_unit.cc 1026877Ssteve.reinhardt@amd.com o3/btb.cc 1036877Ssteve.reinhardt@amd.com o3/commit.cc 1046877Ssteve.reinhardt@amd.com o3/decode.cc 1056877Ssteve.reinhardt@amd.com o3/fetch.cc 106 o3/free_list.cc 107 o3/cpu.cc 108 o3/iew.cc 109 o3/inst_queue.cc 110 o3/ldstq.cc 111 o3/mem_dep_unit.cc 112 o3/ras.cc 113 o3/rename.cc 114 o3/rename_map.cc 115 o3/rob.cc 116 o3/sat_counter.cc 117 o3/store_set.cc 118 o3/tournament_pred.cc 119 ''') 120 121# FullCPU sources are included from m5/SConscript since they're not 122# below this point in the file hierarchy. 123 124# Convert file names to SCons File objects. This takes care of the 125# path relative to the top of the directory tree. 126sources = [File(s) for s in sources] 127 128Return('sources') 129 130