SConscript revision 8799
14484Sbinkertn@umich.edu# -*- mode:python -*-
24484Sbinkertn@umich.edu
34484Sbinkertn@umich.edu# Copyright (c) 2006 The Regents of The University of Michigan
44484Sbinkertn@umich.edu# All rights reserved.
54484Sbinkertn@umich.edu#
64484Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without
74484Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are
84484Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright
94484Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer;
104484Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright
114484Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the
124484Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution;
134484Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its
144484Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
154484Sbinkertn@umich.edu# this software without specific prior written permission.
164484Sbinkertn@umich.edu#
174484Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
184484Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
194484Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
204484Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
214484Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
224484Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
234484Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
244484Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
254484Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
264484Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
274484Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284484Sbinkertn@umich.edu#
294484Sbinkertn@umich.edu# Authors: Steve Reinhardt
304484Sbinkertn@umich.edu
314494Ssaidi@eecs.umich.eduImport('*')
324484Sbinkertn@umich.edu
336121Snate@binkert.orgif env['TARGET_ISA'] == 'no':
344484Sbinkertn@umich.edu    Return()
358946Sandreas.hansson@arm.com
368946Sandreas.hansson@arm.com#################################################################
374484Sbinkertn@umich.edu#
384484Sbinkertn@umich.edu# Generate StaticInst execute() method signatures.
394484Sbinkertn@umich.edu#
404781Snate@binkert.org# There must be one signature for each CPU model compiled in.
414484Sbinkertn@umich.edu# Since the set of compiled-in models is flexible, we generate a
424484Sbinkertn@umich.edu# header containing the appropriate set of signatures on the fly.
434484Sbinkertn@umich.edu#
444484Sbinkertn@umich.edu#################################################################
458349Sgblack@eecs.umich.edu
468349Sgblack@eecs.umich.edu# Template for execute() signature.
474484Sbinkertn@umich.eduexec_sig_template = '''
484484Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
494484Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
504484Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
514484Sbinkertn@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
524484Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
534484Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
544484Sbinkertn@umich.edu                          Trace::InstRecord *traceData) const
554484Sbinkertn@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
564484Sbinkertn@umich.edu'''
574484Sbinkertn@umich.edu
584484Sbinkertn@umich.edumem_ini_sig_template = '''
594484Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
604484Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
614484Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
624484Sbinkertn@umich.edu'''
634484Sbinkertn@umich.edu
644484Sbinkertn@umich.edumem_comp_sig_template = '''
654484Sbinkertn@umich.eduvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
664484Sbinkertn@umich.edu'''
674484Sbinkertn@umich.edu
684484Sbinkertn@umich.edu# Generate a temporary CPU list, including the CheckerCPU if
694484Sbinkertn@umich.edu# it's enabled.  This isn't used for anything else other than StaticInst
704484Sbinkertn@umich.edu# headers.
714484Sbinkertn@umich.edutemp_cpu_list = env['CPU_MODELS'][:]
724484Sbinkertn@umich.edu
734484Sbinkertn@umich.eduif env['USE_CHECKER']:
744484Sbinkertn@umich.edu    temp_cpu_list.append('CheckerCPU')
754484Sbinkertn@umich.edu    SimObject('CheckerCPU.py')
764484Sbinkertn@umich.edu
774484Sbinkertn@umich.edu# Generate header.
784484Sbinkertn@umich.edudef gen_cpu_exec_signatures(target, source, env):
794484Sbinkertn@umich.edu    f = open(str(target[0]), 'w')
804484Sbinkertn@umich.edu    print >> f, '''
814484Sbinkertn@umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
824484Sbinkertn@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__
834484Sbinkertn@umich.edu'''
844484Sbinkertn@umich.edu    for cpu in temp_cpu_list:
854484Sbinkertn@umich.edu        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
864484Sbinkertn@umich.edu        print >> f, exec_sig_template % { 'type' : xc_type }
874484Sbinkertn@umich.edu    print >> f, '''
884484Sbinkertn@umich.edu#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
894484Sbinkertn@umich.edu'''
904484Sbinkertn@umich.edu
914484Sbinkertn@umich.edu# Generate string that gets printed when header is rebuilt
924484Sbinkertn@umich.edudef gen_sigs_string(target, source, env):
934484Sbinkertn@umich.edu    return " [GENERATE] static_inst_exec_sigs.hh: " \
946121Snate@binkert.org           + ', '.join(temp_cpu_list)
956121Snate@binkert.org
969420Sandreas.hansson@arm.com# Add command to generate header to environment.
978946Sandreas.hansson@arm.comenv.Command('static_inst_exec_sigs.hh', (),
988946Sandreas.hansson@arm.com            Action(gen_cpu_exec_signatures, gen_sigs_string,
998946Sandreas.hansson@arm.com                   varlist = temp_cpu_list))
1008737Skoansin.tan@gmail.com
1018737Skoansin.tan@gmail.comenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER']))
1029388Sandreas.hansson@arm.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1039388Sandreas.hansson@arm.com
1049388Sandreas.hansson@arm.com# List of suppported CPUs by the Checker.  Errors out if USE_CHECKER=True
1059388Sandreas.hansson@arm.com# and one of these are not being used.
1069388Sandreas.hansson@arm.comCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU']
1075765Snate@binkert.org
1085397Ssaidi@eecs.umich.eduSimObject('BaseCPU.py')
1095274Ssaidi@eecs.umich.eduSimObject('FuncUnit.py')
1104494Ssaidi@eecs.umich.eduSimObject('ExeTracer.py')
1114504Ssaidi@eecs.umich.eduSimObject('IntelTrace.py')
1124494Ssaidi@eecs.umich.eduSimObject('IntrControl.py')
1134494Ssaidi@eecs.umich.eduSimObject('NativeTrace.py')
1144496Ssaidi@eecs.umich.edu
1154504Ssaidi@eecs.umich.eduSource('activity.cc')
1164504Ssaidi@eecs.umich.eduSource('base.cc')
1174500Sbinkertn@umich.eduSource('cpuevent.cc')
1184500Sbinkertn@umich.eduSource('decode.cc')
1194496Ssaidi@eecs.umich.eduSource('exetrace.cc')
1204496Ssaidi@eecs.umich.eduSource('func_unit.cc')
1217739Sgblack@eecs.umich.eduSource('inteltrace.cc')
1224487Sstever@eecs.umich.eduSource('intr_control.cc')
1234484Sbinkertn@umich.eduSource('nativetrace.cc')
1244484Sbinkertn@umich.eduSource('pc_event.cc')
1254484Sbinkertn@umich.eduSource('profile.cc')
1264484Sbinkertn@umich.eduSource('quiesce_event.cc')
1274484Sbinkertn@umich.eduSource('static_inst.cc')
1284484Sbinkertn@umich.eduSource('simple_thread.cc')
1295601Snate@binkert.orgSource('thread_context.cc')
1305601Snate@binkert.orgSource('thread_state.cc')
1315601Snate@binkert.org
1325601Snate@binkert.orgif env['TARGET_ISA'] == 'sparc':
1334484Sbinkertn@umich.edu    SimObject('LegionTrace.py')
1346121Snate@binkert.org    Source('legiontrace.cc')
1356121Snate@binkert.org
1366121Snate@binkert.orgif env['USE_CHECKER']:
1374494Ssaidi@eecs.umich.edu    Source('checker/cpu.cc')
138    DebugFlag('Checker')
139    checker_supports = False
140    for i in CheckerSupportedCPUList:
141        if i in env['CPU_MODELS']:
142            checker_supports = True
143    if not checker_supports:
144        print "Checker only supports CPU models",
145        for i in CheckerSupportedCPUList:
146            print i,
147        print ", please set USE_CHECKER=False or use one of those CPU models"
148        Exit(1)
149
150DebugFlag('Activity')
151DebugFlag('Commit')
152DebugFlag('Context')
153DebugFlag('Decode')
154DebugFlag('DynInst')
155DebugFlag('ExecEnable')
156DebugFlag('ExecCPSeq')
157DebugFlag('ExecEffAddr')
158DebugFlag('ExecFaulting', 'Trace faulting instructions')
159DebugFlag('ExecFetchSeq')
160DebugFlag('ExecOpClass')
161DebugFlag('ExecRegDelta')
162DebugFlag('ExecResult')
163DebugFlag('ExecSpeculative')
164DebugFlag('ExecSymbol')
165DebugFlag('ExecThread')
166DebugFlag('ExecTicks')
167DebugFlag('ExecMicro')
168DebugFlag('ExecMacro')
169DebugFlag('ExecUser')
170DebugFlag('ExecKernel')
171DebugFlag('ExecAsid')
172DebugFlag('Fetch')
173DebugFlag('IntrControl')
174DebugFlag('O3PipeView')
175DebugFlag('PCEvent')
176DebugFlag('Quiesce')
177
178CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
179    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
180    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
181    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
182    'ExecAsid' ])
183CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
184    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
185    'ExecUser', 'ExecKernel' ])
186CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
187    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
188    'ExecUser', 'ExecKernel' ])
189