SConscript revision 8615
12139SN/A# -*- mode:python -*-
22139SN/A
32139SN/A# Copyright (c) 2006 The Regents of The University of Michigan
42139SN/A# All rights reserved.
52139SN/A#
62139SN/A# Redistribution and use in source and binary forms, with or without
72139SN/A# modification, are permitted provided that the following conditions are
82139SN/A# met: redistributions of source code must retain the above copyright
92139SN/A# notice, this list of conditions and the following disclaimer;
102139SN/A# redistributions in binary form must reproduce the above copyright
112139SN/A# notice, this list of conditions and the following disclaimer in the
122139SN/A# documentation and/or other materials provided with the distribution;
132139SN/A# neither the name of the copyright holders nor the names of its
142139SN/A# contributors may be used to endorse or promote products derived from
152139SN/A# this software without specific prior written permission.
162139SN/A#
172139SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182139SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192139SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202139SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212139SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222139SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232139SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242139SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252139SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262139SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272139SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu#
292665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt
302139SN/A
314202Sbinkertn@umich.eduImport('*')
322139SN/A
334202Sbinkertn@umich.eduif env['TARGET_ISA'] == 'no':
342152SN/A    Return()
352152SN/A
362139SN/A#################################################################
372139SN/A#
382139SN/A# Generate StaticInst execute() method signatures.
392139SN/A#
402139SN/A# There must be one signature for each CPU model compiled in.
412152SN/A# Since the set of compiled-in models is flexible, we generate a
422152SN/A# header containing the appropriate set of signatures on the fly.
432139SN/A#
442139SN/A#################################################################
452139SN/A
464781Snate@binkert.org# Template for execute() signature.
474781Snate@binkert.orgexec_sig_template = '''
487799Sgblack@eecs.umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
494781Snate@binkert.orgvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
504781Snate@binkert.org{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
513170Sstever@eecs.umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
525664Sgblack@eecs.umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
538105Sgblack@eecs.umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
546179Sksewell@umich.edu                          Trace::InstRecord *traceData) const
554781Snate@binkert.org{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
564781Snate@binkert.org'''
576329Sgblack@eecs.umich.edu
584781Snate@binkert.orgmem_ini_sig_template = '''
594781Snate@binkert.orgvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
604781Snate@binkert.org{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
614781Snate@binkert.orgvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
624781Snate@binkert.org'''
634781Snate@binkert.org
642139SN/Amem_comp_sig_template = '''
652139SN/Avirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
663546Sgblack@eecs.umich.edu'''
674202Sbinkertn@umich.edu
682152SN/A# Generate a temporary CPU list, including the CheckerCPU if
692152SN/A# it's enabled.  This isn't used for anything else other than StaticInst
702152SN/A# headers.
712152SN/Atemp_cpu_list = env['CPU_MODELS'][:]
722152SN/A
732152SN/Aif env['USE_CHECKER']:
742152SN/A    temp_cpu_list.append('CheckerCPU')
752152SN/A    SimObject('CheckerCPU.py')
762152SN/A
772152SN/A# Generate header.
782152SN/Adef gen_cpu_exec_signatures(target, source, env):
792152SN/A    f = open(str(target[0]), 'w')
802504SN/A    print >> f, '''
812504SN/A#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
822504SN/A#define __CPU_STATIC_INST_EXEC_SIGS_HH__
832504SN/A'''
842152SN/A    for cpu in temp_cpu_list:
852504SN/A        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
862152SN/A        print >> f, exec_sig_template % { 'type' : xc_type }
872152SN/A    print >> f, '''
882152SN/A#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
892152SN/A'''
902152SN/A
912152SN/A# Generate string that gets printed when header is rebuilt
926993Snate@binkert.orgdef gen_sigs_string(target, source, env):
936993Snate@binkert.org    return " [GENERATE] static_inst_exec_sigs.hh: " \
946993Snate@binkert.org           + ', '.join(temp_cpu_list)
956993Snate@binkert.org
966993Snate@binkert.org# Add command to generate header to environment.
976993Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', (),
986993Snate@binkert.org            Action(gen_cpu_exec_signatures, gen_sigs_string,
996993Snate@binkert.org                   varlist = temp_cpu_list))
1006993Snate@binkert.org
1016993Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER']))
1026993Snate@binkert.orgenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1036993Snate@binkert.org
1046993Snate@binkert.org# List of suppported CPUs by the Checker.  Errors out if USE_CHECKER=True
1056993Snate@binkert.org# and one of these are not being used.
1066993Snate@binkert.orgCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU']
1076993Snate@binkert.org
1086993Snate@binkert.orgSimObject('BaseCPU.py')
1096998Snate@binkert.orgSimObject('FuncUnit.py')
1106998Snate@binkert.orgSimObject('ExeTracer.py')
1116998Snate@binkert.orgSimObject('IntelTrace.py')
1127756SAli.Saidi@ARM.comSimObject('NativeTrace.py')
1136993Snate@binkert.org
1146993Snate@binkert.orgSource('activity.cc')
1156993Snate@binkert.orgSource('base.cc')
1166993Snate@binkert.orgSource('cpuevent.cc')
1176993Snate@binkert.orgSource('decode.cc')
1186993Snate@binkert.orgSource('exetrace.cc')
1196993Snate@binkert.orgSource('func_unit.cc')
1206993Snate@binkert.orgSource('inteltrace.cc')
1217816Ssteve.reinhardt@amd.comSource('nativetrace.cc')
1222152SN/ASource('pc_event.cc')
1232766Sktlim@umich.eduSource('quiesce_event.cc')
1242766Sktlim@umich.eduSource('static_inst.cc')
1256993Snate@binkert.orgSource('simple_thread.cc')
1262152SN/ASource('thread_context.cc')
1272152SN/ASource('thread_state.cc')
1285944Sgblack@eecs.umich.edu
1295944Sgblack@eecs.umich.eduif env['FULL_SYSTEM']:
1305944Sgblack@eecs.umich.edu    SimObject('IntrControl.py')
1315944Sgblack@eecs.umich.edu
1325944Sgblack@eecs.umich.edu    Source('intr_control.cc')
133    Source('profile.cc')
134
135    if env['TARGET_ISA'] == 'sparc':
136        SimObject('LegionTrace.py')
137        Source('legiontrace.cc')
138
139if env['USE_CHECKER']:
140    Source('checker/cpu.cc')
141    DebugFlag('Checker')
142    checker_supports = False
143    for i in CheckerSupportedCPUList:
144        if i in env['CPU_MODELS']:
145            checker_supports = True
146    if not checker_supports:
147        print "Checker only supports CPU models",
148        for i in CheckerSupportedCPUList:
149            print i,
150        print ", please set USE_CHECKER=False or use one of those CPU models"
151        Exit(1)
152
153DebugFlag('Activity')
154DebugFlag('Commit')
155DebugFlag('Context')
156DebugFlag('Decode')
157DebugFlag('DynInst')
158DebugFlag('ExecEnable')
159DebugFlag('ExecCPSeq')
160DebugFlag('ExecEffAddr')
161DebugFlag('ExecFaulting', 'Trace faulting instructions')
162DebugFlag('ExecFetchSeq')
163DebugFlag('ExecOpClass')
164DebugFlag('ExecRegDelta')
165DebugFlag('ExecResult')
166DebugFlag('ExecSpeculative')
167DebugFlag('ExecSymbol')
168DebugFlag('ExecThread')
169DebugFlag('ExecTicks')
170DebugFlag('ExecMicro')
171DebugFlag('ExecMacro')
172DebugFlag('ExecUser')
173DebugFlag('ExecKernel')
174DebugFlag('ExecAsid')
175DebugFlag('Fetch')
176DebugFlag('IntrControl')
177DebugFlag('O3PipeView')
178DebugFlag('PCEvent')
179DebugFlag('Quiesce')
180
181CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
182    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
183    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
184    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
185    'ExecAsid' ])
186CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
187    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
188    'ExecUser', 'ExecKernel' ])
189CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
190    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
191    'ExecUser', 'ExecKernel' ])
192