SConscript revision 10247
14202Sbinkertn@umich.edu# -*- mode:python -*-
24202Sbinkertn@umich.edu
34202Sbinkertn@umich.edu# Copyright (c) 2006 The Regents of The University of Michigan
44202Sbinkertn@umich.edu# All rights reserved.
54202Sbinkertn@umich.edu#
64202Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without
74202Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are
84202Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright
94202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer;
104202Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright
114202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the
124202Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution;
134202Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its
144202Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
154202Sbinkertn@umich.edu# this software without specific prior written permission.
164202Sbinkertn@umich.edu#
174202Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
184202Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
194202Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
204202Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
214202Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
224202Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
234202Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
244202Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
254202Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
264202Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
274202Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284202Sbinkertn@umich.edu#
294202Sbinkertn@umich.edu# Authors: Steve Reinhardt
304202Sbinkertn@umich.edu
314202Sbinkertn@umich.eduImport('*')
324202Sbinkertn@umich.edu
339157Sandreas.hansson@arm.comif env['TARGET_ISA'] == 'null':
3410259SAndrew.Bardsley@arm.com    SimObject('IntrControl.py')
354486Sbinkertn@umich.edu    Source('intr_control_noisa.cc')
369793Sakash.bagdia@arm.com    Return()
379827Sakash.bagdia@arm.com
389850Sandreas.hansson@arm.com#################################################################
3910249Sstephan.diestelhorst@arm.com#
4010268SGeoffrey.Blake@arm.com# Generate StaticInst execute() method signatures.
414486Sbinkertn@umich.edu#
428774Sgblack@eecs.umich.edu# There must be one signature for each CPU model compiled in.
434202Sbinkertn@umich.edu# Since the set of compiled-in models is flexible, we generate a
4411235Sandreas.sandberg@arm.com# header containing the appropriate set of signatures on the fly.
454202Sbinkertn@umich.edu#
4611077SCurtis.Dunham@arm.com#################################################################
4710458Sandreas.hansson@arm.com
4810458Sandreas.hansson@arm.com# Template for execute() signature.
4910458Sandreas.hansson@arm.comexec_sig_template = '''
504202Sbinkertn@umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
5112302Sgabeblack@google.comvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
524202Sbinkertn@umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
539983Sstever@gmail.comvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
5412302Sgabeblack@google.com{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
5510453SAndrew.Bardsley@arm.comvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
5612302Sgabeblack@google.com                          Trace::InstRecord *traceData) const
574202Sbinkertn@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
584202Sbinkertn@umich.edu'''
599342SAndreas.Sandberg@arm.com
604202Sbinkertn@umich.edumem_ini_sig_template = '''
614202Sbinkertn@umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
6210268SGeoffrey.Blake@arm.com{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
6310259SAndrew.Bardsley@arm.comvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
644202Sbinkertn@umich.edu'''
654202Sbinkertn@umich.edu
6612302Sgabeblack@google.commem_comp_sig_template = '''
679793Sakash.bagdia@arm.comvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
689827Sakash.bagdia@arm.com'''
6911909SBrandon.Potter@amd.com
7011420Sdavid.guillen@arm.com# Generate a temporary CPU list, including the CheckerCPU if
719850Sandreas.hansson@arm.com# it's enabled.  This isn't used for anything else other than StaticInst
7210249Sstephan.diestelhorst@arm.com# headers.
7311524Sdavid.guillen@arm.comtemp_cpu_list = env['CPU_MODELS'][:]
7411527Sdavid.guillen@arm.comtemp_cpu_list.append('CheckerCPU')
757768SAli.Saidi@ARM.comSimObject('CheckerCPU.py')
769850Sandreas.hansson@arm.com
779850Sandreas.hansson@arm.com# Generate header.
788766Sgblack@eecs.umich.edudef gen_cpu_exec_signatures(target, source, env):
7911854Sbrandon.potter@amd.com    f = open(str(target[0]), 'w')
807768SAli.Saidi@ARM.com    print >> f, '''
818766Sgblack@eecs.umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
8211856Sbrandon.potter@amd.com#define __CPU_STATIC_INST_EXEC_SIGS_HH__
8310930Sbrandon.potter@amd.com'''
847768SAli.Saidi@ARM.com    for cpu in temp_cpu_list:
859850Sandreas.hansson@arm.com        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
8611794Sbrandon.potter@amd.com        print >> f, exec_sig_template % { 'type' : xc_type }
874486Sbinkertn@umich.edu    print >> f, '''
8811800Sbrandon.potter@amd.com#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
8911800Sbrandon.potter@amd.com'''
9011800Sbrandon.potter@amd.com
918335Snate@binkert.org# Generate string that gets printed when header is rebuilt
928335Snate@binkert.orgdef gen_sigs_string(target, source, env):
9310458Sandreas.hansson@arm.com    return " [GENERATE] static_inst_exec_sigs.hh: " \
949152Satgutier@umich.edu           + ', '.join(temp_cpu_list)
958335Snate@binkert.org
968335Snate@binkert.org# Add command to generate header to environment.
978335Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', (),
988335Snate@binkert.org            Action(gen_cpu_exec_signatures, gen_sigs_string,
998335Snate@binkert.org                   varlist = temp_cpu_list))
1008335Snate@binkert.org
1018335Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1029733Sandreas@sandberg.pp.se
1038335Snate@binkert.orgSimObject('BaseCPU.py')
10411380Salexandru.dutu@amd.comSimObject('FuncUnit.py')
1058335Snate@binkert.orgSimObject('ExeTracer.py')
1068335Snate@binkert.orgSimObject('IntelTrace.py')
1078335Snate@binkert.orgSimObject('IntrControl.py')
1088335Snate@binkert.orgSimObject('NativeTrace.py')
1098335Snate@binkert.org
1108335Snate@binkert.orgSource('activity.cc')
1119793Sakash.bagdia@arm.comSource('base.cc')
1129827Sakash.bagdia@arm.comSource('cpuevent.cc')
11310249Sstephan.diestelhorst@arm.comSource('exetrace.cc')
11411380Salexandru.dutu@amd.comSource('func_unit.cc')
11511380Salexandru.dutu@amd.comSource('inteltrace.cc')
116Source('intr_control.cc')
117Source('nativetrace.cc')
118Source('pc_event.cc')
119Source('profile.cc')
120Source('quiesce_event.cc')
121Source('reg_class.cc')
122Source('static_inst.cc')
123Source('simple_thread.cc')
124Source('thread_context.cc')
125Source('thread_state.cc')
126
127if env['TARGET_ISA'] == 'sparc':
128    SimObject('LegionTrace.py')
129    Source('legiontrace.cc')
130
131SimObject('DummyChecker.py')
132SimObject('StaticInstFlags.py')
133Source('checker/cpu.cc')
134Source('dummy_checker.cc')
135DebugFlag('Checker')
136
137DebugFlag('Activity')
138DebugFlag('Commit')
139DebugFlag('Context')
140DebugFlag('Decode')
141DebugFlag('DynInst')
142DebugFlag('ExecEnable', 'Filter: Enable exec tracing (no tracing without this)')
143DebugFlag('ExecCPSeq', 'Format: Instruction sequence number')
144DebugFlag('ExecEffAddr', 'Format: Include effective address')
145DebugFlag('ExecFaulting', 'Trace faulting instructions')
146DebugFlag('ExecFetchSeq', 'Format: Fetch sequence number')
147DebugFlag('ExecOpClass', 'Format: Include operand class')
148DebugFlag('ExecRegDelta')
149DebugFlag('ExecResult', 'Format: Include results from execution')
150DebugFlag('ExecSpeculative', 'Format: Include a miss-/speculation flag (-/+)')
151DebugFlag('ExecSymbol', 'Format: Try to include symbol names')
152DebugFlag('ExecThread', 'Format: Include thread ID in trace')
153DebugFlag('ExecTicks', 'Format: Include tick count')
154DebugFlag('ExecMicro', 'Filter: Include microops')
155DebugFlag('ExecMacro', 'Filter: Include macroops')
156DebugFlag('ExecUser', 'Filter: Trace user mode instructions')
157DebugFlag('ExecKernel', 'Filter: Trace kernel mode instructions')
158DebugFlag('ExecAsid', 'Format: Include ASID in trace')
159DebugFlag('Fetch')
160DebugFlag('IntrControl')
161DebugFlag('O3PipeView')
162DebugFlag('PCEvent')
163DebugFlag('Quiesce')
164
165CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
166    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
167    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
168    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
169    'ExecAsid' ])
170CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
171    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
172    'ExecUser', 'ExecKernel' ])
173CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
174    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
175    'ExecUser', 'ExecKernel' ])
176