SConscript revision 8334
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.edu# Authors: Steve Reinhardt 30955SN/A 31955SN/AImport('*') 32955SN/A 333583Sbinkertn@umich.eduif env['TARGET_ISA'] == 'no': 34955SN/A Return() 35955SN/A 36955SN/A################################################################# 37955SN/A# 38955SN/A# Generate StaticInst execute() method signatures. 39955SN/A# 40955SN/A# There must be one signature for each CPU model compiled in. 41955SN/A# Since the set of compiled-in models is flexible, we generate a 42955SN/A# header containing the appropriate set of signatures on the fly. 43955SN/A# 44955SN/A################################################################# 45955SN/A 46955SN/A# Template for execute() signature. 47955SN/Aexec_sig_template = ''' 482023SN/Avirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0; 49955SN/Avirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 503089Ssaidi@eecs.umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 51955SN/Avirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const 52955SN/A{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 53955SN/Avirtual Fault completeAcc(Packet *pkt, %(type)s *xc, 54955SN/A Trace::InstRecord *traceData) const 55955SN/A{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 56955SN/A''' 57955SN/A 58955SN/Amem_ini_sig_template = ''' 591031SN/Avirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 60955SN/A{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 611388SN/Avirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 62955SN/A''' 63955SN/A 641296SN/Amem_comp_sig_template = ''' 65955SN/Avirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 66955SN/A''' 67955SN/A 68955SN/A# Generate a temporary CPU list, including the CheckerCPU if 69955SN/A# it's enabled. This isn't used for anything else other than StaticInst 70955SN/A# headers. 71955SN/Atemp_cpu_list = env['CPU_MODELS'][:] 72955SN/A 73955SN/Aif env['USE_CHECKER']: 74955SN/A temp_cpu_list.append('CheckerCPU') 75955SN/A SimObject('CheckerCPU.py') 76955SN/A 773584Ssaidi@eecs.umich.edu# Generate header. 78955SN/Adef gen_cpu_exec_signatures(target, source, env): 79955SN/A f = open(str(target[0]), 'w') 80955SN/A print >> f, ''' 81955SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 82955SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 83955SN/A''' 84955SN/A for cpu in temp_cpu_list: 852325SN/A xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 861717SN/A print >> f, exec_sig_template % { 'type' : xc_type } 872652Ssaidi@eecs.umich.edu print >> f, ''' 88955SN/A#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 892736Sktlim@umich.edu''' 902410SN/A 91955SN/A# Generate string that gets printed when header is rebuilt 922290SN/Adef gen_sigs_string(target, source, env): 93955SN/A return " [GENERATE] static_inst_exec_sigs.hh: " \ 942683Sktlim@umich.edu + ', '.join(temp_cpu_list) 952683Sktlim@umich.edu 962669Sktlim@umich.edu# Add command to generate header to environment. 972568SN/Aenv.Command('static_inst_exec_sigs.hh', (), 982568SN/A Action(gen_cpu_exec_signatures, gen_sigs_string, 993012Ssaidi@eecs.umich.edu varlist = temp_cpu_list)) 1002462SN/A 1012568SN/Aenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER'])) 1022395SN/Aenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1032405SN/A 1042914Ssaidi@eecs.umich.edu# List of suppported CPUs by the Checker. Errors out if USE_CHECKER=True 105955SN/A# and one of these are not being used. 1062811Srdreslin@umich.eduCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU'] 1072811Srdreslin@umich.edu 1082811Srdreslin@umich.eduSimObject('BaseCPU.py') 1092811Srdreslin@umich.eduSimObject('FuncUnit.py') 1102811Srdreslin@umich.eduSimObject('ExeTracer.py') 1112811Srdreslin@umich.eduSimObject('IntelTrace.py') 1122811Srdreslin@umich.eduSimObject('NativeTrace.py') 1132811Srdreslin@umich.edu 1142811Srdreslin@umich.eduSource('activity.cc') 1152811Srdreslin@umich.eduSource('base.cc') 1162811Srdreslin@umich.eduSource('cpuevent.cc') 1172811Srdreslin@umich.eduSource('exetrace.cc') 1182811Srdreslin@umich.eduSource('func_unit.cc') 1192811Srdreslin@umich.eduSource('inteltrace.cc') 1202811Srdreslin@umich.eduSource('nativetrace.cc') 1212811Srdreslin@umich.eduSource('pc_event.cc') 1222814Srdreslin@umich.eduSource('quiesce_event.cc') 1232811Srdreslin@umich.eduSource('static_inst.cc') 1242811Srdreslin@umich.eduSource('simple_thread.cc') 1252811Srdreslin@umich.eduSource('thread_context.cc') 1262811Srdreslin@umich.eduSource('thread_state.cc') 1272811Srdreslin@umich.edu 1282811Srdreslin@umich.eduif env['FULL_SYSTEM']: 1292811Srdreslin@umich.edu SimObject('IntrControl.py') 1302813Srdreslin@umich.edu 1312813Srdreslin@umich.edu Source('intr_control.cc') 1323624Sbinkertn@umich.edu Source('profile.cc') 1333624Sbinkertn@umich.edu 134955SN/A if env['TARGET_ISA'] == 'sparc': 135955SN/A SimObject('LegionTrace.py') 136955SN/A Source('legiontrace.cc') 1372090SN/A 138955SN/Aif env['USE_CHECKER']: 139955SN/A Source('checker/cpu.cc') 1401696SN/A TraceFlag('Checker') 141955SN/A checker_supports = False 142955SN/A for i in CheckerSupportedCPUList: 143955SN/A if i in env['CPU_MODELS']: 1441127SN/A checker_supports = True 145955SN/A if not checker_supports: 146955SN/A print "Checker only supports CPU models", 1472379SN/A for i in CheckerSupportedCPUList: 148955SN/A print i, 149955SN/A print ", please set USE_CHECKER=False or use one of those CPU models" 150955SN/A Exit(1) 1512422SN/A 1522422SN/ATraceFlag('Activity') 1532422SN/ATraceFlag('Commit') 1542422SN/ATraceFlag('Context') 1552422SN/ATraceFlag('Decode') 1562422SN/ATraceFlag('DynInst') 1572422SN/ATraceFlag('ExecEnable') 1582397SN/ATraceFlag('ExecCPSeq') 1592397SN/ATraceFlag('ExecEffAddr') 1602422SN/ATraceFlag('ExecFaulting', 'Trace faulting instructions') 1612422SN/ATraceFlag('ExecFetchSeq') 162955SN/ATraceFlag('ExecOpClass') 163955SN/ATraceFlag('ExecRegDelta') 164955SN/ATraceFlag('ExecResult') 165955SN/ATraceFlag('ExecSpeculative') 166955SN/ATraceFlag('ExecSymbol') 167955SN/ATraceFlag('ExecThread') 168955SN/ATraceFlag('ExecTicks') 169955SN/ATraceFlag('ExecMicro') 1701078SN/ATraceFlag('ExecMacro') 171955SN/ATraceFlag('ExecUser') 172955SN/ATraceFlag('ExecKernel') 173955SN/ATraceFlag('ExecAsid') 174955SN/ATraceFlag('Fetch') 1751917SN/ATraceFlag('IntrControl') 176955SN/ATraceFlag('PCEvent') 177955SN/ATraceFlag('Quiesce') 1781730SN/A 179955SN/ACompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 1802521SN/A 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 1812521SN/A 'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread', 1822507SN/A 'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', 1832507SN/A 'ExecAsid' ]) 1842989Ssaidi@eecs.umich.eduCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 1853408Ssaidi@eecs.umich.edu 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting', 1862507SN/A 'ExecUser', 'ExecKernel' ]) 1872507SN/ACompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', 1882507SN/A 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting', 189955SN/A 'ExecUser', 'ExecKernel' ]) 190955SN/A