SConscript revision 9398
18889Sgeoffrey.blake@arm.com# -*- mode:python -*-
28889Sgeoffrey.blake@arm.com
311960Sgabeblack@google.com# Copyright (c) 2006 The Regents of The University of Michigan
411960Sgabeblack@google.com# All rights reserved.
511960Sgabeblack@google.com#
611960Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without
711960Sgabeblack@google.com# modification, are permitted provided that the following conditions are
811960Sgabeblack@google.com# met: redistributions of source code must retain the above copyright
911960Sgabeblack@google.com# notice, this list of conditions and the following disclaimer;
1011960Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright
1111960Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the
1211960Sgabeblack@google.com# documentation and/or other materials provided with the distribution;
1311960Sgabeblack@google.com# neither the name of the copyright holders nor the names of its
1411960Sgabeblack@google.com# contributors may be used to endorse or promote products derived from
1511960Sgabeblack@google.com# this software without specific prior written permission.
1611960Sgabeblack@google.com#
1711960Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1811960Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1911960Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2011960Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2111960Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2211960Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2311960Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2411960Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2511960Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2611960Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2711960Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2811960Sgabeblack@google.com#
2911960Sgabeblack@google.com# Authors: Steve Reinhardt
3011960Sgabeblack@google.com
3111960Sgabeblack@google.comImport('*')
3211960Sgabeblack@google.com
3311960Sgabeblack@google.comif env['TARGET_ISA'] == 'no':
3411960Sgabeblack@google.com    Return()
3511960Sgabeblack@google.com
3611960Sgabeblack@google.com#################################################################
3711960Sgabeblack@google.com#
3811960Sgabeblack@google.com# Generate StaticInst execute() method signatures.
3911960Sgabeblack@google.com#
4011960Sgabeblack@google.com# There must be one signature for each CPU model compiled in.
4111960Sgabeblack@google.com# Since the set of compiled-in models is flexible, we generate a
4211960Sgabeblack@google.com# header containing the appropriate set of signatures on the fly.
4311960Sgabeblack@google.com#
4411960Sgabeblack@google.com#################################################################
4511960Sgabeblack@google.com
4611960Sgabeblack@google.com# Template for execute() signature.
4711960Sgabeblack@google.comexec_sig_template = '''
4811960Sgabeblack@google.comvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
4911960Sgabeblack@google.comvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
5011960Sgabeblack@google.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
5111960Sgabeblack@google.comvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
5211960Sgabeblack@google.com{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
5311960Sgabeblack@google.comvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
5411960Sgabeblack@google.com                          Trace::InstRecord *traceData) const
5511960Sgabeblack@google.com{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
5611960Sgabeblack@google.com'''
5711960Sgabeblack@google.com
5811960Sgabeblack@google.commem_ini_sig_template = '''
5911960Sgabeblack@google.comvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
6011960Sgabeblack@google.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
6111960Sgabeblack@google.comvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
6211960Sgabeblack@google.com'''
6311960Sgabeblack@google.com
6411960Sgabeblack@google.commem_comp_sig_template = '''
6511960Sgabeblack@google.comvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
6611960Sgabeblack@google.com'''
6711960Sgabeblack@google.com
6811960Sgabeblack@google.com# Generate a temporary CPU list, including the CheckerCPU if
6911960Sgabeblack@google.com# it's enabled.  This isn't used for anything else other than StaticInst
7011960Sgabeblack@google.com# headers.
7111960Sgabeblack@google.comtemp_cpu_list = env['CPU_MODELS'][:]
7211960Sgabeblack@google.comtemp_cpu_list.append('CheckerCPU')
7311960Sgabeblack@google.comSimObject('CheckerCPU.py')
7411960Sgabeblack@google.com
7511960Sgabeblack@google.com# Generate header.
7611960Sgabeblack@google.comdef gen_cpu_exec_signatures(target, source, env):
7711960Sgabeblack@google.com    f = open(str(target[0]), 'w')
7811960Sgabeblack@google.com    print >> f, '''
7911960Sgabeblack@google.com#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
8011960Sgabeblack@google.com#define __CPU_STATIC_INST_EXEC_SIGS_HH__
8111960Sgabeblack@google.com'''
8211960Sgabeblack@google.com    for cpu in temp_cpu_list:
8311960Sgabeblack@google.com        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
8411960Sgabeblack@google.com        print >> f, exec_sig_template % { 'type' : xc_type }
8511960Sgabeblack@google.com    print >> f, '''
8611960Sgabeblack@google.com#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
8711960Sgabeblack@google.com'''
8811960Sgabeblack@google.com
8911960Sgabeblack@google.com# Generate string that gets printed when header is rebuilt
9011960Sgabeblack@google.comdef gen_sigs_string(target, source, env):
9111960Sgabeblack@google.com    return " [GENERATE] static_inst_exec_sigs.hh: " \
9211960Sgabeblack@google.com           + ', '.join(temp_cpu_list)
9311960Sgabeblack@google.com
9411960Sgabeblack@google.com# Add command to generate header to environment.
9511960Sgabeblack@google.comenv.Command('static_inst_exec_sigs.hh', (),
9611960Sgabeblack@google.com            Action(gen_cpu_exec_signatures, gen_sigs_string,
9711960Sgabeblack@google.com                   varlist = temp_cpu_list))
9811960Sgabeblack@google.com
9911960Sgabeblack@google.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
10011960Sgabeblack@google.com
10111960Sgabeblack@google.comSimObject('BaseCPU.py')
10211960Sgabeblack@google.comSimObject('FuncUnit.py')
10311960Sgabeblack@google.comSimObject('ExeTracer.py')
10411960Sgabeblack@google.comSimObject('IntelTrace.py')
10511960Sgabeblack@google.comSimObject('IntrControl.py')
10611960Sgabeblack@google.comSimObject('NativeTrace.py')
10711960Sgabeblack@google.com
10811960Sgabeblack@google.comSource('activity.cc')
10911960Sgabeblack@google.comSource('base.cc')
11011960Sgabeblack@google.comSource('cpuevent.cc')
11111960Sgabeblack@google.comSource('exetrace.cc')
11211960Sgabeblack@google.comSource('func_unit.cc')
11311960Sgabeblack@google.comSource('inteltrace.cc')
11411960Sgabeblack@google.comSource('intr_control.cc')
11511960Sgabeblack@google.comSource('nativetrace.cc')
11611960Sgabeblack@google.comSource('pc_event.cc')
11711960Sgabeblack@google.comSource('profile.cc')
11811960Sgabeblack@google.comSource('quiesce_event.cc')
11911960Sgabeblack@google.comSource('static_inst.cc')
12011960Sgabeblack@google.comSource('simple_thread.cc')
12111960Sgabeblack@google.comSource('thread_context.cc')
12211960Sgabeblack@google.comSource('thread_state.cc')
12311960Sgabeblack@google.com
12411960Sgabeblack@google.comif env['TARGET_ISA'] == 'sparc':
12511960Sgabeblack@google.com    SimObject('LegionTrace.py')
12611960Sgabeblack@google.com    Source('legiontrace.cc')
12711960Sgabeblack@google.com
12811960Sgabeblack@google.comSimObject('DummyChecker.py')
12911960Sgabeblack@google.comSource('checker/cpu.cc')
13011960Sgabeblack@google.comSource('dummy_checker.cc')
13111960Sgabeblack@google.comDebugFlag('Checker')
13211960Sgabeblack@google.com
13311960Sgabeblack@google.comDebugFlag('Activity')
13411960Sgabeblack@google.comDebugFlag('Commit')
13511960Sgabeblack@google.comDebugFlag('Context')
13611960Sgabeblack@google.comDebugFlag('Decode')
13711960Sgabeblack@google.comDebugFlag('DynInst')
13811960Sgabeblack@google.comDebugFlag('ExecEnable')
13911960Sgabeblack@google.comDebugFlag('ExecCPSeq')
14011960Sgabeblack@google.comDebugFlag('ExecEffAddr')
14111960Sgabeblack@google.comDebugFlag('ExecFaulting', 'Trace faulting instructions')
14211960Sgabeblack@google.comDebugFlag('ExecFetchSeq')
14311960Sgabeblack@google.comDebugFlag('ExecOpClass')
14411960Sgabeblack@google.comDebugFlag('ExecRegDelta')
14511960Sgabeblack@google.comDebugFlag('ExecResult')
14611960Sgabeblack@google.comDebugFlag('ExecSpeculative')
14711960Sgabeblack@google.comDebugFlag('ExecSymbol')
14811960Sgabeblack@google.comDebugFlag('ExecThread')
14911960Sgabeblack@google.comDebugFlag('ExecTicks')
15011960Sgabeblack@google.comDebugFlag('ExecMicro')
15111960Sgabeblack@google.comDebugFlag('ExecMacro')
15211960Sgabeblack@google.comDebugFlag('ExecUser')
15311960Sgabeblack@google.comDebugFlag('ExecKernel')
15411960Sgabeblack@google.comDebugFlag('ExecAsid')
15511960Sgabeblack@google.comDebugFlag('Fetch')
15611960Sgabeblack@google.comDebugFlag('IntrControl')
15711960Sgabeblack@google.comDebugFlag('O3PipeView')
15811960Sgabeblack@google.comDebugFlag('PCEvent')
15911960Sgabeblack@google.comDebugFlag('Quiesce')
16011960Sgabeblack@google.com
16111960Sgabeblack@google.comCompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
16211960Sgabeblack@google.com    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
16311960Sgabeblack@google.com    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
16411960Sgabeblack@google.com    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
16511960Sgabeblack@google.com    'ExecAsid' ])
16611960Sgabeblack@google.comCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
16711960Sgabeblack@google.com    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
16811960Sgabeblack@google.com    'ExecUser', 'ExecKernel' ])
16911960Sgabeblack@google.comCompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
17011960Sgabeblack@google.com    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
17111960Sgabeblack@google.com    'ExecUser', 'ExecKernel' ])
17211960Sgabeblack@google.com