SConscript revision 10201
13534Sgblack@eecs.umich.edu# -*- mode:python -*- 23534Sgblack@eecs.umich.edu 33534Sgblack@eecs.umich.edu# Copyright (c) 2006 The Regents of The University of Michigan 43534Sgblack@eecs.umich.edu# All rights reserved. 53534Sgblack@eecs.umich.edu# 63534Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 73534Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 83534Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 93534Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 103534Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 113534Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 123534Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 133534Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 143534Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 153534Sgblack@eecs.umich.edu# this software without specific prior written permission. 163534Sgblack@eecs.umich.edu# 173534Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 183534Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 193534Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 203534Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 213534Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 223534Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 233534Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 243534Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 253534Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 263534Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 273534Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 283534Sgblack@eecs.umich.edu# 293534Sgblack@eecs.umich.edu# Authors: Steve Reinhardt 303534Sgblack@eecs.umich.edu 313534Sgblack@eecs.umich.eduImport('*') 324202Sbinkertn@umich.edu 333534Sgblack@eecs.umich.eduif env['TARGET_ISA'] == 'null': 3410069Sandreas.hansson@arm.com SimObject('IntrControl.py') 3510069Sandreas.hansson@arm.com Source('intr_control_noisa.cc') 3610069Sandreas.hansson@arm.com Return() 3710069Sandreas.hansson@arm.com 3810069Sandreas.hansson@arm.com################################################################# 399850Sandreas.hansson@arm.com# 407768SAli.Saidi@ARM.com# Generate StaticInst execute() method signatures. 417768SAli.Saidi@ARM.com# 428739Sgblack@eecs.umich.edu# There must be one signature for each CPU model compiled in. 438739Sgblack@eecs.umich.edu# Since the set of compiled-in models is flexible, we generate a 448739Sgblack@eecs.umich.edu# header containing the appropriate set of signatures on the fly. 458739Sgblack@eecs.umich.edu# 4610800SPeter.Enns@arm.com################################################################# 478739Sgblack@eecs.umich.edu 488739Sgblack@eecs.umich.edu# Template for execute() signature. 498739Sgblack@eecs.umich.eduexec_sig_template = ''' 508739Sgblack@eecs.umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0; 518739Sgblack@eecs.umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 528739Sgblack@eecs.umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 534486Sbinkertn@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const 548739Sgblack@eecs.umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 558739Sgblack@eecs.umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc, 568739Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 579016Sandreas.hansson@arm.com{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 588739Sgblack@eecs.umich.edu''' 598739Sgblack@eecs.umich.edu 608739Sgblack@eecs.umich.edumem_ini_sig_template = ''' 618739Sgblack@eecs.umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 628739Sgblack@eecs.umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 6310923Sgabor.dozsa@arm.comvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 6410923Sgabor.dozsa@arm.com''' 6510923Sgabor.dozsa@arm.com 6610923Sgabor.dozsa@arm.commem_comp_sig_template = ''' 678739Sgblack@eecs.umich.eduvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 688739Sgblack@eecs.umich.edu''' 6910800SPeter.Enns@arm.com 708739Sgblack@eecs.umich.edu# Generate a temporary CPU list, including the CheckerCPU if 718739Sgblack@eecs.umich.edu# it's enabled. This isn't used for anything else other than StaticInst 728739Sgblack@eecs.umich.edu# headers. 738739Sgblack@eecs.umich.edutemp_cpu_list = env['CPU_MODELS'][:] 748739Sgblack@eecs.umich.edutemp_cpu_list.append('CheckerCPU') 758739Sgblack@eecs.umich.eduSimObject('CheckerCPU.py') 768739Sgblack@eecs.umich.edu 778739Sgblack@eecs.umich.edu# Generate header. 788739Sgblack@eecs.umich.edudef gen_cpu_exec_signatures(target, source, env): 798739Sgblack@eecs.umich.edu f = open(str(target[0]), 'w') 808739Sgblack@eecs.umich.edu print >> f, ''' 818739Sgblack@eecs.umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 828739Sgblack@eecs.umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 838739Sgblack@eecs.umich.edu''' 848739Sgblack@eecs.umich.edu for cpu in temp_cpu_list: 858739Sgblack@eecs.umich.edu xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 865192Ssaidi@eecs.umich.edu print >> f, exec_sig_template % { 'type' : xc_type } 878739Sgblack@eecs.umich.edu print >> f, ''' 888739Sgblack@eecs.umich.edu#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 898739Sgblack@eecs.umich.edu''' 908739Sgblack@eecs.umich.edu 918739Sgblack@eecs.umich.edu# Generate string that gets printed when header is rebuilt 9210923Sgabor.dozsa@arm.comdef gen_sigs_string(target, source, env): 9310923Sgabor.dozsa@arm.com return " [GENERATE] static_inst_exec_sigs.hh: " \ 948739Sgblack@eecs.umich.edu + ', '.join(temp_cpu_list) 958739Sgblack@eecs.umich.edu 968739Sgblack@eecs.umich.edu# Add command to generate header to environment. 978739Sgblack@eecs.umich.eduenv.Command('static_inst_exec_sigs.hh', (), 988739Sgblack@eecs.umich.edu Action(gen_cpu_exec_signatures, gen_sigs_string, 998739Sgblack@eecs.umich.edu varlist = temp_cpu_list)) 1008739Sgblack@eecs.umich.edu 1018739Sgblack@eecs.umich.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1028739Sgblack@eecs.umich.edu 1038739Sgblack@eecs.umich.eduSimObject('BaseCPU.py') 1048739Sgblack@eecs.umich.eduSimObject('FuncUnit.py') 1058739Sgblack@eecs.umich.eduSimObject('ExeTracer.py') 1068739Sgblack@eecs.umich.eduSimObject('IntelTrace.py') 1078739Sgblack@eecs.umich.eduSimObject('IntrControl.py') 1088739Sgblack@eecs.umich.eduSimObject('NativeTrace.py') 1098739Sgblack@eecs.umich.edu 1108739Sgblack@eecs.umich.eduSource('activity.cc') 1118739Sgblack@eecs.umich.eduSource('base.cc') 1128739Sgblack@eecs.umich.eduSource('cpuevent.cc') 1135192Ssaidi@eecs.umich.eduSource('exetrace.cc') 1148739Sgblack@eecs.umich.eduSource('func_unit.cc') 1158739Sgblack@eecs.umich.eduSource('inteltrace.cc') 1168739Sgblack@eecs.umich.eduSource('intr_control.cc') 1178739Sgblack@eecs.umich.eduSource('nativetrace.cc') 1188739Sgblack@eecs.umich.eduSource('pc_event.cc') 1198739Sgblack@eecs.umich.eduSource('profile.cc') 1208739Sgblack@eecs.umich.eduSource('quiesce_event.cc') 121Source('reg_class.cc') 122Source('static_inst.cc') 123Source('simple_thread.cc') 124Source('thread_context.cc') 125Source('thread_state.cc') 126 127if env['TARGET_ISA'] == 'sparc': 128 SimObject('LegionTrace.py') 129 Source('legiontrace.cc') 130 131SimObject('DummyChecker.py') 132SimObject('StaticInstFlags.py') 133Source('checker/cpu.cc') 134Source('dummy_checker.cc') 135DebugFlag('Checker') 136 137DebugFlag('Activity') 138DebugFlag('Commit') 139DebugFlag('Context') 140DebugFlag('Decode') 141DebugFlag('DynInst') 142DebugFlag('ExecEnable', 'Filter: Enable exec tracing (no tracing without this)') 143DebugFlag('ExecCPSeq', 'Format: Instruction sequence number') 144DebugFlag('ExecEffAddr', 'Format: Include effective address') 145DebugFlag('ExecFaulting', 'Trace faulting instructions') 146DebugFlag('ExecFetchSeq', 'Format: Fetch sequence number') 147DebugFlag('ExecOpClass', 'Format: Include operand class') 148DebugFlag('ExecRegDelta') 149DebugFlag('ExecResult', 'Format: Include results from execution') 150DebugFlag('ExecSpeculative', 'Format: Include a miss-/speculation flag (-/+)') 151DebugFlag('ExecSymbol', 'Format: Try to include symbol names') 152DebugFlag('ExecThread', 'Format: Include thread ID in trace') 153DebugFlag('ExecTicks', 'Format: Include tick count') 154DebugFlag('ExecMicro', 'Filter: Include microops') 155DebugFlag('ExecMacro', 'Filter: Include macroops') 156DebugFlag('ExecUser', 'Filter: Trace user mode instructions') 157DebugFlag('ExecKernel', 'Filter: Trace kernel mode instructions') 158DebugFlag('ExecAsid', 'Format: Include ASID in trace') 159DebugFlag('Fetch') 160DebugFlag('IntrControl') 161DebugFlag('O3PipeView') 162DebugFlag('PCEvent') 163DebugFlag('Quiesce') 164 165CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 166 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 167 'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread', 168 'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', 169 'ExecAsid' ]) 170CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 171 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting', 172 'ExecUser', 'ExecKernel' ]) 173CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', 174 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting', 175 'ExecUser', 'ExecKernel' ]) 176