SConscript revision 9243
12155SN/A# -*- mode:python -*-
22155SN/A
32155SN/A# Copyright (c) 2006 The Regents of The University of Michigan
42155SN/A# All rights reserved.
52155SN/A#
62155SN/A# Redistribution and use in source and binary forms, with or without
72155SN/A# modification, are permitted provided that the following conditions are
82155SN/A# met: redistributions of source code must retain the above copyright
92155SN/A# notice, this list of conditions and the following disclaimer;
102155SN/A# redistributions in binary form must reproduce the above copyright
112155SN/A# notice, this list of conditions and the following disclaimer in the
122155SN/A# documentation and/or other materials provided with the distribution;
132155SN/A# neither the name of the copyright holders nor the names of its
142155SN/A# contributors may be used to endorse or promote products derived from
152155SN/A# this software without specific prior written permission.
162155SN/A#
172155SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182155SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192155SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202155SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212155SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222155SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232155SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242155SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252155SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262155SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272155SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu#
292665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt
302155SN/A
314202Sbinkertn@umich.eduImport('*')
322155SN/A
339850Sandreas.hansson@arm.comif env['TARGET_ISA'] == 'no':
349850Sandreas.hansson@arm.com    Return()
359850Sandreas.hansson@arm.com
367768SAli.Saidi@ARM.com#################################################################
377768SAli.Saidi@ARM.com#
388887Sgeoffrey.blake@arm.com# Generate StaticInst execute() method signatures.
392766Sktlim@umich.edu#
404486Sbinkertn@umich.edu# There must be one signature for each CPU model compiled in.
414486Sbinkertn@umich.edu# Since the set of compiled-in models is flexible, we generate a
424776Sgblack@eecs.umich.edu# header containing the appropriate set of signatures on the fly.
434776Sgblack@eecs.umich.edu#
448739Sgblack@eecs.umich.edu#################################################################
456365Sgblack@eecs.umich.edu
4610259SAndrew.Bardsley@arm.com# Template for execute() signature.
474486Sbinkertn@umich.eduexec_sig_template = '''
484202Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
494202Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
504202Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
514202Sbinkertn@umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
5210319SAndreas.Sandberg@ARM.com{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
534202Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
544776Sgblack@eecs.umich.edu                          Trace::InstRecord *traceData) const
558739Sgblack@eecs.umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
566365Sgblack@eecs.umich.edu'''
574202Sbinkertn@umich.edu
588777Sgblack@eecs.umich.edumem_ini_sig_template = '''
594202Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
609913Ssteve.reinhardt@amd.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
614202Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
624202Sbinkertn@umich.edu'''
635217Ssaidi@eecs.umich.edu
644202Sbinkertn@umich.edumem_comp_sig_template = '''
6510259SAndrew.Bardsley@arm.comvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
662155SN/A'''
678793Sgblack@eecs.umich.edu
688793Sgblack@eecs.umich.edu# Generate a temporary CPU list, including the CheckerCPU if
698793Sgblack@eecs.umich.edu# it's enabled.  This isn't used for anything else other than StaticInst
704776Sgblack@eecs.umich.edu# headers.
718887Sgeoffrey.blake@arm.comtemp_cpu_list = env['CPU_MODELS'][:]
7210201SAndrew.Bardsley@arm.comtemp_cpu_list.append('CheckerCPU')
738887Sgeoffrey.blake@arm.comSimObject('CheckerCPU.py')
749340SAndreas.Sandberg@arm.com
758887Sgeoffrey.blake@arm.com# Generate header.
765192Ssaidi@eecs.umich.edudef gen_cpu_exec_signatures(target, source, env):
778335Snate@binkert.org    f = open(str(target[0]), 'w')
788335Snate@binkert.org    print >> f, '''
798335Snate@binkert.org#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
808335Snate@binkert.org#define __CPU_STATIC_INST_EXEC_SIGS_HH__
818335Snate@binkert.org'''
829534SAndreas.Sandberg@ARM.com    for cpu in temp_cpu_list:
839534SAndreas.Sandberg@ARM.com        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
849534SAndreas.Sandberg@ARM.com        print >> f, exec_sig_template % { 'type' : xc_type }
858335Snate@binkert.org    print >> f, '''
869534SAndreas.Sandberg@ARM.com#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
879534SAndreas.Sandberg@ARM.com'''
888335Snate@binkert.org
899534SAndreas.Sandberg@ARM.com# Generate string that gets printed when header is rebuilt
909534SAndreas.Sandberg@ARM.comdef gen_sigs_string(target, source, env):
919534SAndreas.Sandberg@ARM.com    return " [GENERATE] static_inst_exec_sigs.hh: " \
929534SAndreas.Sandberg@ARM.com           + ', '.join(temp_cpu_list)
939534SAndreas.Sandberg@ARM.com
949534SAndreas.Sandberg@ARM.com# Add command to generate header to environment.
959534SAndreas.Sandberg@ARM.comenv.Command('static_inst_exec_sigs.hh', (),
969534SAndreas.Sandberg@ARM.com            Action(gen_cpu_exec_signatures, gen_sigs_string,
979534SAndreas.Sandberg@ARM.com                   varlist = temp_cpu_list))
989534SAndreas.Sandberg@ARM.com
9910383Smitch.hayenga@arm.comenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1008335Snate@binkert.org
1018335Snate@binkert.orgSimObject('BaseCPU.py')
1028471SGiacomo.Gabrielli@arm.comSimObject('FuncUnit.py')
1038335Snate@binkert.orgSimObject('ExeTracer.py')
1048335Snate@binkert.orgSimObject('IntelTrace.py')
1055192Ssaidi@eecs.umich.eduSimObject('IntrControl.py')
1068232Snate@binkert.orgSimObject('NativeTrace.py')
1078232Snate@binkert.org
1088232Snate@binkert.orgSource('activity.cc')
1098300Schander.sudanthi@arm.comSource('base.cc')
11010383Smitch.hayenga@arm.comSource('cpuevent.cc')
1115192Ssaidi@eecs.umich.eduSource('exetrace.cc')
1128300Schander.sudanthi@arm.comSource('func_unit.cc')
1138300Schander.sudanthi@arm.comSource('inteltrace.cc')
1146036Sksewell@umich.eduSource('intr_control.cc')
1158300Schander.sudanthi@arm.comSource('nativetrace.cc')
1168300Schander.sudanthi@arm.comSource('pc_event.cc')
117Source('profile.cc')
118Source('quiesce_event.cc')
119Source('static_inst.cc')
120Source('simple_thread.cc')
121Source('thread_context.cc')
122Source('thread_state.cc')
123
124if env['TARGET_ISA'] == 'sparc':
125    SimObject('LegionTrace.py')
126    Source('legiontrace.cc')
127
128SimObject('DummyChecker.py')
129Source('checker/cpu.cc')
130Source('dummy_checker_builder.cc')
131DebugFlag('Checker')
132
133DebugFlag('Activity')
134DebugFlag('Commit')
135DebugFlag('Context')
136DebugFlag('Decode')
137DebugFlag('DynInst')
138DebugFlag('ExecEnable')
139DebugFlag('ExecCPSeq')
140DebugFlag('ExecEffAddr')
141DebugFlag('ExecFaulting', 'Trace faulting instructions')
142DebugFlag('ExecFetchSeq')
143DebugFlag('ExecOpClass')
144DebugFlag('ExecRegDelta')
145DebugFlag('ExecResult')
146DebugFlag('ExecSpeculative')
147DebugFlag('ExecSymbol')
148DebugFlag('ExecThread')
149DebugFlag('ExecTicks')
150DebugFlag('ExecMicro')
151DebugFlag('ExecMacro')
152DebugFlag('ExecUser')
153DebugFlag('ExecKernel')
154DebugFlag('ExecAsid')
155DebugFlag('Fetch')
156DebugFlag('IntrControl')
157DebugFlag('O3PipeView')
158DebugFlag('PCEvent')
159DebugFlag('Quiesce')
160
161CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
162    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
163    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
164    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
165    'ExecAsid' ])
166CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
167    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
168    'ExecUser', 'ExecKernel' ])
169CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
170    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
171    'ExecUser', 'ExecKernel' ])
172