SConscript revision 6735
16019Shines@cs.fsu.edu# -*- mode:python -*-
26019Shines@cs.fsu.edu
310037SARM gem5 Developers# Copyright (c) 2006 The Regents of The University of Michigan
47100Sgblack@eecs.umich.edu# All rights reserved.
57100Sgblack@eecs.umich.edu#
67100Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
77100Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
87100Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
97100Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
107100Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
117100Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
127100Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
137100Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
147100Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
156019Shines@cs.fsu.edu# this software without specific prior written permission.
166019Shines@cs.fsu.edu#
176019Shines@cs.fsu.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186019Shines@cs.fsu.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196019Shines@cs.fsu.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206019Shines@cs.fsu.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216019Shines@cs.fsu.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226019Shines@cs.fsu.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236019Shines@cs.fsu.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246019Shines@cs.fsu.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256019Shines@cs.fsu.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266019Shines@cs.fsu.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276019Shines@cs.fsu.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286019Shines@cs.fsu.edu#
296019Shines@cs.fsu.edu# Authors: Steve Reinhardt
306019Shines@cs.fsu.edu
316019Shines@cs.fsu.eduimport sys
326019Shines@cs.fsu.edu
336019Shines@cs.fsu.eduImport('*')
346019Shines@cs.fsu.edu
356019Shines@cs.fsu.edu#################################################################
366019Shines@cs.fsu.edu#
376019Shines@cs.fsu.edu# ISA "switch header" generation.
386019Shines@cs.fsu.edu#
396019Shines@cs.fsu.edu# Auto-generate arch headers that include the right ISA-specific
406019Shines@cs.fsu.edu# header based on the setting of THE_ISA preprocessor variable.
416019Shines@cs.fsu.edu#
426757SAli.Saidi@ARM.com#################################################################
436019Shines@cs.fsu.edu
446019Shines@cs.fsu.edu# List of headers to generate
456019Shines@cs.fsu.eduisa_switch_hdrs = Split('''
466019Shines@cs.fsu.edu        arguments.hh
476019Shines@cs.fsu.edu        faults.hh
4811320Ssteve.reinhardt@amd.com        interrupts.hh
496019Shines@cs.fsu.edu	isa.hh
509022Sgblack@eecs.umich.edu        isa_traits.hh
516019Shines@cs.fsu.edu        kernel_stats.hh
5212640Sgiacomo.travaglini@arm.com        locked_mem.hh
5310037SARM gem5 Developers        microcode_rom.hh
5410037SARM gem5 Developers        mmaped_ipr.hh
557170Sgblack@eecs.umich.edu        mt.hh
566253Sgblack@eecs.umich.edu        process.hh
5710037SARM gem5 Developers        predecoder.hh
587202Sgblack@eecs.umich.edu        registers.hh
5910037SARM gem5 Developers        remote_gdb.hh
606253Sgblack@eecs.umich.edu        stacktrace.hh
6110611SAndreas.Sandberg@ARM.com        tlb.hh
626253Sgblack@eecs.umich.edu        types.hh
637396Sgblack@eecs.umich.edu        utility.hh
6410037SARM gem5 Developers        vtophys.hh
658745Sgblack@eecs.umich.edu        ''')
667405SAli.Saidi@ARM.com
6710461SAndreas.Sandberg@ARM.com# Set up this directory to support switching headers
688782Sgblack@eecs.umich.edumake_switching_dir('arch', isa_switch_hdrs, env)
698782Sgblack@eecs.umich.edu
708782Sgblack@eecs.umich.edu#################################################################
7110810Sbr@bsdpad.com#
7210810Sbr@bsdpad.com# Include architecture-specific files.
7310810Sbr@bsdpad.com#
747259Sgblack@eecs.umich.edu#################################################################
758757Sgblack@eecs.umich.edu
7610461SAndreas.Sandberg@ARM.com#
778782Sgblack@eecs.umich.edu# Build a SCons scanner for ISA files
788757Sgblack@eecs.umich.edu#
7912531Sandreas.sandberg@arm.comimport SCons.Scanner
808777Sgblack@eecs.umich.edu
818782Sgblack@eecs.umich.eduisa_scanner = SCons.Scanner.Classic("ISAScan",
828756Sgblack@eecs.umich.edu                                    [".isa", ".ISA"],
8310037SARM gem5 Developers                                    "SRCDIR",
8410037SARM gem5 Developers                                    r'^\s*##include\s+"([\w/.-]*)"')
856019Shines@cs.fsu.edu
8612605Sgiacomo.travaglini@arm.comenv.Append(SCANNERS = isa_scanner)
876757SAli.Saidi@ARM.com
888757Sgblack@eecs.umich.edu#
896019Shines@cs.fsu.edu# Now create a Builder object that uses isa_parser.py to generate C++
908745Sgblack@eecs.umich.edu# output from the ISA description (*.isa) files.
919384SAndreas.Sandberg@arm.com#
926397Sgblack@eecs.umich.edu
9312531Sandreas.sandberg@arm.com# Convert to File node to fix path
948782Sgblack@eecs.umich.eduisa_parser = File('isa_parser.py')
956019Shines@cs.fsu.educpu_models_file = File('../cpu/cpu_models.py')
9610461SAndreas.Sandberg@ARM.com
976397Sgblack@eecs.umich.edu# This sucks in the defintions of the CpuModel objects.
988335Snate@binkert.orgexecfile(cpu_models_file.srcnode().abspath)
9912531Sandreas.sandberg@arm.com
1009023Sgblack@eecs.umich.edu# Several files are generated from the ISA description.
1019023Sgblack@eecs.umich.edu# We always get the basic decoder and header file.
10210461SAndreas.Sandberg@ARM.comisa_desc_gen_files = [ 'decoder.cc', 'decoder.hh', 'max_inst_regs.hh' ]
1038335Snate@binkert.org# We also get an execute file for each selected CPU model.
1046019Shines@cs.fsu.eduisa_desc_gen_files += [CpuModel.dict[cpu].filename
10510196SCurtis.Dunham@arm.com                       for cpu in env['CPU_MODELS']]
10612222Sgabeblack@google.com
107# Also include the CheckerCPU as one of the models if it is being
108# enabled via command line.
109if env['USE_CHECKER']:
110    isa_desc_gen_files += [CpuModel.dict['CheckerCPU'].filename]
111
112# The emitter patches up the sources & targets to include the
113# autogenerated files as targets and isa parser itself as a source.
114def isa_desc_emitter(target, source, env):
115    return (isa_desc_gen_files, [isa_parser, cpu_models_file] + source)
116
117# Pieces are in place, so create the builder.
118python = sys.executable  # use same Python binary used to run scons
119
120# Also include the CheckerCPU as one of the models if it is being
121# enabled via command line.
122if env['USE_CHECKER']:
123    isa_desc_builder = Builder(action=python + ' $SOURCES $TARGET.dir $CPU_MODELS CheckerCPU',
124                               emitter = isa_desc_emitter)
125else:
126    isa_desc_builder = Builder(action=python + ' $SOURCES $TARGET.dir $CPU_MODELS',
127                               emitter = isa_desc_emitter)
128
129env.Append(BUILDERS = { 'ISADesc' : isa_desc_builder })
130
131TraceFlag('IntRegs')
132TraceFlag('FloatRegs')
133TraceFlag('MiscRegs')
134CompoundFlag('Registers', [ 'IntRegs', 'FloatRegs', 'MiscRegs' ])
135