SConscript revision 2667
1955SN/A# -*- mode:python -*- 2955SN/A 31762SN/A# Copyright (c) 2006 The Regents of The University of Michigan 4955SN/A# All rights reserved. 5955SN/A# 6955SN/A# Redistribution and use in source and binary forms, with or without 7955SN/A# modification, are permitted provided that the following conditions are 8955SN/A# met: redistributions of source code must retain the above copyright 9955SN/A# notice, this list of conditions and the following disclaimer; 10955SN/A# redistributions in binary form must reproduce the above copyright 11955SN/A# notice, this list of conditions and the following disclaimer in the 12955SN/A# documentation and/or other materials provided with the distribution; 13955SN/A# neither the name of the copyright holders nor the names of its 14955SN/A# contributors may be used to endorse or promote products derived from 15955SN/A# this software without specific prior written permission. 16955SN/A# 17955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27955SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu# 294762Snate@binkert.org# Authors: Steve Reinhardt 30955SN/A 315522Snate@binkert.orgimport os 326143Snate@binkert.orgimport os.path 334762Snate@binkert.org 345522Snate@binkert.org# Import build environment variable from SConstruct. 35955SN/AImport('env') 365522Snate@binkert.org 37955SN/A################################################################# 385522Snate@binkert.org# 394202Sbinkertn@umich.edu# Generate StaticInst execute() method signatures. 405742Snate@binkert.org# 41955SN/A# There must be one signature for each CPU model compiled in. 424381Sbinkertn@umich.edu# Since the set of compiled-in models is flexible, we generate a 434381Sbinkertn@umich.edu# header containing the appropriate set of signatures on the fly. 448334Snate@binkert.org# 45955SN/A################################################################# 46955SN/A 474202Sbinkertn@umich.edu# CPU model-specific data is contained in cpu_models.py 48955SN/A# Convert to SCons File node to get path handling 494382Sbinkertn@umich.edumodels_db = File('cpu_models.py') 504382Sbinkertn@umich.edu# slurp in contents of file 514382Sbinkertn@umich.eduexecfile(models_db.srcnode().abspath) 526654Snate@binkert.org 535517Snate@binkert.org# Template for execute() signature. 548614Sgblack@eecs.umich.eduexec_sig_template = ''' 557674Snate@binkert.orgvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; 566143Snate@binkert.orgvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const 576143Snate@binkert.org{ panic("initiateAcc not defined!"); }; 586143Snate@binkert.orgvirtual Fault completeAcc(Packet *pkt, %s *xc, 598233Snate@binkert.org Trace::InstRecord *traceData) const 608233Snate@binkert.org{ panic("completeAcc not defined!"); }; 618233Snate@binkert.org''' 628233Snate@binkert.org 638233Snate@binkert.org# Generate header. 648334Snate@binkert.orgdef gen_cpu_exec_signatures(target, source, env): 658334Snate@binkert.org f = open(str(target[0]), 'w') 6610453SAndrew.Bardsley@arm.com print >> f, ''' 6710453SAndrew.Bardsley@arm.com#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 688233Snate@binkert.org#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 698233Snate@binkert.org''' 708233Snate@binkert.org for cpu in env['CPU_MODELS']: 718233Snate@binkert.org xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 728233Snate@binkert.org print >> f, exec_sig_template % (xc_type, xc_type, xc_type) 738233Snate@binkert.org print >> f, ''' 746143Snate@binkert.org#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 758233Snate@binkert.org''' 768233Snate@binkert.org 778233Snate@binkert.org# Generate string that gets printed when header is rebuilt 786143Snate@binkert.orgdef gen_sigs_string(target, source, env): 796143Snate@binkert.org return "Generating static_inst_exec_sigs.hh: " \ 806143Snate@binkert.org + ', '.join(env['CPU_MODELS']) 816143Snate@binkert.org 828233Snate@binkert.org# Add command to generate header to environment. 838233Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', models_db, 848233Snate@binkert.org Action(gen_cpu_exec_signatures, gen_sigs_string, 856143Snate@binkert.org varlist = ['CPU_MODELS'])) 868233Snate@binkert.org 878233Snate@binkert.org################################################################# 888233Snate@binkert.org# 898233Snate@binkert.org# Include CPU-model-specific files based on set of models 906143Snate@binkert.org# specified in CPU_MODELS build option. 916143Snate@binkert.org# 926143Snate@binkert.org################################################################# 934762Snate@binkert.org 946143Snate@binkert.orgsources = [] 958233Snate@binkert.org 968233Snate@binkert.orgneed_simple_base = False 978233Snate@binkert.orgif 'AtomicSimpleCPU' in env['CPU_MODELS']: 988233Snate@binkert.org need_simple_base = True 998233Snate@binkert.org sources += Split('simple/atomic.cc') 1006143Snate@binkert.org 1018233Snate@binkert.orgif 'TimingSimpleCPU' in env['CPU_MODELS']: 1028233Snate@binkert.org need_simple_base = True 1038233Snate@binkert.org sources += Split('simple/timing.cc') 1048233Snate@binkert.org 1056143Snate@binkert.orgif need_simple_base: 1066143Snate@binkert.org sources += Split('simple/base.cc') 1076143Snate@binkert.org 1086143Snate@binkert.orgif 'FastCPU' in env['CPU_MODELS']: 1096143Snate@binkert.org sources += Split('fast/cpu.cc') 1106143Snate@binkert.org 1116143Snate@binkert.orgif 'AlphaFullCPU' in env['CPU_MODELS']: 1126143Snate@binkert.org sources += Split(''' 1136143Snate@binkert.org o3/2bit_local_pred.cc 1147065Snate@binkert.org o3/alpha_dyn_inst.cc 1156143Snate@binkert.org o3/alpha_cpu.cc 1168233Snate@binkert.org o3/alpha_cpu_builder.cc 1178233Snate@binkert.org o3/bpred_unit.cc 1188233Snate@binkert.org o3/btb.cc 1198233Snate@binkert.org o3/commit.cc 1208233Snate@binkert.org o3/decode.cc 1218233Snate@binkert.org o3/fetch.cc 1228233Snate@binkert.org o3/free_list.cc 1238233Snate@binkert.org o3/cpu.cc 1248233Snate@binkert.org o3/iew.cc 1258233Snate@binkert.org o3/inst_queue.cc 1268233Snate@binkert.org o3/ldstq.cc 1278233Snate@binkert.org o3/mem_dep_unit.cc 1288233Snate@binkert.org o3/ras.cc 1298233Snate@binkert.org o3/rename.cc 1308233Snate@binkert.org o3/rename_map.cc 1318233Snate@binkert.org o3/rob.cc 1328233Snate@binkert.org o3/sat_counter.cc 1338233Snate@binkert.org o3/store_set.cc 1348233Snate@binkert.org o3/tournament_pred.cc 1358233Snate@binkert.org ''') 1368233Snate@binkert.org 1378233Snate@binkert.org# FullCPU sources are included from m5/SConscript since they're not 1388233Snate@binkert.org# below this point in the file hierarchy. 1398233Snate@binkert.org 1408233Snate@binkert.org# Convert file names to SCons File objects. This takes care of the 1418233Snate@binkert.org# path relative to the top of the directory tree. 1428233Snate@binkert.orgsources = [File(s) for s in sources] 1438233Snate@binkert.org 1448233Snate@binkert.orgReturn('sources') 1458233Snate@binkert.org 1468233Snate@binkert.org