SConscript revision 5222
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.edu# Authors: Steve Reinhardt 302139SN/A 314202Sbinkertn@umich.eduImport('*') 322139SN/A 334202Sbinkertn@umich.edu################################################################# 342152SN/A# 352152SN/A# Generate StaticInst execute() method signatures. 362139SN/A# 372139SN/A# There must be one signature for each CPU model compiled in. 382139SN/A# Since the set of compiled-in models is flexible, we generate a 392139SN/A# header containing the appropriate set of signatures on the fly. 402139SN/A# 412152SN/A################################################################# 422152SN/A 432139SN/A# CPU model-specific data is contained in cpu_models.py 442139SN/A# Convert to SCons File node to get path handling 452139SN/Amodels_db = File('cpu_models.py') 464781Snate@binkert.org# slurp in contents of file 474781Snate@binkert.orgexecfile(models_db.srcnode().abspath) 487799Sgblack@eecs.umich.edu 494781Snate@binkert.org# Template for execute() signature. 504781Snate@binkert.orgexec_sig_template = ''' 513170Sstever@eecs.umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; 525664Sgblack@eecs.umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const 538105Sgblack@eecs.umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 546179Sksewell@umich.eduvirtual Fault completeAcc(Packet *pkt, %s *xc, 554781Snate@binkert.org Trace::InstRecord *traceData) const 564781Snate@binkert.org{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 576329Sgblack@eecs.umich.edu''' 584781Snate@binkert.org 594781Snate@binkert.orgmem_ini_sig_template = ''' 604781Snate@binkert.orgvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 614781Snate@binkert.org''' 624781Snate@binkert.org 634781Snate@binkert.orgmem_comp_sig_template = ''' 642139SN/Avirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 652139SN/A''' 663546Sgblack@eecs.umich.edu 674202Sbinkertn@umich.edu# Generate a temporary CPU list, including the CheckerCPU if 682152SN/A# it's enabled. This isn't used for anything else other than StaticInst 692152SN/A# headers. 702152SN/Atemp_cpu_list = env['CPU_MODELS'][:] 712152SN/A 722152SN/Aif env['USE_CHECKER']: 732152SN/A temp_cpu_list.append('CheckerCPU') 742152SN/A 752152SN/A# Generate header. 762152SN/Adef gen_cpu_exec_signatures(target, source, env): 772152SN/A f = open(str(target[0]), 'w') 782152SN/A print >> f, ''' 792152SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 802504SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 812504SN/A''' 822504SN/A for cpu in temp_cpu_list: 832504SN/A xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 842152SN/A print >> f, exec_sig_template % (xc_type, xc_type, xc_type) 852504SN/A print >> f, ''' 862152SN/A#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 872152SN/A''' 882152SN/A 892152SN/A# Generate string that gets printed when header is rebuilt 902152SN/Adef gen_sigs_string(target, source, env): 912152SN/A return "Generating static_inst_exec_sigs.hh: " \ 928584Sgblack@eecs.umich.edu + ', '.join(temp_cpu_list) 938584Sgblack@eecs.umich.edu 946993Snate@binkert.org# Add command to generate header to environment. 956993Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', models_db, 966993Snate@binkert.org Action(gen_cpu_exec_signatures, gen_sigs_string, 976993Snate@binkert.org varlist = temp_cpu_list)) 986993Snate@binkert.org 996993Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER'])) 1006993Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1016993Snate@binkert.org 1026993Snate@binkert.org# List of suppported CPUs by the Checker. Errors out if USE_CHECKER=True 1036993Snate@binkert.org# and one of these are not being used. 1046993Snate@binkert.orgCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU'] 1056993Snate@binkert.org 1066993Snate@binkert.orgSimObject('BaseCPU.py') 1078584Sgblack@eecs.umich.eduSimObject('FuncUnit.py') 1088584Sgblack@eecs.umich.eduSimObject('ExeTracer.py') 1098584Sgblack@eecs.umich.eduSimObject('IntelTrace.py') 1108584Sgblack@eecs.umich.edu 1118584Sgblack@eecs.umich.eduSource('activity.cc') 1128584Sgblack@eecs.umich.eduSource('base.cc') 1136993Snate@binkert.orgSource('cpuevent.cc') 1146993Snate@binkert.orgSource('exetrace.cc') 1156993Snate@binkert.orgSource('func_unit.cc') 1166998Snate@binkert.orgSource('inteltrace.cc') 1176998Snate@binkert.orgSource('pc_event.cc') 1186998Snate@binkert.orgSource('quiesce_event.cc') 1197756SAli.Saidi@ARM.comSource('static_inst.cc') 1206993Snate@binkert.orgSource('simple_thread.cc') 1216993Snate@binkert.orgSource('thread_context.cc') 1226993Snate@binkert.orgSource('thread_state.cc') 1236993Snate@binkert.org 1248585Sgblack@eecs.umich.eduif env['FULL_SYSTEM']: 1258584Sgblack@eecs.umich.edu SimObject('IntrControl.py') 1266993Snate@binkert.org 1276993Snate@binkert.org Source('intr_control.cc') 1286993Snate@binkert.org Source('profile.cc') 1297816Ssteve.reinhardt@amd.com 1302152SN/A if env['TARGET_ISA'] == 'sparc': 1312766Sktlim@umich.edu SimObject('LegionTrace.py') 1322766Sktlim@umich.edu Source('legiontrace.cc') 1336993Snate@binkert.org 1342152SN/Aif env['TARGET_ISA'] == 'x86': 1352152SN/A SimObject('NativeTrace.py') 1365944Sgblack@eecs.umich.edu Source('nativetrace.cc') 1378335Snate@binkert.org 1388335Snate@binkert.orgif env['USE_CHECKER']: 1398335Snate@binkert.org Source('checker/cpu.cc') 1405944Sgblack@eecs.umich.edu TraceFlag('Checker') 141 checker_supports = False 142 for i in CheckerSupportedCPUList: 143 if i in env['CPU_MODELS']: 144 checker_supports = True 145 if not checker_supports: 146 print "Checker only supports CPU models", 147 for i in CheckerSupportedCPUList: 148 print i, 149 print ", please set USE_CHECKER=False or use one of those CPU models" 150 Exit(1) 151 152TraceFlag('Activity') 153TraceFlag('Commit') 154TraceFlag('Context') 155TraceFlag('Decode') 156TraceFlag('DynInst') 157TraceFlag('ExecEnable') 158TraceFlag('ExecCPSeq') 159TraceFlag('ExecEffAddr') 160TraceFlag('ExecFetchSeq') 161TraceFlag('ExecOpClass') 162TraceFlag('ExecRegDelta') 163TraceFlag('ExecResult') 164TraceFlag('ExecSpeculative') 165TraceFlag('ExecSymbol') 166TraceFlag('ExecThread') 167TraceFlag('ExecTicks') 168TraceFlag('Fetch') 169TraceFlag('IntrControl') 170TraceFlag('PCEvent') 171TraceFlag('Quiesce') 172 173CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 174 'ExecEffAddr', 'ExecResult', 'ExecSymbol' ]) 175