SConscript revision 9401
12929Sktlim@umich.edu# -*- mode:python -*- 22929Sktlim@umich.edu 32932Sktlim@umich.edu# Copyright (c) 2006 The Regents of The University of Michigan 42929Sktlim@umich.edu# All rights reserved. 52929Sktlim@umich.edu# 62929Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without 72929Sktlim@umich.edu# modification, are permitted provided that the following conditions are 82929Sktlim@umich.edu# met: redistributions of source code must retain the above copyright 92929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer; 102929Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright 112929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the 122929Sktlim@umich.edu# documentation and/or other materials provided with the distribution; 132929Sktlim@umich.edu# neither the name of the copyright holders nor the names of its 142929Sktlim@umich.edu# contributors may be used to endorse or promote products derived from 152929Sktlim@umich.edu# this software without specific prior written permission. 162929Sktlim@umich.edu# 172929Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182929Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192929Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202929Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212929Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222929Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232929Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242929Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252929Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262929Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272929Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282932Sktlim@umich.edu# 292932Sktlim@umich.edu# Authors: Steve Reinhardt 302932Sktlim@umich.edu 312929Sktlim@umich.eduImport('*') 326007Ssteve.reinhardt@amd.com 337735SAli.Saidi@ARM.comif env['TARGET_ISA'] == 'no': 342929Sktlim@umich.edu Return() 352929Sktlim@umich.edu 362929Sktlim@umich.edu################################################################# 372929Sktlim@umich.edu# 382929Sktlim@umich.edu# Generate StaticInst execute() method signatures. 392929Sktlim@umich.edu# 402929Sktlim@umich.edu# There must be one signature for each CPU model compiled in. 418947Sandreas.hansson@arm.com# Since the set of compiled-in models is flexible, we generate a 428947Sandreas.hansson@arm.com# header containing the appropriate set of signatures on the fly. 438947Sandreas.hansson@arm.com# 442929Sktlim@umich.edu################################################################# 452929Sktlim@umich.edu 462929Sktlim@umich.edu# Template for execute() signature. 472929Sktlim@umich.eduexec_sig_template = ''' 482929Sktlim@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0; 492929Sktlim@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 506007Ssteve.reinhardt@amd.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 516007Ssteve.reinhardt@amd.comvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const 526007Ssteve.reinhardt@amd.com{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 536007Ssteve.reinhardt@amd.comvirtual Fault completeAcc(Packet *pkt, %(type)s *xc, 546007Ssteve.reinhardt@amd.com Trace::InstRecord *traceData) const 556007Ssteve.reinhardt@amd.com{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 566007Ssteve.reinhardt@amd.com''' 576007Ssteve.reinhardt@amd.com 586007Ssteve.reinhardt@amd.commem_ini_sig_template = ''' 596007Ssteve.reinhardt@amd.comvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 606007Ssteve.reinhardt@amd.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 616007Ssteve.reinhardt@amd.comvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 626007Ssteve.reinhardt@amd.com''' 636007Ssteve.reinhardt@amd.com 646007Ssteve.reinhardt@amd.commem_comp_sig_template = ''' 656007Ssteve.reinhardt@amd.comvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 669435SAndreas.Sandberg@ARM.com''' 679435SAndreas.Sandberg@ARM.com 689435SAndreas.Sandberg@ARM.com# Generate a temporary CPU list, including the CheckerCPU if 696007Ssteve.reinhardt@amd.com# it's enabled. This isn't used for anything else other than StaticInst 706007Ssteve.reinhardt@amd.com# headers. 716007Ssteve.reinhardt@amd.comtemp_cpu_list = env['CPU_MODELS'][:] 726007Ssteve.reinhardt@amd.comtemp_cpu_list.append('CheckerCPU') 736007Ssteve.reinhardt@amd.comSimObject('CheckerCPU.py') 746007Ssteve.reinhardt@amd.com 756007Ssteve.reinhardt@amd.com# Generate header. 766007Ssteve.reinhardt@amd.comdef gen_cpu_exec_signatures(target, source, env): 776007Ssteve.reinhardt@amd.com f = open(str(target[0]), 'w') 786007Ssteve.reinhardt@amd.com print >> f, ''' 792929Sktlim@umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 802929Sktlim@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 812929Sktlim@umich.edu''' 826007Ssteve.reinhardt@amd.com for cpu in temp_cpu_list: 836007Ssteve.reinhardt@amd.com xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 846007Ssteve.reinhardt@amd.com print >> f, exec_sig_template % { 'type' : xc_type } 856007Ssteve.reinhardt@amd.com print >> f, ''' 866007Ssteve.reinhardt@amd.com#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 876007Ssteve.reinhardt@amd.com''' 882929Sktlim@umich.edu 892929Sktlim@umich.edu# Generate string that gets printed when header is rebuilt 902929Sktlim@umich.edudef gen_sigs_string(target, source, env): 912929Sktlim@umich.edu return " [GENERATE] static_inst_exec_sigs.hh: " \ 922929Sktlim@umich.edu + ', '.join(temp_cpu_list) 936011Ssteve.reinhardt@amd.com 946007Ssteve.reinhardt@amd.com# Add command to generate header to environment. 956007Ssteve.reinhardt@amd.comenv.Command('static_inst_exec_sigs.hh', (), 966007Ssteve.reinhardt@amd.com Action(gen_cpu_exec_signatures, gen_sigs_string, 976007Ssteve.reinhardt@amd.com varlist = temp_cpu_list)) 986007Ssteve.reinhardt@amd.com 996007Ssteve.reinhardt@amd.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1006007Ssteve.reinhardt@amd.com 1016007Ssteve.reinhardt@amd.comSimObject('BaseCPU.py') 1026007Ssteve.reinhardt@amd.comSimObject('FuncUnit.py') 1036007Ssteve.reinhardt@amd.comSimObject('ExeTracer.py') 1046007Ssteve.reinhardt@amd.comSimObject('IntelTrace.py') 1056007Ssteve.reinhardt@amd.comSimObject('IntrControl.py') 1066007Ssteve.reinhardt@amd.comSimObject('NativeTrace.py') 1076007Ssteve.reinhardt@amd.com 1087735SAli.Saidi@ARM.comSource('activity.cc') 1096011Ssteve.reinhardt@amd.comSource('base.cc') 1106007Ssteve.reinhardt@amd.comSource('cpuevent.cc') 1116007Ssteve.reinhardt@amd.comSource('exetrace.cc') 1126007Ssteve.reinhardt@amd.comSource('func_unit.cc') 1136007Ssteve.reinhardt@amd.comSource('inteltrace.cc') 1147735SAli.Saidi@ARM.comSource('intr_control.cc') 1157735SAli.Saidi@ARM.comSource('nativetrace.cc') 1167735SAli.Saidi@ARM.comSource('pc_event.cc') 1177735SAli.Saidi@ARM.comSource('profile.cc') 1187735SAli.Saidi@ARM.comSource('quiesce_event.cc') 1197735SAli.Saidi@ARM.comSource('static_inst.cc') 1207735SAli.Saidi@ARM.comSource('simple_thread.cc') 1217735SAli.Saidi@ARM.comSource('thread_context.cc') 1227735SAli.Saidi@ARM.comSource('thread_state.cc') 1237735SAli.Saidi@ARM.com 1247735SAli.Saidi@ARM.comif env['TARGET_ISA'] == 'sparc': 1257735SAli.Saidi@ARM.com SimObject('LegionTrace.py') 1267735SAli.Saidi@ARM.com Source('legiontrace.cc') 1277735SAli.Saidi@ARM.com 1286007Ssteve.reinhardt@amd.comSimObject('DummyChecker.py') 1298599Ssteve.reinhardt@amd.comSource('checker/cpu.cc') 1308599Ssteve.reinhardt@amd.comSource('dummy_checker.cc') 1318599Ssteve.reinhardt@amd.comDebugFlag('Checker') 1326007Ssteve.reinhardt@amd.com 1336011Ssteve.reinhardt@amd.comDebugFlag('Activity') 1346007Ssteve.reinhardt@amd.comDebugFlag('Commit') 1356007Ssteve.reinhardt@amd.comDebugFlag('Context') 1366007Ssteve.reinhardt@amd.comDebugFlag('Decode') 1376007Ssteve.reinhardt@amd.comDebugFlag('DynInst') 1386007Ssteve.reinhardt@amd.comDebugFlag('ExecEnable') 1396007Ssteve.reinhardt@amd.comDebugFlag('ExecCPSeq') 1406011Ssteve.reinhardt@amd.comDebugFlag('ExecEffAddr') 1416007Ssteve.reinhardt@amd.comDebugFlag('ExecFaulting', 'Trace faulting instructions') 1426007Ssteve.reinhardt@amd.comDebugFlag('ExecFetchSeq') 1436007Ssteve.reinhardt@amd.comDebugFlag('ExecOpClass') 1446007Ssteve.reinhardt@amd.comDebugFlag('ExecRegDelta') 1456007Ssteve.reinhardt@amd.comDebugFlag('ExecResult') 1466008Ssteve.reinhardt@amd.comDebugFlag('ExecSpeculative') 1476007Ssteve.reinhardt@amd.comDebugFlag('ExecSymbol') 1486008Ssteve.reinhardt@amd.comDebugFlag('ExecThread') 1496008Ssteve.reinhardt@amd.comDebugFlag('ExecTicks') 1506008Ssteve.reinhardt@amd.comDebugFlag('ExecMicro') 1516008Ssteve.reinhardt@amd.comDebugFlag('ExecMacro') 1526008Ssteve.reinhardt@amd.comDebugFlag('ExecUser') 1539401SAndreas.Sandberg@ARM.comDebugFlag('ExecKernel') 1549401SAndreas.Sandberg@ARM.comDebugFlag('ExecAsid') 1559401SAndreas.Sandberg@ARM.comDebugFlag('Fetch') 1566008Ssteve.reinhardt@amd.comDebugFlag('IntrControl') 1576008Ssteve.reinhardt@amd.comDebugFlag('O3PipeView') 1586007Ssteve.reinhardt@amd.comDebugFlag('PCEvent') 1596007Ssteve.reinhardt@amd.comDebugFlag('Quiesce') 1606007Ssteve.reinhardt@amd.com 1616007Ssteve.reinhardt@amd.comCompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 1626007Ssteve.reinhardt@amd.com 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 1632929Sktlim@umich.edu 'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread', 1642929Sktlim@umich.edu 'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', 1659401SAndreas.Sandberg@ARM.com 'ExecAsid' ]) 1669401SAndreas.Sandberg@ARM.comCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 1672929Sktlim@umich.edu 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting', 1682929Sktlim@umich.edu 'ExecUser', 'ExecKernel' ]) 1696007Ssteve.reinhardt@amd.comCompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', 1706007Ssteve.reinhardt@amd.com 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting', 1712929Sktlim@umich.edu 'ExecUser', 'ExecKernel' ]) 1722929Sktlim@umich.edu