SConscript revision 8887
16145Snate@binkert.org# -*- mode:python -*-
26145Snate@binkert.org
311307Santhony.gutierrez@amd.com# Copyright (c) 2006 The Regents of The University of Michigan
46145Snate@binkert.org# All rights reserved.
56145Snate@binkert.org#
66145Snate@binkert.org# Redistribution and use in source and binary forms, with or without
76145Snate@binkert.org# modification, are permitted provided that the following conditions are
86145Snate@binkert.org# met: redistributions of source code must retain the above copyright
96145Snate@binkert.org# notice, this list of conditions and the following disclaimer;
106145Snate@binkert.org# redistributions in binary form must reproduce the above copyright
116145Snate@binkert.org# notice, this list of conditions and the following disclaimer in the
126145Snate@binkert.org# documentation and/or other materials provided with the distribution;
136145Snate@binkert.org# neither the name of the copyright holders nor the names of its
146145Snate@binkert.org# contributors may be used to endorse or promote products derived from
156145Snate@binkert.org# this software without specific prior written permission.
166145Snate@binkert.org#
176145Snate@binkert.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186145Snate@binkert.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196145Snate@binkert.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206145Snate@binkert.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216145Snate@binkert.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226145Snate@binkert.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236145Snate@binkert.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246145Snate@binkert.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256145Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266145Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276145Snate@binkert.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286145Snate@binkert.org#
296145Snate@binkert.org# Authors: Steve Reinhardt
306145Snate@binkert.org
317039Snate@binkert.orgImport('*')
326145Snate@binkert.org
336145Snate@binkert.orgif env['TARGET_ISA'] == 'no':
347039Snate@binkert.org    Return()
357039Snate@binkert.org
366145Snate@binkert.org#################################################################
377832Snate@binkert.org#
387832Snate@binkert.org# Generate StaticInst execute() method signatures.
399302Snilay@cs.wisc.edu#
4011025Snilay@cs.wisc.edu# There must be one signature for each CPU model compiled in.
417039Snate@binkert.org# Since the set of compiled-in models is flexible, we generate a
4211208Sjoseph.gross@amd.com# header containing the appropriate set of signatures on the fly.
4310086Snilay@cs.wisc.edu#
4411025Snilay@cs.wisc.edu#################################################################
4511307Santhony.gutierrez@amd.com
466145Snate@binkert.org# Template for execute() signature.
479507Snilay@cs.wisc.eduexec_sig_template = '''
489499Snilay@cs.wisc.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
497039Snate@binkert.orgvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
507039Snate@binkert.org{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
516145Snate@binkert.orgvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
527039Snate@binkert.org{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
537039Snate@binkert.orgvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
546145Snate@binkert.org                          Trace::InstRecord *traceData) const
556145Snate@binkert.org{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
567039Snate@binkert.org'''
577039Snate@binkert.org
586145Snate@binkert.orgmem_ini_sig_template = '''
597039Snate@binkert.orgvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
607039Snate@binkert.org{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
616145Snate@binkert.orgvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
626145Snate@binkert.org'''
6310956SBrad.Beckmann@amd.com
6411025Snilay@cs.wisc.edumem_comp_sig_template = '''
6510956SBrad.Beckmann@amd.comvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
6611025Snilay@cs.wisc.edu'''
6711025Snilay@cs.wisc.edu
686467Sdrh5@cs.wisc.edu# Generate a temporary CPU list, including the CheckerCPU if
696467Sdrh5@cs.wisc.edu# it's enabled.  This isn't used for anything else other than StaticInst
7011209Santhony.gutierrez@amd.com# headers.
7111209Santhony.gutierrez@amd.comtemp_cpu_list = env['CPU_MODELS'][:]
7211209Santhony.gutierrez@amd.comtemp_cpu_list.append('CheckerCPU')
7311209Santhony.gutierrez@amd.comSimObject('CheckerCPU.py')
7411209Santhony.gutierrez@amd.com
7511209Santhony.gutierrez@amd.com# Generate header.
7611209Santhony.gutierrez@amd.comdef gen_cpu_exec_signatures(target, source, env):
778131SLisa.Hsu@amd.com    f = open(str(target[0]), 'w')
788131SLisa.Hsu@amd.com    print >> f, '''
798131SLisa.Hsu@amd.com#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
808131SLisa.Hsu@amd.com#define __CPU_STATIC_INST_EXEC_SIGS_HH__
818131SLisa.Hsu@amd.com'''
828131SLisa.Hsu@amd.com    for cpu in temp_cpu_list:
839466Snilay@cs.wisc.edu        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
849466Snilay@cs.wisc.edu        print >> f, exec_sig_template % { 'type' : xc_type }
859466Snilay@cs.wisc.edu    print >> f, '''
869466Snilay@cs.wisc.edu#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
879466Snilay@cs.wisc.edu'''
889302Snilay@cs.wisc.edu
899302Snilay@cs.wisc.edu# Generate string that gets printed when header is rebuilt
909302Snilay@cs.wisc.edudef gen_sigs_string(target, source, env):
919302Snilay@cs.wisc.edu    return " [GENERATE] static_inst_exec_sigs.hh: " \
929302Snilay@cs.wisc.edu           + ', '.join(temp_cpu_list)
9311307Santhony.gutierrez@amd.com
9411307Santhony.gutierrez@amd.com# Add command to generate header to environment.
9511307Santhony.gutierrez@amd.comenv.Command('static_inst_exec_sigs.hh', (),
9611307Santhony.gutierrez@amd.com            Action(gen_cpu_exec_signatures, gen_sigs_string,
9711307Santhony.gutierrez@amd.com                   varlist = temp_cpu_list))
9811307Santhony.gutierrez@amd.com
999302Snilay@cs.wisc.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1009302Snilay@cs.wisc.edu
10111025Snilay@cs.wisc.eduSimObject('BaseCPU.py')
1029302Snilay@cs.wisc.eduSimObject('FuncUnit.py')
10311025Snilay@cs.wisc.eduSimObject('ExeTracer.py')
10411025Snilay@cs.wisc.eduSimObject('IntelTrace.py')
1059302Snilay@cs.wisc.eduSimObject('IntrControl.py')
1069302Snilay@cs.wisc.eduSimObject('NativeTrace.py')
10710562Sandreas.hansson@arm.com
1089302Snilay@cs.wisc.eduSource('activity.cc')
10911025Snilay@cs.wisc.eduSource('base.cc')
1109302Snilay@cs.wisc.eduSource('cpuevent.cc')
1119302Snilay@cs.wisc.eduSource('decode.cc')
1129302Snilay@cs.wisc.eduSource('exetrace.cc')
1139302Snilay@cs.wisc.eduSource('func_unit.cc')
1149302Snilay@cs.wisc.eduSource('inteltrace.cc')
1159302Snilay@cs.wisc.eduSource('intr_control.cc')
1169302Snilay@cs.wisc.eduSource('nativetrace.cc')
1179302Snilay@cs.wisc.eduSource('pc_event.cc')
1189302Snilay@cs.wisc.eduSource('profile.cc')
1199302Snilay@cs.wisc.eduSource('quiesce_event.cc')
12011307Santhony.gutierrez@amd.comSource('static_inst.cc')
12111307Santhony.gutierrez@amd.comSource('simple_thread.cc')
12211307Santhony.gutierrez@amd.comSource('thread_context.cc')
12311307Santhony.gutierrez@amd.comSource('thread_state.cc')
12411307Santhony.gutierrez@amd.com
12511307Santhony.gutierrez@amd.comif env['TARGET_ISA'] == 'sparc':
12611307Santhony.gutierrez@amd.com    SimObject('LegionTrace.py')
12711307Santhony.gutierrez@amd.com    Source('legiontrace.cc')
12811307Santhony.gutierrez@amd.com
12911307Santhony.gutierrez@amd.comSimObject('DummyChecker.py')
13011307Santhony.gutierrez@amd.comSource('checker/cpu.cc')
13111307Santhony.gutierrez@amd.comSource('dummy_checker_builder.cc')
13211307Santhony.gutierrez@amd.comDebugFlag('Checker')
13311307Santhony.gutierrez@amd.com
13411307Santhony.gutierrez@amd.comDebugFlag('Activity')
13511307Santhony.gutierrez@amd.comDebugFlag('Commit')
13611307Santhony.gutierrez@amd.comDebugFlag('Context')
13711307Santhony.gutierrez@amd.comDebugFlag('Decode')
13811307Santhony.gutierrez@amd.comDebugFlag('DynInst')
13911307Santhony.gutierrez@amd.comDebugFlag('ExecEnable')
14011307Santhony.gutierrez@amd.comDebugFlag('ExecCPSeq')
14111307Santhony.gutierrez@amd.comDebugFlag('ExecEffAddr')
14211307Santhony.gutierrez@amd.comDebugFlag('ExecFaulting', 'Trace faulting instructions')
14311307Santhony.gutierrez@amd.comDebugFlag('ExecFetchSeq')
14411307Santhony.gutierrez@amd.comDebugFlag('ExecOpClass')
14511307Santhony.gutierrez@amd.comDebugFlag('ExecRegDelta')
14611307Santhony.gutierrez@amd.comDebugFlag('ExecResult')
14711307Santhony.gutierrez@amd.comDebugFlag('ExecSpeculative')
14811307Santhony.gutierrez@amd.comDebugFlag('ExecSymbol')
14911307Santhony.gutierrez@amd.comDebugFlag('ExecThread')
1509302Snilay@cs.wisc.eduDebugFlag('ExecTicks')
1519302Snilay@cs.wisc.eduDebugFlag('ExecMicro')
1529302Snilay@cs.wisc.eduDebugFlag('ExecMacro')
1539302Snilay@cs.wisc.eduDebugFlag('ExecUser')
1549302Snilay@cs.wisc.eduDebugFlag('ExecKernel')
1559302Snilay@cs.wisc.eduDebugFlag('ExecAsid')
15611025Snilay@cs.wisc.eduDebugFlag('Fetch')
1579302Snilay@cs.wisc.eduDebugFlag('IntrControl')
15811025Snilay@cs.wisc.eduDebugFlag('O3PipeView')
15911025Snilay@cs.wisc.eduDebugFlag('PCEvent')
1609302Snilay@cs.wisc.eduDebugFlag('Quiesce')
1619302Snilay@cs.wisc.edu
16210563Sandreas.hansson@arm.comCompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
1639302Snilay@cs.wisc.edu    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
16411025Snilay@cs.wisc.edu    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
1659302Snilay@cs.wisc.edu    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
1669302Snilay@cs.wisc.edu    'ExecAsid' ])
1679302Snilay@cs.wisc.eduCompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
1689302Snilay@cs.wisc.edu    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
1699302Snilay@cs.wisc.edu    'ExecUser', 'ExecKernel' ])
1709302Snilay@cs.wisc.eduCompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
1719302Snilay@cs.wisc.edu    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
1729302Snilay@cs.wisc.edu    'ExecUser', 'ExecKernel' ])
1739302Snilay@cs.wisc.edu