SConscript revision 9534
12SN/A# -*- mode:python -*-
24039Sbinkertn@umich.edu
32SN/A# Copyright (c) 2006 The Regents of The University of Michigan
42SN/A# All rights reserved.
52SN/A#
62SN/A# Redistribution and use in source and binary forms, with or without
72SN/A# modification, are permitted provided that the following conditions are
82SN/A# met: redistributions of source code must retain the above copyright
92SN/A# notice, this list of conditions and the following disclaimer;
102SN/A# redistributions in binary form must reproduce the above copyright
112SN/A# notice, this list of conditions and the following disclaimer in the
122SN/A# documentation and/or other materials provided with the distribution;
132SN/A# neither the name of the copyright holders nor the names of its
142SN/A# contributors may be used to endorse or promote products derived from
152SN/A# this software without specific prior written permission.
162SN/A#
172SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272665Ssaidi@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu#
292SN/A# Authors: Steve Reinhardt
302SN/A
312SN/AImport('*')
322SN/A
332SN/Aif env['TARGET_ISA'] == 'no':
342SN/A    Return()
352SN/A
3656SN/A#################################################################
372SN/A#
382SN/A# Generate StaticInst execute() method signatures.
392SN/A#
402SN/A# There must be one signature for each CPU model compiled in.
412SN/A# Since the set of compiled-in models is flexible, we generate a
424039Sbinkertn@umich.edu# header containing the appropriate set of signatures on the fly.
435756Snate@binkert.org#
44492SN/A#################################################################
454039Sbinkertn@umich.edu
464039Sbinkertn@umich.edu# Template for execute() signature.
474039Sbinkertn@umich.eduexec_sig_template = '''
484039Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
494039Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
504039Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
515756Snate@binkert.orgvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
524039Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
534039Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
544039Sbinkertn@umich.edu                          Trace::InstRecord *traceData) const
554039Sbinkertn@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
564039Sbinkertn@umich.edu'''
574039Sbinkertn@umich.edu
584039Sbinkertn@umich.edumem_ini_sig_template = '''
594039Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
60492SN/A{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
61492SN/Avirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
622SN/A'''
635756Snate@binkert.org
642SN/Amem_comp_sig_template = '''
655756Snate@binkert.orgvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
665756Snate@binkert.org'''
674039Sbinkertn@umich.edu
68492SN/A# Generate a temporary CPU list, including the CheckerCPU if
694039Sbinkertn@umich.edu# it's enabled.  This isn't used for anything else other than StaticInst
704039Sbinkertn@umich.edu# headers.
714039Sbinkertn@umich.edutemp_cpu_list = env['CPU_MODELS'][:]
724039Sbinkertn@umich.edutemp_cpu_list.append('CheckerCPU')
734039Sbinkertn@umich.eduSimObject('CheckerCPU.py')
742SN/A
754039Sbinkertn@umich.edu# Generate header.
764039Sbinkertn@umich.edudef gen_cpu_exec_signatures(target, source, env):
772SN/A    f = open(str(target[0]), 'w')
782SN/A    print >> f, '''
792SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
804039Sbinkertn@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__
814039Sbinkertn@umich.edu'''
822SN/A    for cpu in temp_cpu_list:
832SN/A        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
844039Sbinkertn@umich.edu        print >> f, exec_sig_template % { 'type' : xc_type }
854039Sbinkertn@umich.edu    print >> f, '''
864039Sbinkertn@umich.edu#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
872SN/A'''
882SN/A
894039Sbinkertn@umich.edu# Generate string that gets printed when header is rebuilt
904039Sbinkertn@umich.edudef gen_sigs_string(target, source, env):
914039Sbinkertn@umich.edu    return " [GENERATE] static_inst_exec_sigs.hh: " \
924039Sbinkertn@umich.edu           + ', '.join(temp_cpu_list)
932SN/A
942SN/A# Add command to generate header to environment.
952SN/Aenv.Command('static_inst_exec_sigs.hh', (),
962SN/A            Action(gen_cpu_exec_signatures, gen_sigs_string,
974039Sbinkertn@umich.edu                   varlist = temp_cpu_list))
984039Sbinkertn@umich.edu
994039Sbinkertn@umich.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1004039Sbinkertn@umich.edu
1014039Sbinkertn@umich.eduSimObject('BaseCPU.py')
1024039Sbinkertn@umich.eduSimObject('FuncUnit.py')
1034039Sbinkertn@umich.eduSimObject('ExeTracer.py')
1044039Sbinkertn@umich.eduSimObject('IntelTrace.py')
1054039Sbinkertn@umich.eduSimObject('IntrControl.py')
1064039Sbinkertn@umich.eduSimObject('NativeTrace.py')
1074039Sbinkertn@umich.edu
1084039Sbinkertn@umich.eduSource('activity.cc')
1094039Sbinkertn@umich.eduSource('base.cc')
1104039Sbinkertn@umich.eduSource('cpuevent.cc')
1114039Sbinkertn@umich.eduSource('exetrace.cc')
1124039Sbinkertn@umich.eduSource('func_unit.cc')
1134039Sbinkertn@umich.eduSource('inteltrace.cc')
1144039Sbinkertn@umich.eduSource('intr_control.cc')
1154039Sbinkertn@umich.eduSource('nativetrace.cc')
1164039Sbinkertn@umich.eduSource('pc_event.cc')
1174039Sbinkertn@umich.eduSource('profile.cc')
1184039Sbinkertn@umich.eduSource('quiesce_event.cc')
1194039Sbinkertn@umich.eduSource('static_inst.cc')
1204039Sbinkertn@umich.eduSource('simple_thread.cc')
1214039Sbinkertn@umich.eduSource('thread_context.cc')
1224039Sbinkertn@umich.eduSource('thread_state.cc')
1234039Sbinkertn@umich.edu
1244039Sbinkertn@umich.eduif env['TARGET_ISA'] == 'sparc':
1254039Sbinkertn@umich.edu    SimObject('LegionTrace.py')
1264039Sbinkertn@umich.edu    Source('legiontrace.cc')
1274039Sbinkertn@umich.edu
1284039Sbinkertn@umich.eduSimObject('DummyChecker.py')
1294039Sbinkertn@umich.eduSource('checker/cpu.cc')
1304039Sbinkertn@umich.eduSource('dummy_checker.cc')
1314039Sbinkertn@umich.eduDebugFlag('Checker')
1324039Sbinkertn@umich.edu
1334039Sbinkertn@umich.eduDebugFlag('Activity')
1344039Sbinkertn@umich.eduDebugFlag('Commit')
1354039Sbinkertn@umich.eduDebugFlag('Context')
1364039Sbinkertn@umich.eduDebugFlag('Decode')
1374039Sbinkertn@umich.eduDebugFlag('DynInst')
1384039Sbinkertn@umich.eduDebugFlag('ExecEnable', 'Filter: Enable exec tracing (no tracing without this)')
1394039Sbinkertn@umich.eduDebugFlag('ExecCPSeq', 'Format: Instruction sequence number')
1404039Sbinkertn@umich.eduDebugFlag('ExecEffAddr', 'Format: Include effective address')
1414039Sbinkertn@umich.eduDebugFlag('ExecFaulting', 'Trace faulting instructions')
1424039Sbinkertn@umich.eduDebugFlag('ExecFetchSeq', 'Format: Fetch sequence number')
1434039Sbinkertn@umich.eduDebugFlag('ExecOpClass', 'Format: Include operand class')
1444039Sbinkertn@umich.eduDebugFlag('ExecRegDelta')
1454039Sbinkertn@umich.eduDebugFlag('ExecResult', 'Format: Include results from execution')
1464039Sbinkertn@umich.eduDebugFlag('ExecSpeculative', 'Format: Include a miss-/speculation flag (-/+)')
1474039Sbinkertn@umich.eduDebugFlag('ExecSymbol', 'Format: Try to include symbol names')
1484039Sbinkertn@umich.eduDebugFlag('ExecThread', 'Format: Include thread ID in trace')
1494039Sbinkertn@umich.eduDebugFlag('ExecTicks', 'Format: Include tick count')
1504039Sbinkertn@umich.eduDebugFlag('ExecMicro', 'Filter: Include microops')
1514039Sbinkertn@umich.eduDebugFlag('ExecMacro', 'Filter: Include macroops')
1524039Sbinkertn@umich.eduDebugFlag('ExecUser', 'Filter: Trace user mode instructions')
1534039Sbinkertn@umich.eduDebugFlag('ExecKernel', 'Filter: Trace kernel mode instructions')
1544039Sbinkertn@umich.eduDebugFlag('ExecAsid', 'Format: Include ASID in trace')
1554039Sbinkertn@umich.eduDebugFlag('Fetch')
1564039Sbinkertn@umich.eduDebugFlag('IntrControl')
1574039Sbinkertn@umich.eduDebugFlag('O3PipeView')
1584039Sbinkertn@umich.eduDebugFlag('PCEvent')
1594039Sbinkertn@umich.eduDebugFlag('Quiesce')
1604039Sbinkertn@umich.edu
1614039Sbinkertn@umich.eduCompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
1624039Sbinkertn@umich.edu    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
1634039Sbinkertn@umich.edu    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
1644039Sbinkertn@umich.edu    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
1654039Sbinkertn@umich.edu    'ExecAsid' ])
1664039Sbinkertn@umich.eduCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
1674039Sbinkertn@umich.edu    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
1684039Sbinkertn@umich.edu    'ExecUser', 'ExecKernel' ])
1694039Sbinkertn@umich.eduCompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
1704039Sbinkertn@umich.edu    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
1714039Sbinkertn@umich.edu    'ExecUser', 'ExecKernel' ])
1724039Sbinkertn@umich.edu