SConscript revision 7799
14661Sksewell@umich.edu# -*- mode:python -*-
25254Sksewell@umich.edu
34661Sksewell@umich.edu# Copyright (c) 2006 The Regents of The University of Michigan
45222Sksewell@umich.edu# All rights reserved.
54661Sksewell@umich.edu#
65222Sksewell@umich.edu# Redistribution and use in source and binary forms, with or without
75222Sksewell@umich.edu# modification, are permitted provided that the following conditions are
85222Sksewell@umich.edu# met: redistributions of source code must retain the above copyright
94661Sksewell@umich.edu# notice, this list of conditions and the following disclaimer;
105222Sksewell@umich.edu# redistributions in binary form must reproduce the above copyright
115222Sksewell@umich.edu# notice, this list of conditions and the following disclaimer in the
125222Sksewell@umich.edu# documentation and/or other materials provided with the distribution;
135222Sksewell@umich.edu# neither the name of the copyright holders nor the names of its
145222Sksewell@umich.edu# contributors may be used to endorse or promote products derived from
155222Sksewell@umich.edu# this software without specific prior written permission.
165254Sksewell@umich.edu#
175254Sksewell@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
185222Sksewell@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
195222Sksewell@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
205222Sksewell@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
215254Sksewell@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
225222Sksewell@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235222Sksewell@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
245222Sksewell@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
255222Sksewell@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265222Sksewell@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
275222Sksewell@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
285222Sksewell@umich.edu#
295222Sksewell@umich.edu# Authors: Steve Reinhardt
305222Sksewell@umich.edu
315222Sksewell@umich.eduImport('*')
325222Sksewell@umich.edu
335222Sksewell@umich.eduif env['TARGET_ISA'] == 'no':
345254Sksewell@umich.edu    Return()
355254Sksewell@umich.edu
365222Sksewell@umich.edu#################################################################
374661Sksewell@umich.edu#
384661Sksewell@umich.edu# Generate StaticInst execute() method signatures.
394661Sksewell@umich.edu#
404661Sksewell@umich.edu# There must be one signature for each CPU model compiled in.
414661Sksewell@umich.edu# Since the set of compiled-in models is flexible, we generate a
424661Sksewell@umich.edu# header containing the appropriate set of signatures on the fly.
434661Sksewell@umich.edu#
444661Sksewell@umich.edu#################################################################
454661Sksewell@umich.edu
464661Sksewell@umich.edu# Template for execute() signature.
474661Sksewell@umich.eduexec_sig_template = '''
484661Sksewell@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
494661Sksewell@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
504661Sksewell@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
514661Sksewell@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
524661Sksewell@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
534661Sksewell@umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
544661Sksewell@umich.edu                          Trace::InstRecord *traceData) const
554661Sksewell@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
564661Sksewell@umich.edu'''
574661Sksewell@umich.edu
584661Sksewell@umich.edumem_ini_sig_template = '''
594661Sksewell@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
604661Sksewell@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
614661Sksewell@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
624661Sksewell@umich.edu'''
634661Sksewell@umich.edu
644661Sksewell@umich.edumem_comp_sig_template = '''
654661Sksewell@umich.eduvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
664661Sksewell@umich.edu'''
674661Sksewell@umich.edu
684661Sksewell@umich.edu# Generate a temporary CPU list, including the CheckerCPU if
694661Sksewell@umich.edu# it's enabled.  This isn't used for anything else other than StaticInst
704661Sksewell@umich.edu# headers.
714661Sksewell@umich.edutemp_cpu_list = env['CPU_MODELS'][:]
724661Sksewell@umich.edu
734661Sksewell@umich.eduif env['USE_CHECKER']:
744661Sksewell@umich.edu    temp_cpu_list.append('CheckerCPU')
754661Sksewell@umich.edu    SimObject('CheckerCPU.py')
764661Sksewell@umich.edu
774661Sksewell@umich.edu# Generate header.
784661Sksewell@umich.edudef gen_cpu_exec_signatures(target, source, env):
794661Sksewell@umich.edu    f = open(str(target[0]), 'w')
804661Sksewell@umich.edu    print >> f, '''
814661Sksewell@umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
824661Sksewell@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__
834661Sksewell@umich.edu'''
844661Sksewell@umich.edu    for cpu in temp_cpu_list:
854661Sksewell@umich.edu        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
864661Sksewell@umich.edu        print >> f, exec_sig_template % { 'type' : xc_type }
874661Sksewell@umich.edu    print >> f, '''
884661Sksewell@umich.edu#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
894661Sksewell@umich.edu'''
904661Sksewell@umich.edu
914661Sksewell@umich.edu# Generate string that gets printed when header is rebuilt
924661Sksewell@umich.edudef gen_sigs_string(target, source, env):
934661Sksewell@umich.edu    return " [GENERATE] static_inst_exec_sigs.hh: " \
944661Sksewell@umich.edu           + ', '.join(temp_cpu_list)
954661Sksewell@umich.edu
964661Sksewell@umich.edu# Add command to generate header to environment.
974661Sksewell@umich.eduenv.Command('static_inst_exec_sigs.hh', (),
984661Sksewell@umich.edu            Action(gen_cpu_exec_signatures, gen_sigs_string,
994661Sksewell@umich.edu                   varlist = temp_cpu_list))
1004661Sksewell@umich.edu
1014661Sksewell@umich.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER']))
1024661Sksewell@umich.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1034661Sksewell@umich.edu
1044661Sksewell@umich.edu# List of suppported CPUs by the Checker.  Errors out if USE_CHECKER=True
1054661Sksewell@umich.edu# and one of these are not being used.
1064661Sksewell@umich.eduCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU']
1074661Sksewell@umich.edu
1084661Sksewell@umich.eduSimObject('BaseCPU.py')
1094661Sksewell@umich.eduSimObject('FuncUnit.py')
1104661Sksewell@umich.eduSimObject('ExeTracer.py')
1114661Sksewell@umich.eduSimObject('IntelTrace.py')
1124661Sksewell@umich.eduSimObject('NativeTrace.py')
1134661Sksewell@umich.edu
1144661Sksewell@umich.eduSource('activity.cc')
1154661Sksewell@umich.eduSource('base.cc')
1164661Sksewell@umich.eduSource('cpuevent.cc')
1174661Sksewell@umich.eduSource('exetrace.cc')
1184661Sksewell@umich.eduSource('func_unit.cc')
1194661Sksewell@umich.eduSource('inteltrace.cc')
1204661Sksewell@umich.eduSource('nativetrace.cc')
1214661Sksewell@umich.eduSource('pc_event.cc')
1224661Sksewell@umich.eduSource('quiesce_event.cc')
1234661Sksewell@umich.eduSource('static_inst.cc')
1244661Sksewell@umich.eduSource('simple_thread.cc')
1254661Sksewell@umich.eduSource('thread_context.cc')
1264661Sksewell@umich.eduSource('thread_state.cc')
1274661Sksewell@umich.edu
1284661Sksewell@umich.eduif env['FULL_SYSTEM']:
1294661Sksewell@umich.edu    SimObject('IntrControl.py')
1304661Sksewell@umich.edu
1314661Sksewell@umich.edu    Source('intr_control.cc')
1324661Sksewell@umich.edu    Source('profile.cc')
1334661Sksewell@umich.edu
1344661Sksewell@umich.edu    if env['TARGET_ISA'] == 'sparc':
1354661Sksewell@umich.edu        SimObject('LegionTrace.py')
1364661Sksewell@umich.edu        Source('legiontrace.cc')
1374661Sksewell@umich.edu
1384661Sksewell@umich.eduif env['USE_CHECKER']:
1394661Sksewell@umich.edu    Source('checker/cpu.cc')
1404661Sksewell@umich.edu    TraceFlag('Checker')
1414661Sksewell@umich.edu    checker_supports = False
1424661Sksewell@umich.edu    for i in CheckerSupportedCPUList:
1434661Sksewell@umich.edu        if i in env['CPU_MODELS']:
1444661Sksewell@umich.edu            checker_supports = True
1454661Sksewell@umich.edu    if not checker_supports:
1464661Sksewell@umich.edu        print "Checker only supports CPU models",
1474661Sksewell@umich.edu        for i in CheckerSupportedCPUList:
1484661Sksewell@umich.edu            print i,
1494661Sksewell@umich.edu        print ", please set USE_CHECKER=False or use one of those CPU models"
1504661Sksewell@umich.edu        Exit(1)
1514661Sksewell@umich.edu
1524661Sksewell@umich.eduTraceFlag('Activity')
1534661Sksewell@umich.eduTraceFlag('Commit')
1544661Sksewell@umich.eduTraceFlag('Context')
1554661Sksewell@umich.eduTraceFlag('Decode')
1564661Sksewell@umich.eduTraceFlag('DynInst')
1574661Sksewell@umich.eduTraceFlag('ExecEnable')
1584661Sksewell@umich.eduTraceFlag('ExecCPSeq')
1594661Sksewell@umich.eduTraceFlag('ExecEffAddr')
1604661Sksewell@umich.eduTraceFlag('ExecFaulting', 'Trace faulting instructions')
1614661Sksewell@umich.eduTraceFlag('ExecFetchSeq')
1624661Sksewell@umich.eduTraceFlag('ExecOpClass')
1634661Sksewell@umich.eduTraceFlag('ExecRegDelta')
1644661Sksewell@umich.eduTraceFlag('ExecResult')
1654661Sksewell@umich.eduTraceFlag('ExecSpeculative')
1664661Sksewell@umich.eduTraceFlag('ExecSymbol')
1674661Sksewell@umich.eduTraceFlag('ExecThread')
1684661Sksewell@umich.eduTraceFlag('ExecTicks')
1694661Sksewell@umich.eduTraceFlag('ExecMicro')
1704661Sksewell@umich.eduTraceFlag('ExecMacro')
1714661Sksewell@umich.eduTraceFlag('Fetch')
1724661Sksewell@umich.eduTraceFlag('IntrControl')
1734661Sksewell@umich.eduTraceFlag('PCEvent')
1744661Sksewell@umich.eduTraceFlag('Quiesce')
1754661Sksewell@umich.edu
1764661Sksewell@umich.eduCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
1774661Sksewell@umich.edu    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting' ])
1784661Sksewell@umich.eduCompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
1794661Sksewell@umich.edu    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting' ])
1804661Sksewell@umich.edu