SConscript revision 8761
12086SN/A# -*- mode:python -*-
22086SN/A
32086SN/A# Copyright (c) 2006 The Regents of The University of Michigan
42086SN/A# All rights reserved.
52086SN/A#
62086SN/A# Redistribution and use in source and binary forms, with or without
72086SN/A# modification, are permitted provided that the following conditions are
82086SN/A# met: redistributions of source code must retain the above copyright
92086SN/A# notice, this list of conditions and the following disclaimer;
102086SN/A# redistributions in binary form must reproduce the above copyright
112086SN/A# notice, this list of conditions and the following disclaimer in the
122086SN/A# documentation and/or other materials provided with the distribution;
132086SN/A# neither the name of the copyright holders nor the names of its
142086SN/A# contributors may be used to endorse or promote products derived from
152086SN/A# this software without specific prior written permission.
162086SN/A#
172086SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182086SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192086SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202086SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212086SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222086SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232086SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242086SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252086SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262086SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272086SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu#
292665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt
302665Ssaidi@eecs.umich.edu
312086SN/AImport('*')
324202Sbinkertn@umich.edu
332086SN/Aif env['TARGET_ISA'] == 'no':
344202Sbinkertn@umich.edu    Return()
354202Sbinkertn@umich.edu
369022Sgblack@eecs.umich.edu#################################################################
374202Sbinkertn@umich.edu#
388745Sgblack@eecs.umich.edu# Generate StaticInst execute() method signatures.
396313Sgblack@eecs.umich.edu#
408778Sgblack@eecs.umich.edu# There must be one signature for each CPU model compiled in.
418778Sgblack@eecs.umich.edu# Since the set of compiled-in models is flexible, we generate a
428778Sgblack@eecs.umich.edu# header containing the appropriate set of signatures on the fly.
436365Sgblack@eecs.umich.edu#
444997Sgblack@eecs.umich.edu#################################################################
458778Sgblack@eecs.umich.edu
464202Sbinkertn@umich.edu# Template for execute() signature.
478778Sgblack@eecs.umich.eduexec_sig_template = '''
488778Sgblack@eecs.umich.eduvirtual Fault execute(%(type)s *xc, Trace::InstRecord *traceData) const = 0;
498778Sgblack@eecs.umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
504997Sgblack@eecs.umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
518747Sgblack@eecs.umich.eduvirtual Fault initiateAcc(%(type)s *xc, Trace::InstRecord *traceData) const
524826Ssaidi@eecs.umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
538760Sgblack@eecs.umich.eduvirtual Fault completeAcc(Packet *pkt, %(type)s *xc,
542086SN/A                          Trace::InstRecord *traceData) const
558745Sgblack@eecs.umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
569384SAndreas.Sandberg@arm.com'''
576365Sgblack@eecs.umich.edu
588778Sgblack@eecs.umich.edumem_ini_sig_template = '''
598745Sgblack@eecs.umich.eduvirtual Fault eaComp(%(type)s *xc, Trace::InstRecord *traceData) const
606365Sgblack@eecs.umich.edu{ panic("eaComp not defined!"); M5_DUMMY_RETURN };
618335Snate@binkert.orgvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
628335Snate@binkert.org'''
634997Sgblack@eecs.umich.edu
6410196SCurtis.Dunham@arm.commem_comp_sig_template = '''
65virtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
66'''
67
68# Generate a temporary CPU list, including the CheckerCPU if
69# it's enabled.  This isn't used for anything else other than StaticInst
70# headers.
71temp_cpu_list = env['CPU_MODELS'][:]
72
73if env['USE_CHECKER']:
74    temp_cpu_list.append('CheckerCPU')
75    SimObject('CheckerCPU.py')
76
77# Generate header.
78def gen_cpu_exec_signatures(target, source, env):
79    f = open(str(target[0]), 'w')
80    print >> f, '''
81#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
82#define __CPU_STATIC_INST_EXEC_SIGS_HH__
83'''
84    for cpu in temp_cpu_list:
85        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
86        print >> f, exec_sig_template % { 'type' : xc_type }
87    print >> f, '''
88#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
89'''
90
91# Generate string that gets printed when header is rebuilt
92def gen_sigs_string(target, source, env):
93    return " [GENERATE] static_inst_exec_sigs.hh: " \
94           + ', '.join(temp_cpu_list)
95
96# Add command to generate header to environment.
97env.Command('static_inst_exec_sigs.hh', (),
98            Action(gen_cpu_exec_signatures, gen_sigs_string,
99                   varlist = temp_cpu_list))
100
101env.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER']))
102env.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
103
104# List of suppported CPUs by the Checker.  Errors out if USE_CHECKER=True
105# and one of these are not being used.
106CheckerSupportedCPUList = ['O3CPU', 'OzoneCPU']
107
108SimObject('BaseCPU.py')
109SimObject('FuncUnit.py')
110SimObject('ExeTracer.py')
111SimObject('IntelTrace.py')
112SimObject('IntrControl.py')
113SimObject('NativeTrace.py')
114
115Source('activity.cc')
116Source('base.cc')
117Source('cpuevent.cc')
118Source('decode.cc')
119Source('exetrace.cc')
120Source('func_unit.cc')
121Source('inteltrace.cc')
122Source('intr_control.cc')
123Source('nativetrace.cc')
124Source('pc_event.cc')
125Source('quiesce_event.cc')
126Source('static_inst.cc')
127Source('simple_thread.cc')
128Source('thread_context.cc')
129Source('thread_state.cc')
130
131if env['FULL_SYSTEM']:
132    Source('profile.cc')
133
134    if env['TARGET_ISA'] == 'sparc':
135        SimObject('LegionTrace.py')
136        Source('legiontrace.cc')
137
138if env['USE_CHECKER']:
139    Source('checker/cpu.cc')
140    DebugFlag('Checker')
141    checker_supports = False
142    for i in CheckerSupportedCPUList:
143        if i in env['CPU_MODELS']:
144            checker_supports = True
145    if not checker_supports:
146        print "Checker only supports CPU models",
147        for i in CheckerSupportedCPUList:
148            print i,
149        print ", please set USE_CHECKER=False or use one of those CPU models"
150        Exit(1)
151
152DebugFlag('Activity')
153DebugFlag('Commit')
154DebugFlag('Context')
155DebugFlag('Decode')
156DebugFlag('DynInst')
157DebugFlag('ExecEnable')
158DebugFlag('ExecCPSeq')
159DebugFlag('ExecEffAddr')
160DebugFlag('ExecFaulting', 'Trace faulting instructions')
161DebugFlag('ExecFetchSeq')
162DebugFlag('ExecOpClass')
163DebugFlag('ExecRegDelta')
164DebugFlag('ExecResult')
165DebugFlag('ExecSpeculative')
166DebugFlag('ExecSymbol')
167DebugFlag('ExecThread')
168DebugFlag('ExecTicks')
169DebugFlag('ExecMicro')
170DebugFlag('ExecMacro')
171DebugFlag('ExecUser')
172DebugFlag('ExecKernel')
173DebugFlag('ExecAsid')
174DebugFlag('Fetch')
175DebugFlag('IntrControl')
176DebugFlag('O3PipeView')
177DebugFlag('PCEvent')
178DebugFlag('Quiesce')
179
180CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr',
181    'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta',
182    'ExecResult', 'ExecSpeculative', 'ExecSymbol', 'ExecThread',
183    'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel',
184    'ExecAsid' ])
185CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
186    'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecFaulting',
187    'ExecUser', 'ExecKernel' ])
188CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread',
189    'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecFaulting',
190    'ExecUser', 'ExecKernel' ])
191