SConscript revision 5334
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.com################################################################# 349850Sandreas.hansson@arm.com# 359850Sandreas.hansson@arm.com# Generate StaticInst execute() method signatures. 367768SAli.Saidi@ARM.com# 377768SAli.Saidi@ARM.com# There must be one signature for each CPU model compiled in. 3810695SAli.Saidi@ARM.com# Since the set of compiled-in models is flexible, we generate a 3910695SAli.Saidi@ARM.com# header containing the appropriate set of signatures on the fly. 4010695SAli.Saidi@ARM.com# 4110695SAli.Saidi@ARM.com################################################################# 4210695SAli.Saidi@ARM.com 438887Sgeoffrey.blake@arm.com# CPU model-specific data is contained in cpu_models.py 442766Sktlim@umich.edu# Convert to SCons File node to get path handling 454486Sbinkertn@umich.edumodels_db = File('cpu_models.py') 4610663SAli.Saidi@ARM.com# slurp in contents of file 474486Sbinkertn@umich.eduexecfile(models_db.srcnode().abspath) 488739Sgblack@eecs.umich.edu 4910259SAndrew.Bardsley@arm.com# Template for execute() signature. 504486Sbinkertn@umich.eduexec_sig_template = ''' 514202Sbinkertn@umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; 524202Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const 534202Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN }; 544202Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %s *xc, 5510319SAndreas.Sandberg@ARM.com Trace::InstRecord *traceData) const 564202Sbinkertn@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN }; 574776Sgblack@eecs.umich.edu''' 588739Sgblack@eecs.umich.edu 596365Sgblack@eecs.umich.edumem_ini_sig_template = ''' 604202Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN }; 618777Sgblack@eecs.umich.edu''' 624202Sbinkertn@umich.edu 639913Ssteve.reinhardt@amd.commem_comp_sig_template = ''' 644202Sbinkertn@umich.eduvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN }; 654202Sbinkertn@umich.edu''' 665217Ssaidi@eecs.umich.edu 674202Sbinkertn@umich.edu# Generate a temporary CPU list, including the CheckerCPU if 6810259SAndrew.Bardsley@arm.com# it's enabled. This isn't used for anything else other than StaticInst 692155SN/A# headers. 708887Sgeoffrey.blake@arm.comtemp_cpu_list = env['CPU_MODELS'][:] 7110201SAndrew.Bardsley@arm.com 728887Sgeoffrey.blake@arm.comif env['USE_CHECKER']: 739340SAndreas.Sandberg@arm.com temp_cpu_list.append('CheckerCPU') 748887Sgeoffrey.blake@arm.com 755192Ssaidi@eecs.umich.edu# Generate header. 768335Snate@binkert.orgdef gen_cpu_exec_signatures(target, source, env): 778335Snate@binkert.org f = open(str(target[0]), 'w') 788335Snate@binkert.org print >> f, ''' 798335Snate@binkert.org#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__ 808335Snate@binkert.org#define __CPU_STATIC_INST_EXEC_SIGS_HH__ 819534SAndreas.Sandberg@ARM.com''' 829534SAndreas.Sandberg@ARM.com for cpu in temp_cpu_list: 839534SAndreas.Sandberg@ARM.com xc_type = CpuModel.dict[cpu].strings['CPU_exec_context'] 848335Snate@binkert.org print >> f, exec_sig_template % (xc_type, xc_type, xc_type) 859534SAndreas.Sandberg@ARM.com print >> f, ''' 869534SAndreas.Sandberg@ARM.com#endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ 878335Snate@binkert.org''' 889534SAndreas.Sandberg@ARM.com 899534SAndreas.Sandberg@ARM.com# Generate string that gets printed when header is rebuilt 909534SAndreas.Sandberg@ARM.comdef gen_sigs_string(target, source, env): 919534SAndreas.Sandberg@ARM.com return "Generating static_inst_exec_sigs.hh: " \ 929534SAndreas.Sandberg@ARM.com + ', '.join(temp_cpu_list) 939534SAndreas.Sandberg@ARM.com 949534SAndreas.Sandberg@ARM.com# Add command to generate header to environment. 959534SAndreas.Sandberg@ARM.comenv.Command('static_inst_exec_sigs.hh', models_db, 969534SAndreas.Sandberg@ARM.com Action(gen_cpu_exec_signatures, gen_sigs_string, 9710383Smitch.hayenga@arm.com varlist = temp_cpu_list)) 988335Snate@binkert.org 998335Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER'])) 1008471SGiacomo.Gabrielli@arm.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS'])) 1018335Snate@binkert.org 1028335Snate@binkert.org# List of suppported CPUs by the Checker. Errors out if USE_CHECKER=True 10310529Smorr@cs.wisc.edu# and one of these are not being used. 1045192Ssaidi@eecs.umich.eduCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU'] 1058232Snate@binkert.org 1068232Snate@binkert.orgSimObject('BaseCPU.py') 10710664SAli.Saidi@ARM.comSimObject('FuncUnit.py') 1088300Schander.sudanthi@arm.comSimObject('ExeTracer.py') 10910383Smitch.hayenga@arm.comSimObject('IntelTrace.py') 1105192Ssaidi@eecs.umich.edu 1118300Schander.sudanthi@arm.comSource('activity.cc') 1128300Schander.sudanthi@arm.comSource('base.cc') 1136036Sksewell@umich.eduSource('cpuevent.cc') 1148300Schander.sudanthi@arm.comSource('exetrace.cc') 1158300Schander.sudanthi@arm.comSource('func_unit.cc') 116Source('inteltrace.cc') 117Source('pc_event.cc') 118Source('quiesce_event.cc') 119Source('static_inst.cc') 120Source('simple_thread.cc') 121Source('thread_context.cc') 122Source('thread_state.cc') 123 124if env['FULL_SYSTEM']: 125 SimObject('IntrControl.py') 126 127 Source('intr_control.cc') 128 Source('profile.cc') 129 130 if env['TARGET_ISA'] == 'sparc': 131 SimObject('LegionTrace.py') 132 Source('legiontrace.cc') 133 134if env['TARGET_ISA'] == 'x86': 135 SimObject('NativeTrace.py') 136 Source('nativetrace.cc') 137 138if env['USE_CHECKER']: 139 Source('checker/cpu.cc') 140 TraceFlag('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 152TraceFlag('Activity') 153TraceFlag('Commit') 154TraceFlag('Context') 155TraceFlag('Decode') 156TraceFlag('DynInst') 157TraceFlag('ExecEnable') 158TraceFlag('ExecCPSeq') 159TraceFlag('ExecEffAddr') 160TraceFlag('ExecFetchSeq') 161TraceFlag('ExecOpClass') 162TraceFlag('ExecRegDelta') 163TraceFlag('ExecResult') 164TraceFlag('ExecSpeculative') 165TraceFlag('ExecSymbol') 166TraceFlag('ExecThread') 167TraceFlag('ExecTicks') 168TraceFlag('Fetch') 169TraceFlag('IntrControl') 170TraceFlag('PCEvent') 171TraceFlag('Quiesce') 172 173CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', 174 'ExecEffAddr', 'ExecResult', 'ExecSymbol' ]) 175