SConscript revision 4781
14484Sbinkertn@umich.edu# -*- mode:python -*-
24484Sbinkertn@umich.edu
34484Sbinkertn@umich.edu# Copyright (c) 2006 The Regents of The University of Michigan
44484Sbinkertn@umich.edu# All rights reserved.
54484Sbinkertn@umich.edu#
64484Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without
74484Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are
84484Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright
94484Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer;
104484Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright
114484Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the
124484Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution;
134484Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its
144484Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
154484Sbinkertn@umich.edu# this software without specific prior written permission.
164484Sbinkertn@umich.edu#
174484Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
184484Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
194484Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
204484Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
214484Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
224484Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
234484Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
244484Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
254484Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
264484Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
274484Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284484Sbinkertn@umich.edu#
294484Sbinkertn@umich.edu# Authors: Steve Reinhardt
304484Sbinkertn@umich.edu
314494Ssaidi@eecs.umich.eduImport('*')
324484Sbinkertn@umich.edu
336121Snate@binkert.org#################################################################
344484Sbinkertn@umich.edu#
354484Sbinkertn@umich.edu# Generate StaticInst execute() method signatures.
364484Sbinkertn@umich.edu#
374484Sbinkertn@umich.edu# There must be one signature for each CPU model compiled in.
384781Snate@binkert.org# Since the set of compiled-in models is flexible, we generate a
394484Sbinkertn@umich.edu# header containing the appropriate set of signatures on the fly.
404484Sbinkertn@umich.edu#
414484Sbinkertn@umich.edu#################################################################
424484Sbinkertn@umich.edu
438349Sgblack@eecs.umich.edu# CPU model-specific data is contained in cpu_models.py
448349Sgblack@eecs.umich.edu# Convert to SCons File node to get path handling
454484Sbinkertn@umich.edumodels_db = File('cpu_models.py')
464484Sbinkertn@umich.edu# slurp in contents of file
474484Sbinkertn@umich.eduexecfile(models_db.srcnode().abspath)
484484Sbinkertn@umich.edu
494484Sbinkertn@umich.edu# Template for execute() signature.
504484Sbinkertn@umich.eduexec_sig_template = '''
514484Sbinkertn@umich.eduvirtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
524484Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const
534484Sbinkertn@umich.edu{ panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
544484Sbinkertn@umich.eduvirtual Fault completeAcc(Packet *pkt, %s *xc,
554484Sbinkertn@umich.edu                          Trace::InstRecord *traceData) const
564484Sbinkertn@umich.edu{ panic("completeAcc not defined!"); M5_DUMMY_RETURN };
574484Sbinkertn@umich.edu'''
584484Sbinkertn@umich.edu
594484Sbinkertn@umich.edumem_ini_sig_template = '''
604484Sbinkertn@umich.eduvirtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
614484Sbinkertn@umich.edu'''
624484Sbinkertn@umich.edu
634484Sbinkertn@umich.edumem_comp_sig_template = '''
644484Sbinkertn@umich.eduvirtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
654484Sbinkertn@umich.edu'''
664484Sbinkertn@umich.edu
674484Sbinkertn@umich.edu# Generate a temporary CPU list, including the CheckerCPU if
684484Sbinkertn@umich.edu# it's enabled.  This isn't used for anything else other than StaticInst
694484Sbinkertn@umich.edu# headers.
704484Sbinkertn@umich.edutemp_cpu_list = env['CPU_MODELS'][:]
714484Sbinkertn@umich.edu
724484Sbinkertn@umich.eduif env['USE_CHECKER']:
734484Sbinkertn@umich.edu    temp_cpu_list.append('CheckerCPU')
744484Sbinkertn@umich.edu
754484Sbinkertn@umich.edu# Generate header.
764484Sbinkertn@umich.edudef gen_cpu_exec_signatures(target, source, env):
774484Sbinkertn@umich.edu    f = open(str(target[0]), 'w')
784484Sbinkertn@umich.edu    print >> f, '''
794484Sbinkertn@umich.edu#ifndef __CPU_STATIC_INST_EXEC_SIGS_HH__
804484Sbinkertn@umich.edu#define __CPU_STATIC_INST_EXEC_SIGS_HH__
814484Sbinkertn@umich.edu'''
824484Sbinkertn@umich.edu    for cpu in temp_cpu_list:
834484Sbinkertn@umich.edu        xc_type = CpuModel.dict[cpu].strings['CPU_exec_context']
844484Sbinkertn@umich.edu        print >> f, exec_sig_template % (xc_type, xc_type, xc_type)
854484Sbinkertn@umich.edu    print >> f, '''
864484Sbinkertn@umich.edu#endif  // __CPU_STATIC_INST_EXEC_SIGS_HH__
874484Sbinkertn@umich.edu'''
884484Sbinkertn@umich.edu
894484Sbinkertn@umich.edu# Generate string that gets printed when header is rebuilt
904484Sbinkertn@umich.edudef gen_sigs_string(target, source, env):
914484Sbinkertn@umich.edu    return "Generating static_inst_exec_sigs.hh: " \
926121Snate@binkert.org           + ', '.join(temp_cpu_list)
936121Snate@binkert.org
946121Snate@binkert.org# Add command to generate header to environment.
955765Snate@binkert.orgenv.Command('static_inst_exec_sigs.hh', models_db,
965765Snate@binkert.org            Action(gen_cpu_exec_signatures, gen_sigs_string,
975765Snate@binkert.org                   varlist = temp_cpu_list))
985397Ssaidi@eecs.umich.edu
995274Ssaidi@eecs.umich.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['USE_CHECKER']))
1004494Ssaidi@eecs.umich.eduenv.Depends('static_inst_exec_sigs.hh', Value(env['CPU_MODELS']))
1014504Ssaidi@eecs.umich.edu
1024494Ssaidi@eecs.umich.edu# List of suppported CPUs by the Checker.  Errors out if USE_CHECKER=True
1034494Ssaidi@eecs.umich.edu# and one of these are not being used.
1044496Ssaidi@eecs.umich.eduCheckerSupportedCPUList = ['O3CPU', 'OzoneCPU']
1054504Ssaidi@eecs.umich.edu
1064504Ssaidi@eecs.umich.eduSimObject('BaseCPU.py')
1074500Sbinkertn@umich.eduSimObject('FuncUnit.py')
1084500Sbinkertn@umich.edu
1094496Ssaidi@eecs.umich.eduSource('activity.cc')
1104496Ssaidi@eecs.umich.eduSource('base.cc')
1117739Sgblack@eecs.umich.eduSource('cpuevent.cc')
1124487Sstever@eecs.umich.eduSource('exetrace.cc')
1134484Sbinkertn@umich.eduSource('func_unit.cc')
1144484Sbinkertn@umich.eduSource('pc_event.cc')
1154484Sbinkertn@umich.eduSource('quiesce_event.cc')
1164484Sbinkertn@umich.eduSource('static_inst.cc')
1174484Sbinkertn@umich.eduSource('simple_thread.cc')
1184484Sbinkertn@umich.eduSource('thread_state.cc')
1195601Snate@binkert.org
1205601Snate@binkert.orgif env['FULL_SYSTEM']:
1215601Snate@binkert.org    SimObject('IntrControl.py')
1225601Snate@binkert.org
1234484Sbinkertn@umich.edu    Source('intr_control.cc')
1246121Snate@binkert.org    Source('profile.cc')
1256121Snate@binkert.org
1266121Snate@binkert.orgif env['USE_CHECKER']:
1274494Ssaidi@eecs.umich.edu    Source('checker/cpu.cc')
128    checker_supports = False
129    for i in CheckerSupportedCPUList:
130        if i in env['CPU_MODELS']:
131            checker_supports = True
132    if not checker_supports:
133        print "Checker only supports CPU models",
134        for i in CheckerSupportedCPUList:
135            print i,
136        print ", please set USE_CHECKER=False or use one of those CPU models"
137        Exit(1)
138