SConscript revision 8232:b28d06a175be
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# 294762Snate@binkert.org# Authors: Steve Reinhardt 30955SN/A 315522Snate@binkert.orgImport('*') 326143Snate@binkert.org 334762Snate@binkert.orgif env['TARGET_ISA'] == 'no': 345522Snate@binkert.org Return() 35955SN/A 365522Snate@binkert.org################################################################# 3711974Sgabeblack@google.com# 38955SN/A# Generate StaticInst execute() method signatures. 395522Snate@binkert.org# 404202Sbinkertn@umich.edu# There must be one signature for each CPU model compiled in. 415742Snate@binkert.org# Since the set of compiled-in models is flexible, we generate a 42955SN/A# header containing the appropriate set of signatures on the fly. 434381Sbinkertn@umich.edu# 444381Sbinkertn@umich.edu################################################################# 458334Snate@binkert.org 46955SN/A# Template for execute() signature. 47955SN/Aexec_sig_template = ''' 484202Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0; 49955SN/Avirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 504382Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 514382Sbinkertn@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const 524382Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 536654Snate@binkert.orgvirtual Fault completeAcc(Packet *pkt, %(type)s *xc, 545517Snate@binkert.org Trace::InstRecord *traceData) const 558614Sgblack@eecs.umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 567674Snate@binkert.org''' 576143Snate@binkert.org 586143Snate@binkert.orgmem_ini_sig_template = ''' 596143Snate@binkert.orgvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 608233Snate@binkert.org{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 618233Snate@binkert.orgvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 628233Snate@binkert.org''' 638233Snate@binkert.org 648233Snate@binkert.orgmem_comp_sig_template = ''' 658334Snate@binkert.orgvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 668334Snate@binkert.org''' 6710453SAndrew.Bardsley@arm.com 6810453SAndrew.Bardsley@arm.com# Generate a temporary CPU list, including the CheckerCPU if 698233Snate@binkert.org# it's enabled. This isn't used for anything else other than StaticInst 708233Snate@binkert.org# headers. 718233Snate@binkert.orgtemp_cpu_list = env['CPU_MODELS'][:] 728233Snate@binkert.org 738233Snate@binkert.orgif env['USE_CHECKER']: 748233Snate@binkert.org temp_cpu_list.append('CheckerCPU') 7511983Sgabeblack@google.com SimObject('CheckerCPU.py') 7611983Sgabeblack@google.com 7711983Sgabeblack@google.com# Generate header. 7811983Sgabeblack@google.comdef gen_cpu_exec_signatures(target, source, env): 7911983Sgabeblack@google.com f = open(str(target[0]), 'w') 8011983Sgabeblack@google.com print >> f, ''' 8111983Sgabeblack@google.com#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 8211983Sgabeblack@google.com#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 8311983Sgabeblack@google.com''' 8411983Sgabeblack@google.com for cpu in temp_cpu_list: 8511983Sgabeblack@google.com xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 866143Snate@binkert.org print >> f, exec_sig_template % { 'type' : xc_type } 878233Snate@binkert.org print >> f, ''' 888233Snate@binkert.org#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 898233Snate@binkert.org''' 906143Snate@binkert.org 916143Snate@binkert.org# Generate string that gets printed when header is rebuilt 926143Snate@binkert.orgdef gen_sigs_string(target, source, env): 9311308Santhony.gutierrez@amd.com return " [GENERATE] static_inst_exec_sigs.hh: " \ 948233Snate@binkert.org + ', '.join(temp_cpu_list) 958233Snate@binkert.org 968233Snate@binkert.org# Add command to generate header to environment. 9711983Sgabeblack@google.comenv.Command('static_inst_exec_sigs.hh', (), 9811983Sgabeblack@google.com Action(gen_cpu_exec_signatures, gen_sigs_string, 994762Snate@binkert.org varlist = temp_cpu_list)) 1006143Snate@binkert.org 1018233Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER'])) 1028233Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1038233Snate@binkert.org 1048233Snate@binkert.org# List of suppported CPUs by the Checker. Errors out if USE_CHECKER=True 1058233Snate@binkert.org# and one of these are not being used. 1066143Snate@binkert.orgCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU'] 1078233Snate@binkert.org 1088233Snate@binkert.orgSimObject('BaseCPU.py') 1098233Snate@binkert.orgSimObject('FuncUnit.py') 1108233Snate@binkert.orgSimObject('ExeTracer.py') 1116143Snate@binkert.orgSimObject('IntelTrace.py') 1126143Snate@binkert.orgSimObject('NativeTrace.py') 1136143Snate@binkert.org 1146143Snate@binkert.orgSource('activity.cc') 1156143Snate@binkert.orgSource('base.cc') 1166143Snate@binkert.orgSource('cpuevent.cc') 1176143Snate@binkert.orgSource('exetrace.cc') 1186143Snate@binkert.orgSource('func_unit.cc') 1196143Snate@binkert.orgSource('inteltrace.cc') 1207065Snate@binkert.orgSource('nativetrace.cc') 1216143Snate@binkert.orgSource('pc_event.cc') 1228233Snate@binkert.orgSource('quiesce_event.cc') 1238233Snate@binkert.orgSource('static_inst.cc') 1248233Snate@binkert.orgSource('simple_thread.cc') 1258233Snate@binkert.orgSource('thread_context.cc') 1268233Snate@binkert.orgSource('thread_state.cc') 1278233Snate@binkert.org 1288233Snate@binkert.orgif env['FULL_SYSTEM']: 1298233Snate@binkert.org SimObject('IntrControl.py') 1308233Snate@binkert.org 1318233Snate@binkert.org Source('intr_control.cc') 1328233Snate@binkert.org Source('profile.cc') 1338233Snate@binkert.org 1348233Snate@binkert.org if env['TARGET_ISA'] == 'sparc': 1358233Snate@binkert.org SimObject('LegionTrace.py') 1368233Snate@binkert.org Source('legiontrace.cc') 1378233Snate@binkert.org 1388233Snate@binkert.orgif env['USE_CHECKER']: 1398233Snate@binkert.org Source('checker/cpu.cc') 1408233Snate@binkert.org TraceFlag('Checker') 1418233Snate@binkert.org checker_supports = False 1428233Snate@binkert.org for i in CheckerSupportedCPUList: 1438233Snate@binkert.org if i in env['CPU_MODELS']: 1448233Snate@binkert.org checker_supports = True 1458233Snate@binkert.org if not checker_supports: 1468233Snate@binkert.org print "Checker only supports CPU models", 1478233Snate@binkert.org for i in CheckerSupportedCPUList: 1488233Snate@binkert.org print i, 1498233Snate@binkert.org print ", please set USE_CHECKER=False or use one of those CPU models" 1508233Snate@binkert.org Exit(1) 1518233Snate@binkert.org 1528233Snate@binkert.orgTraceFlag('Activity') 1536143Snate@binkert.orgTraceFlag('Commit') 1546143Snate@binkert.orgTraceFlag('Context') 1556143Snate@binkert.orgTraceFlag('Decode') 1566143Snate@binkert.orgTraceFlag('DynInst') 1576143Snate@binkert.orgTraceFlag('ExecEnable') 1586143Snate@binkert.orgTraceFlag('ExecCPSeq') 1599982Satgutier@umich.eduTraceFlag('ExecEffAddr') 16010196SCurtis.Dunham@arm.comTraceFlag('ExecFaulting', 'Trace faulting instructions') 16110196SCurtis.Dunham@arm.comTraceFlag('ExecFetchSeq') 16210196SCurtis.Dunham@arm.comTraceFlag('ExecOpClass') 16310196SCurtis.Dunham@arm.comTraceFlag('ExecRegDelta') 16410196SCurtis.Dunham@arm.comTraceFlag('ExecResult') 16510196SCurtis.Dunham@arm.comTraceFlag('ExecSpeculative') 16610196SCurtis.Dunham@arm.comTraceFlag('ExecSymbol') 16710196SCurtis.Dunham@arm.comTraceFlag('ExecThread') 1686143Snate@binkert.orgTraceFlag('ExecTicks') 16911983Sgabeblack@google.comTraceFlag('ExecMicro') 17011983Sgabeblack@google.comTraceFlag('ExecMacro') 17111983Sgabeblack@google.comTraceFlag('Fetch') 17211983Sgabeblack@google.comTraceFlag('IntrControl') 17311983Sgabeblack@google.comTraceFlag('PCEvent') 17411983Sgabeblack@google.comTraceFlag('Quiesce') 17511983Sgabeblack@google.com 17611983Sgabeblack@google.comCompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 17711983Sgabeblack@google.com 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 1786143Snate@binkert.org 'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread', 17911988Sandreas.sandberg@arm.com 'ExecTicks', 'ExecMicro', 'ExecMacro' ]) 1808233Snate@binkert.orgCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 1818233Snate@binkert.org 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting' ]) 1826143Snate@binkert.orgCompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', 1838945Ssteve.reinhardt@amd.com 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting' ]) 1846143Snate@binkert.org