SConscript revision 8763
12155SN/A# -*- mode:python -*- 22155SN/A 32155SN/A# Copyright (c) 2006 The Regents of The University of Michigan 42155SN/A# All rights reserved. 52155SN/A# 62155SN/A# Redistribution and use in source and binary forms, with or without 72155SN/A# modification, are permitted provided that the following conditions are 82155SN/A# met: redistributions of source code must retain the above copyright 92155SN/A# notice, this list of conditions and the following disclaimer; 102155SN/A# redistributions in binary form must reproduce the above copyright 112155SN/A# notice, this list of conditions and the following disclaimer in the 122155SN/A# documentation and/or other materials provided with the distribution; 132155SN/A# neither the name of the copyright holders nor the names of its 142155SN/A# contributors may be used to endorse or promote products derived from 152155SN/A# this software without specific prior written permission. 162155SN/A# 172155SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182155SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192155SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202155SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212155SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222155SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232155SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242155SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252155SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262155SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272155SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu# 292665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt 302155SN/A 314202Sbinkertn@umich.eduImport('*') 322155SN/A 339850Sandreas.hansson@arm.comif env['TARGET_ISA'] == 'no': 349850Sandreas.hansson@arm.com Return() 359850Sandreas.hansson@arm.com 367768SAli.Saidi@ARM.com################################################################# 377768SAli.Saidi@ARM.com# 388887Sgeoffrey.blake@arm.com# Generate StaticInst execute() method signatures. 392766Sktlim@umich.edu# 404486Sbinkertn@umich.edu# There must be one signature for each CPU model compiled in. 414486Sbinkertn@umich.edu# Since the set of compiled-in models is flexible, we generate a 424776Sgblack@eecs.umich.edu# header containing the appropriate set of signatures on the fly. 434776Sgblack@eecs.umich.edu# 448739Sgblack@eecs.umich.edu################################################################# 456365Sgblack@eecs.umich.edu 4610259SAndrew.Bardsley@arm.com# Template for execute() signature. 474486Sbinkertn@umich.eduexec_sig_template = ''' 484202Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0; 494202Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 504202Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 514202Sbinkertn@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const 5210319SAndreas.Sandberg@ARM.com{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 534202Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc, 544776Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 558739Sgblack@eecs.umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 566365Sgblack@eecs.umich.edu''' 574202Sbinkertn@umich.edu 588777Sgblack@eecs.umich.edumem_ini_sig_template = ''' 594202Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const 609913Ssteve.reinhardt@amd.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN }; 614202Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 624202Sbinkertn@umich.edu''' 635217Ssaidi@eecs.umich.edu 644202Sbinkertn@umich.edumem_comp_sig_template = ''' 6510259SAndrew.Bardsley@arm.comvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 662155SN/A''' 678793Sgblack@eecs.umich.edu 688793Sgblack@eecs.umich.edu# Generate a temporary CPU list, including the CheckerCPU if 698793Sgblack@eecs.umich.edu# it's enabled. This isn't used for anything else other than StaticInst 704776Sgblack@eecs.umich.edu# headers. 718887Sgeoffrey.blake@arm.comtemp_cpu_list = env['CPU_MODELS'][:] 7210201SAndrew.Bardsley@arm.com 738887Sgeoffrey.blake@arm.comif env['USE_CHECKER']: 749340SAndreas.Sandberg@arm.com temp_cpu_list.append('CheckerCPU') 758887Sgeoffrey.blake@arm.com SimObject('CheckerCPU.py') 765192Ssaidi@eecs.umich.edu 778335Snate@binkert.org# Generate header. 788335Snate@binkert.orgdef gen_cpu_exec_signatures(target, source, env): 798335Snate@binkert.org f = open(str(target[0]), 'w') 808335Snate@binkert.org print >> f, ''' 818335Snate@binkert.org#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 829534SAndreas.Sandberg@ARM.com#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 839534SAndreas.Sandberg@ARM.com''' 849534SAndreas.Sandberg@ARM.com for cpu in temp_cpu_list: 858335Snate@binkert.org xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 869534SAndreas.Sandberg@ARM.com print >> f, exec_sig_template % { 'type' : xc_type } 879534SAndreas.Sandberg@ARM.com print >> f, ''' 888335Snate@binkert.org#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 899534SAndreas.Sandberg@ARM.com''' 909534SAndreas.Sandberg@ARM.com 919534SAndreas.Sandberg@ARM.com# Generate string that gets printed when header is rebuilt 929534SAndreas.Sandberg@ARM.comdef gen_sigs_string(target, source, env): 939534SAndreas.Sandberg@ARM.com return " [GENERATE] static_inst_exec_sigs.hh: " \ 949534SAndreas.Sandberg@ARM.com + ', '.join(temp_cpu_list) 959534SAndreas.Sandberg@ARM.com 969534SAndreas.Sandberg@ARM.com# Add command to generate header to environment. 979534SAndreas.Sandberg@ARM.comenv.Command('static_inst_exec_sigs.hh', (), 989534SAndreas.Sandberg@ARM.com Action(gen_cpu_exec_signatures, gen_sigs_string, 9910383Smitch.hayenga@arm.com varlist = temp_cpu_list)) 1008335Snate@binkert.org 1018335Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER'])) 1028471SGiacomo.Gabrielli@arm.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1038335Snate@binkert.org 1048335Snate@binkert.org# List of suppported CPUs by the Checker. Errors out if USE_CHECKER=True 10510529Smorr@cs.wisc.edu# and one of these are not being used. 1065192Ssaidi@eecs.umich.eduCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU'] 1078232Snate@binkert.org 1088232Snate@binkert.orgSimObject('BaseCPU.py') 1098232Snate@binkert.orgSimObject('FuncUnit.py') 1108300Schander.sudanthi@arm.comSimObject('ExeTracer.py') 11110383Smitch.hayenga@arm.comSimObject('IntelTrace.py') 1125192Ssaidi@eecs.umich.eduSimObject('IntrControl.py') 1138300Schander.sudanthi@arm.comSimObject('NativeTrace.py') 1148300Schander.sudanthi@arm.com 1156036Sksewell@umich.eduSource('activity.cc') 1168300Schander.sudanthi@arm.comSource('base.cc') 1178300Schander.sudanthi@arm.comSource('cpuevent.cc') 118Source('decode.cc') 119Source('exetrace.cc') 120Source('func_unit.cc') 121Source('inteltrace.cc') 122Source('intr_control.cc') 123Source('nativetrace.cc') 124Source('pc_event.cc') 125Source('quiesce_event.cc') 126Source('static_inst.cc') 127Source('simple_thread.cc') 128Source('thread_context.cc') 129Source('thread_state.cc') 130 131if env['FULL_SYSTEM']: 132 Source('profile.cc') 133 134 if env['TARGET_ISA'] == 'sparc': 135 SimObject('LegionTrace.py') 136 Source('legiontrace.cc') 137 138if env['USE_CHECKER']: 139 Source('checker/cpu.cc') 140 DebugFlag('Checker') 141 checker_supports = False 142 for i in CheckerSupportedCPUList: 143 if i in env['CPU_MODELS']: 144 checker_supports = True 145 if not checker_supports: 146 print "Checker only supports CPU models", 147 for i in CheckerSupportedCPUList: 148 print i, 149 print ", please set USE_CHECKER=False or use one of those CPU models" 150 Exit(1) 151 152DebugFlag('Activity') 153DebugFlag('Commit') 154DebugFlag('Context') 155DebugFlag('Decode') 156DebugFlag('DynInst') 157DebugFlag('ExecEnable') 158DebugFlag('ExecCPSeq') 159DebugFlag('ExecEffAddr') 160DebugFlag('ExecFaulting', 'Trace faulting instructions') 161DebugFlag('ExecFetchSeq') 162DebugFlag('ExecOpClass') 163DebugFlag('ExecRegDelta') 164DebugFlag('ExecResult') 165DebugFlag('ExecSpeculative') 166DebugFlag('ExecSymbol') 167DebugFlag('ExecThread') 168DebugFlag('ExecTicks') 169DebugFlag('ExecMicro') 170DebugFlag('ExecMacro') 171DebugFlag('ExecUser') 172DebugFlag('ExecKernel') 173DebugFlag('ExecAsid') 174DebugFlag('Fetch') 175DebugFlag('IntrControl') 176DebugFlag('O3PipeView') 177DebugFlag('PCEvent') 178DebugFlag('Quiesce') 179 180CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 181 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 182 'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread', 183 'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', 184 'ExecAsid' ]) 185CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 186 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting', 187 'ExecUser', 'ExecKernel' ]) 188CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', 189 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting', 190 'ExecUser', 'ExecKernel' ]) 191