SConscript revision 2629
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 292665Ssaidi@eecs.umich.eduimport os 30955SN/Aimport os.path 31955SN/A 32955SN/A# Import build environment variable from SConstruct. 334382Sbinkertn@umich.eduImport('env') 344202Sbinkertn@umich.edu 354382Sbinkertn@umich.edu################################################################# 364202Sbinkertn@umich.edu# 37955SN/A# Generate StaticInst execute() method signatures. 384381Sbinkertn@umich.edu# 394381Sbinkertn@umich.edu# There must be one signature for each CPU model compiled in. 40955SN/A# Since the set of compiled-in models is flexible, we generate a 41955SN/A# header containing the appropriate set of signatures on the fly. 42955SN/A# 434202Sbinkertn@umich.edu################################################################# 44955SN/A 454382Sbinkertn@umich.edu# CPU model-specific data is contained in cpu_models.py 464382Sbinkertn@umich.edu# Convert to SCons File node to get path handling 474382Sbinkertn@umich.edumodels_db = File('cpu_models.py') 484382Sbinkertn@umich.edu# slurp in contents of file 494382Sbinkertn@umich.eduexecfile(models_db.srcnode().abspath) 504382Sbinkertn@umich.edu 514202Sbinkertn@umich.edu# Template for execute() signature. 524381Sbinkertn@umich.eduexec_sig_template = ''' 534381Sbinkertn@umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; 544381Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const 554381Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); }; 564381Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %s *xc, 57955SN/A Trace::InstRecord *traceData) const 584382Sbinkertn@umich.edu{ panic("completeAcc not defined!"); }; 594202Sbinkertn@umich.edu''' 60955SN/A 614382Sbinkertn@umich.edu# Generate header. 624382Sbinkertn@umich.edudef gen_cpu_exec_signatures(target, source, env): 634382Sbinkertn@umich.edu f = open(str(target[0]), 'w') 644382Sbinkertn@umich.edu print >> f, ''' 654382Sbinkertn@umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 664382Sbinkertn@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 674382Sbinkertn@umich.edu''' 684382Sbinkertn@umich.edu for cpu in env['CPU_MODELS']: 694382Sbinkertn@umich.edu xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 704382Sbinkertn@umich.edu print >> f, exec_sig_template % (xc_type, xc_type, xc_type) 714382Sbinkertn@umich.edu print >> f, ''' 724382Sbinkertn@umich.edu#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 734382Sbinkertn@umich.edu''' 744382Sbinkertn@umich.edu 754382Sbinkertn@umich.edu# Generate string that gets printed when header is rebuilt 764382Sbinkertn@umich.edudef gen_sigs_string(target, source, env): 774382Sbinkertn@umich.edu return "Generating static_inst_exec_sigs.hh: " \ 784382Sbinkertn@umich.edu + ', '.join(env['CPU_MODELS']) 794382Sbinkertn@umich.edu 804382Sbinkertn@umich.edu# Add command to generate header to environment. 814382Sbinkertn@umich.eduenv.Command('static_inst_exec_sigs.hh', models_db, 824382Sbinkertn@umich.edu Action(gen_cpu_exec_signatures, gen_sigs_string, 834382Sbinkertn@umich.edu varlist = ['CPU_MODELS'])) 844382Sbinkertn@umich.edu 854382Sbinkertn@umich.edu################################################################# 864382Sbinkertn@umich.edu# 874382Sbinkertn@umich.edu# Include CPU-model-specific files based on set of models 884382Sbinkertn@umich.edu# specified in CPU_MODELS build option. 894382Sbinkertn@umich.edu# 904382Sbinkertn@umich.edu################################################################# 914382Sbinkertn@umich.edu 924382Sbinkertn@umich.edusources = [] 934382Sbinkertn@umich.edu 944382Sbinkertn@umich.eduneed_simple_base = False 954382Sbinkertn@umich.eduif 'AtomicSimpleCPU' in env['CPU_MODELS']: 964382Sbinkertn@umich.edu need_simple_base = True 974382Sbinkertn@umich.edu sources += Split('simple/atomic.cc') 982667Sstever@eecs.umich.edu 992667Sstever@eecs.umich.eduif 'TimingSimpleCPU' in env['CPU_MODELS']: 1002667Sstever@eecs.umich.edu need_simple_base = True 1012667Sstever@eecs.umich.edu sources += Split('simple/timing.cc') 1022667Sstever@eecs.umich.edu 1032667Sstever@eecs.umich.eduif need_simple_base: 1042037SN/A sources += Split('simple/base.cc') 1052037SN/A 1062037SN/Aif 'FastCPU' in env['CPU_MODELS']: 1074382Sbinkertn@umich.edu sources += Split('fast/cpu.cc') 1084202Sbinkertn@umich.edu 1094382Sbinkertn@umich.eduif 'AlphaFullCPU' in env['CPU_MODELS']: 1104202Sbinkertn@umich.edu sources += Split(''' 1114202Sbinkertn@umich.edu o3/2bit_local_pred.cc 1124202Sbinkertn@umich.edu o3/alpha_dyn_inst.cc 1134202Sbinkertn@umich.edu o3/alpha_cpu.cc 1144202Sbinkertn@umich.edu o3/alpha_cpu_builder.cc 1154202Sbinkertn@umich.edu o3/bpred_unit.cc 1164202Sbinkertn@umich.edu o3/btb.cc 1174202Sbinkertn@umich.edu o3/commit.cc 1184202Sbinkertn@umich.edu o3/decode.cc 1194202Sbinkertn@umich.edu o3/fetch.cc 1204202Sbinkertn@umich.edu o3/free_list.cc 1214202Sbinkertn@umich.edu o3/cpu.cc 1221858SN/A o3/iew.cc 1231858SN/A o3/inst_queue.cc 1241858SN/A o3/ldstq.cc 1251085SN/A o3/mem_dep_unit.cc 1264382Sbinkertn@umich.edu o3/ras.cc 1274382Sbinkertn@umich.edu o3/rename.cc 1284382Sbinkertn@umich.edu o3/rename_map.cc 1294382Sbinkertn@umich.edu o3/rob.cc 1304382Sbinkertn@umich.edu o3/sat_counter.cc 1314382Sbinkertn@umich.edu o3/store_set.cc 1324382Sbinkertn@umich.edu o3/tournament_pred.cc 1334382Sbinkertn@umich.edu ''') 1344382Sbinkertn@umich.edu 1354382Sbinkertn@umich.edu# FullCPU sources are included from m5/SConscript since they're not 1364382Sbinkertn@umich.edu# below this point in the file hierarchy. 1374382Sbinkertn@umich.edu 1384382Sbinkertn@umich.edu# Convert file names to SCons File objects. This takes care of the 1394382Sbinkertn@umich.edu# path relative to the top of the directory tree. 1404382Sbinkertn@umich.edusources = [File(s) for s in sources] 1414382Sbinkertn@umich.edu 1424382Sbinkertn@umich.eduReturn('sources') 1434382Sbinkertn@umich.edu 1444382Sbinkertn@umich.edu