SConscript revision 5944
14484Sbinkertn@umich.edu# -*- mode:python -*- 24484Sbinkertn@umich.edu 34484Sbinkertn@umich.edu# Copyright (c) 2006 The Regents of The University of Michigan 44484Sbinkertn@umich.edu# All rights reserved. 54484Sbinkertn@umich.edu# 64484Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without 74484Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are 84484Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright 94484Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer; 104484Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright 114484Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the 124484Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution; 134484Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its 144484Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from 154484Sbinkertn@umich.edu# this software without specific prior written permission. 164484Sbinkertn@umich.edu# 174484Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 184484Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 194484Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 204484Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 214484Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 224484Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 234484Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 244484Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 254484Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 264484Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 274484Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284484Sbinkertn@umich.edu# 294484Sbinkertn@umich.edu# Authors: Steve Reinhardt 304484Sbinkertn@umich.edu 314494Ssaidi@eecs.umich.eduImport('*') 324484Sbinkertn@umich.edu 336121Snate@binkert.org################################################################# 344484Sbinkertn@umich.edu# 358946Sandreas.hansson@arm.com# Generate StaticInst execute() method signatures. 368946Sandreas.hansson@arm.com# 374484Sbinkertn@umich.edu# There must be one signature for each CPU model compiled in. 384484Sbinkertn@umich.edu# Since the set of compiled-in models is flexible, we generate a 394484Sbinkertn@umich.edu# header containing the appropriate set of signatures on the fly. 404781Snate@binkert.org# 414484Sbinkertn@umich.edu################################################################# 424484Sbinkertn@umich.edu 434484Sbinkertn@umich.edu# CPU model-specific data is contained in cpu_models.py 444484Sbinkertn@umich.edu# Convert to SCons File node to get path handling 458349Sgblack@eecs.umich.edumodels_db = File('cpu_models.py') 468349Sgblack@eecs.umich.edu# slurp in contents of file 474484Sbinkertn@umich.eduexecfile(models_db.srcnode().abspath) 484484Sbinkertn@umich.edu 494484Sbinkertn@umich.edu# Template for execute() signature. 504484Sbinkertn@umich.eduexec_sig_template = ''' 514484Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0; 524484Sbinkertn@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const 534484Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 544484Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc, 554484Sbinkertn@umich.edu Trace::InstRecord *traceData) const 564484Sbinkertn@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 574484Sbinkertn@umich.eduvirtual int memAccSize(%(type)s *xc) 584484Sbinkertn@umich.edu{ panic("memAccSize not defined!"); M5_DUMMY_RETURN }; 594484Sbinkertn@umich.edu''' 604484Sbinkertn@umich.edu 614484Sbinkertn@umich.edumem_ini_sig_template = ''' 624484Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 634484Sbinkertn@umich.edu''' 644484Sbinkertn@umich.edu 654484Sbinkertn@umich.edumem_comp_sig_template = ''' 664484Sbinkertn@umich.eduvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 674484Sbinkertn@umich.edu''' 684484Sbinkertn@umich.edu 694484Sbinkertn@umich.edu# Generate a temporary CPU list, including the CheckerCPU if 704484Sbinkertn@umich.edu# it's enabled. This isn't used for anything else other than StaticInst 714484Sbinkertn@umich.edu# headers. 724484Sbinkertn@umich.edutemp_cpu_list = env['CPU_MODELS'][:] 734484Sbinkertn@umich.edu 744484Sbinkertn@umich.eduif env['USE_CHECKER']: 754484Sbinkertn@umich.edu temp_cpu_list.append('CheckerCPU') 764484Sbinkertn@umich.edu SimObject('CheckerCPU.py') 774484Sbinkertn@umich.edu 784484Sbinkertn@umich.edu# Generate header. 794484Sbinkertn@umich.edudef gen_cpu_exec_signatures(target, source, env): 804484Sbinkertn@umich.edu f = open(str(target[0]), 'w') 814484Sbinkertn@umich.edu print >> f, ''' 824484Sbinkertn@umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 834484Sbinkertn@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 844484Sbinkertn@umich.edu''' 854484Sbinkertn@umich.edu for cpu in temp_cpu_list: 864484Sbinkertn@umich.edu xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 874484Sbinkertn@umich.edu print >> f, exec_sig_template % { 'type' : xc_type } 884484Sbinkertn@umich.edu print >> f, ''' 894484Sbinkertn@umich.edu#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 904484Sbinkertn@umich.edu''' 914484Sbinkertn@umich.edu 924484Sbinkertn@umich.edu# Generate string that gets printed when header is rebuilt 934484Sbinkertn@umich.edudef gen_sigs_string(target, source, env): 946121Snate@binkert.org return "Generating static_inst_exec_sigs.hh: " \ 956121Snate@binkert.org + ', '.join(temp_cpu_list) 969420Sandreas.hansson@arm.com 978946Sandreas.hansson@arm.com# Add command to generate header to environment. 988946Sandreas.hansson@arm.comenv.Command('static_inst_exec_sigs.hh', models_db, 998946Sandreas.hansson@arm.com Action(gen_cpu_exec_signatures, gen_sigs_string, 1008737Skoansin.tan@gmail.com varlist = temp_cpu_list)) 1018737Skoansin.tan@gmail.com 1029388Sandreas.hansson@arm.comenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER'])) 1039388Sandreas.hansson@arm.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1049388Sandreas.hansson@arm.com 1059388Sandreas.hansson@arm.com# List of suppported CPUs by the Checker. Errors out if USE_CHECKER=True 1069388Sandreas.hansson@arm.com# and one of these are not being used. 1075765Snate@binkert.orgCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU'] 1085397Ssaidi@eecs.umich.edu 1095274Ssaidi@eecs.umich.eduSimObject('BaseCPU.py') 1104494Ssaidi@eecs.umich.eduSimObject('FuncUnit.py') 1114504Ssaidi@eecs.umich.eduSimObject('ExeTracer.py') 1124494Ssaidi@eecs.umich.eduSimObject('IntelTrace.py') 1134494Ssaidi@eecs.umich.edu 1144496Ssaidi@eecs.umich.eduSource('activity.cc') 1154504Ssaidi@eecs.umich.eduSource('base.cc') 1164504Ssaidi@eecs.umich.eduSource('cpuevent.cc') 1174500Sbinkertn@umich.eduSource('exetrace.cc') 1184500Sbinkertn@umich.eduSource('func_unit.cc') 1194496Ssaidi@eecs.umich.eduSource('inteltrace.cc') 1204496Ssaidi@eecs.umich.eduSource('pc_event.cc') 1217739Sgblack@eecs.umich.eduSource('quiesce_event.cc') 1224487Sstever@eecs.umich.eduSource('static_inst.cc') 1234484Sbinkertn@umich.eduSource('simple_thread.cc') 1244484Sbinkertn@umich.eduSource('thread_context.cc') 1254484Sbinkertn@umich.eduSource('thread_state.cc') 1264484Sbinkertn@umich.edu 1274484Sbinkertn@umich.eduif env['FULL_SYSTEM']: 1284484Sbinkertn@umich.edu SimObject('IntrControl.py') 1295601Snate@binkert.org 1305601Snate@binkert.org Source('intr_control.cc') 1315601Snate@binkert.org Source('profile.cc') 1325601Snate@binkert.org 1334484Sbinkertn@umich.edu if env['TARGET_ISA'] == 'sparc': 1346121Snate@binkert.org SimObject('LegionTrace.py') 1356121Snate@binkert.org Source('legiontrace.cc') 1366121Snate@binkert.org 1374494Ssaidi@eecs.umich.eduif env['TARGET_ISA'] == 'x86': 138 SimObject('NativeTrace.py') 139 Source('nativetrace.cc') 140 141if env['USE_CHECKER']: 142 Source('checker/cpu.cc') 143 TraceFlag('Checker') 144 checker_supports = False 145 for i in CheckerSupportedCPUList: 146 if i in env['CPU_MODELS']: 147 checker_supports = True 148 if not checker_supports: 149 print "Checker only supports CPU models", 150 for i in CheckerSupportedCPUList: 151 print i, 152 print ", please set USE_CHECKER=False or use one of those CPU models" 153 Exit(1) 154 155TraceFlag('Activity') 156TraceFlag('Commit') 157TraceFlag('Context') 158TraceFlag('Decode') 159TraceFlag('DynInst') 160TraceFlag('ExecEnable') 161TraceFlag('ExecCPSeq') 162TraceFlag('ExecEffAddr') 163TraceFlag('ExecFetchSeq') 164TraceFlag('ExecOpClass') 165TraceFlag('ExecRegDelta') 166TraceFlag('ExecResult') 167TraceFlag('ExecSpeculative') 168TraceFlag('ExecSymbol') 169TraceFlag('ExecThread') 170TraceFlag('ExecTicks') 171TraceFlag('ExecMicro') 172TraceFlag('ExecMacro') 173TraceFlag('Fetch') 174TraceFlag('IntrControl') 175TraceFlag('PCEvent') 176TraceFlag('Quiesce') 177 178CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 179 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro' ]) 180