From f67a99d1c96fab60e16a8739803de27a3fba6420 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 22 Feb 2006 22:22:06 -0500 Subject: Auto-generate arch/foo.hh "switch headers" in scons. SConscript: Include new arch/SConscript file. arch/isa_specific.hh: Get rid of unnecessary ISA_INCLUDE() macro and other things that were used only for that purpose. build/SConstruct: Move list of ISAs to env var ALL_ISA_LIST. --HG-- extra : convert_revision : 612c7ee4279d57209662be88dc577d80fdbd692c --- arch/SConscript | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 arch/SConscript (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript new file mode 100644 index 000000000..2d8e34b7b --- /dev/null +++ b/arch/SConscript @@ -0,0 +1,74 @@ +# -*- mode:python -*- + +# Copyright (c) 2006 The Regents of The University of Michigan +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import os.path + +# Import build environment variable from SConstruct. +Import('env') + +# +# ISA "switch header" generation. +# +# Auto-generate arch headers that include the right ISA-specific +# header based on the setting of THE_ISA preprocessor variable. + +# List of headers to generate +isa_switch_hdrs = Split(''' + isa_traits.hh + ''') + +# Generate the header. target[0] is the full path of the output +# header to generate. 'source' is a dummy variable, since we get the +# list of ISAs from env['ALL_ISA_LIST']. +def gen_switch_hdr(target, source, env): + fname = str(target[0]) + basename = os.path.basename(fname) + f = open(fname, 'w') + f.write('#include "arch/isa_specific.hh"\n') + cond = '#if' + for isa in env['ALL_ISA_LIST']: + f.write('%s THE_ISA == %s_ISA\n#include "arch/%s/%s"\n' + % (cond, isa.upper(), isa, basename)) + cond = '#elif' + f.write('#else\n#error "THE_ISA not set"\n#endif\n') + f.close() + return 0 + +# String to print when generating header +def gen_switch_hdr_string(target, source, env): + return "Generating ISA switch header " + str(target[0]) + +# Build SCons Action object. 'varlist' specifies env vars that this +# action depdnds on; when env['ALL_ISA_LIST'] changes these actions +# should get re-executed. +switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string, + varlist=['ALL_ISA_LIST']) + +# Instantiate actions for each header +for hdr in isa_switch_hdrs: + env.Command(hdr, [], switch_hdr_action) -- cgit v1.2.3 From 99484cfae81f3f01ccdfcd273ddc2bdb41e6456b Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 23 Feb 2006 14:31:15 -0500 Subject: Create a Builder object for .isa files in arch/SConscript. Start using SCons File objects to avoid fixed paths in subordinate SConscripts. SConscript: Push isa_parser stuff (including .isa scanner) down into arch/SConscript. arch/SConscript: Create a Builder object for .isa files, including existing scanner. Return file objects generated by isa-specific SConscript back up to parent. arch/alpha/SConscript: arch/mips/SConscript: arch/sparc/SConscript: Convert sources to scons File objects, so file names can be specified relative to the current directory. Invoke new builder for isa description, and get generated sources from there (instead of listing them explicitly). arch/isa_parser.py: Get rid of third argument ("include_path"). It was a pain to generate this from scons, and it turned out it's not needed anyway, since the only included file (decoder.hh) will be in the same directory as the sources. --HG-- extra : convert_revision : 36861bcef36763f229704d8cb7a642b4486a3581 --- arch/SConscript | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index 2d8e34b7b..51f6cc023 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -31,11 +31,17 @@ import os.path # Import build environment variable from SConstruct. Import('env') +# Right now there are no source files immediately in this directory +sources = [] + +################################################################# # # ISA "switch header" generation. # # Auto-generate arch headers that include the right ISA-specific # header based on the setting of THE_ISA preprocessor variable. +# +################################################################# # List of headers to generate isa_switch_hdrs = Split(''' @@ -72,3 +78,69 @@ switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string, # Instantiate actions for each header for hdr in isa_switch_hdrs: env.Command(hdr, [], switch_hdr_action) + +################################################################# +# +# Include architecture-specific files. +# +################################################################# + +# +# Build a SCons scanner for ISA files +# +import SCons.Scanner + +def ISAScan(): + return SCons.Scanner.Classic("ISAScan", + "$ISASUFFIXES", + "SRCDIR", + '^[ \t]*##[ \t]*include[ \t]*"([^>"]+)"') + +def ISAPath(env, dir, target=None, source=None, a=None): + return (Dir(env['SRCDIR']), Dir('.')) + +iscan = Scanner(function = ISAScan().scan, skeys = [".isa", ".ISA"], + path_function = ISAPath) +env.Append(SCANNERS = iscan) + +# +# Now create a Builder object that uses isa_parser.py to generate C++ +# output from the ISA description (*.isa) files. +# + +# several files are generated from the ISA description +isa_desc_gen_files = Split(''' + decoder.cc + alpha_o3_exec.cc + fast_cpu_exec.cc + simple_cpu_exec.cc + full_cpu_exec.cc + decoder.hh + ''') + +# Convert to File node to fix path +isa_parser = File('isa_parser.py') + +# The emitter patches up the sources & targets to include the +# autogenerated files as targets and isa parser itself as a source. +def isa_desc_emitter(target, source, env): + return (isa_desc_gen_files, [isa_parser] + source) + +# Pieces are in place, so create the builder. +isa_desc_builder = Builder(action='${SOURCES[0]} ${SOURCES[1]} $TARGET.dir', + source_scanner = iscan, + emitter = isa_desc_emitter) + +env.Append(BUILDERS = { 'ISADesc' : isa_desc_builder }) + +# +# Now include other ISA-specific sources from the ISA subdirectories. +# + +isa = env['TARGET_ISA'] # someday this may be a list of ISAs + +# Let the target architecture define what additional sources it needs +sources += SConscript(os.path.join(isa, 'SConscript'), + exports = 'env', duplicate = False) + +Return('sources') -- cgit v1.2.3 From 51647e7bec8e8607fc5713b4ace2c24ce8a7455a Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 23 Feb 2006 17:00:29 -0500 Subject: Enable building only selected CPU models via new scons CPU_MODELS parameter. For example: scons CPU_MODELS="SimpleCPU,FullCPU" ALPHA_SE/m5.debug Unfortunately the option is not sticky due to a scons bug with saving & restoring ListOption parameters. SConscript: Separate out cpu-model-specific files so they can be conditionally included based on value of new CPU_MODELS parameter. Most of these are now handled in cpu/SConscript, except for FullCPU which is still in this file. arch/SConscript: The set of CPU-model-specific execute files must now be determined from the CPU_MODELS parameter, via the new cpu_models.py file. Also pass the list of configured CPU models to isa_parser.py. arch/isa_parser.py: Move CpuModel definition and objects out to a separate file so they can be shared with scons. Global list of CPU models to generate code for is now controlled by command-line parameters (so we can do only a subset of the available ones). build/SConstruct: Define new CPU_MODELS ListOption. cpu/static_inst.hh: Rename static_inst_impl.hh to static_inst_exec_sigs.hh. --HG-- extra : convert_revision : 163df32a76d4c05900490b2bce4c7962a5e3f614 --- arch/SConscript | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index 51f6cc023..d237b0b1f 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -108,26 +108,27 @@ env.Append(SCANNERS = iscan) # output from the ISA description (*.isa) files. # -# several files are generated from the ISA description -isa_desc_gen_files = Split(''' - decoder.cc - alpha_o3_exec.cc - fast_cpu_exec.cc - simple_cpu_exec.cc - full_cpu_exec.cc - decoder.hh - ''') - # Convert to File node to fix path isa_parser = File('isa_parser.py') +cpu_models_file = File('#m5/cpu/cpu_models.py') + +# This sucks in the defintions of the CpuModel objects. +execfile(cpu_models_file.srcnode().abspath) + +# Several files are generated from the ISA description. +# We always get the basic decoder and header file. +isa_desc_gen_files = Split('decoder.cc decoder.hh') +# We also get an execute file for each selected CPU model. +isa_desc_gen_files += [CpuModel.dict[cpu].filename + for cpu in env['CPU_MODELS']] # The emitter patches up the sources & targets to include the # autogenerated files as targets and isa parser itself as a source. def isa_desc_emitter(target, source, env): - return (isa_desc_gen_files, [isa_parser] + source) + return (isa_desc_gen_files, [isa_parser, cpu_models_file] + source) # Pieces are in place, so create the builder. -isa_desc_builder = Builder(action='${SOURCES[0]} ${SOURCES[1]} $TARGET.dir', +isa_desc_builder = Builder(action='$SOURCES $TARGET.dir $CPU_MODELS', source_scanner = iscan, emitter = isa_desc_emitter) -- cgit v1.2.3 From 63db9860cf4ef1bfdfe97bf7f276c27dc5d13eea Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 25 Feb 2006 22:57:46 -0500 Subject: Make sure cpu/static_inst_exec_sigs.hh get rebuilt when CPU_MODELS parameter changes. arch/SConscript: Fix typo in comment. cpu/SConscript: Convert exec signature generator to Action so we can add dependency on CPU_MODELS environment var. Print nicer string while we're at it. Also add some comments. --HG-- extra : convert_revision : bcb38a7941943cf071dac34cdbb2ece5456b8620 --- arch/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index d237b0b1f..142bd763b 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -70,7 +70,7 @@ def gen_switch_hdr_string(target, source, env): return "Generating ISA switch header " + str(target[0]) # Build SCons Action object. 'varlist' specifies env vars that this -# action depdnds on; when env['ALL_ISA_LIST'] changes these actions +# action depends on; when env['ALL_ISA_LIST'] changes these actions # should get re-executed. switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string, varlist=['ALL_ISA_LIST']) -- cgit v1.2.3 From c5dcd152f264a837f50d39f98d0f4f81478e3553 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 27 Feb 2006 05:35:43 -0500 Subject: Changed targetarch to just arch. SConscript: Changed all of the "targetarch" files to be "arch" files arch/SConscript: Added all of the remaining targetarch files to isa_switch_hdrs --HG-- extra : convert_revision : a37d18349e27cf92dce12814f21944daa7fe9480 --- arch/SConscript | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index d237b0b1f..2036b6a56 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -46,6 +46,16 @@ sources = [] # List of headers to generate isa_switch_hdrs = Split(''' isa_traits.hh + alpha_linux_process.hh + alpha_tru64_process.hh + alpha_memory.hh + aout_machdep.h + ecoff_machdep.h + arguments.hh + stacktrace.hh + vtophys.hh + faults.hh + ev5.hh ''') # Generate the header. target[0] is the full path of the output -- cgit v1.2.3 From f1ef4a8f06184df55e26268381cb4f8f56b77a50 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 27 Feb 2006 06:05:10 -0500 Subject: Renamed arch files to remove alpha prefix, and changed alpha_memory.hh and cc to a more accurate tlb.hh and cc --HG-- rename : arch/alpha/alpha_linux_process.cc => arch/alpha/linux_process.cc rename : arch/alpha/alpha_linux_process.hh => arch/alpha/linux_process.hh rename : arch/alpha/alpha_memory.cc => arch/alpha/tlb.cc rename : arch/alpha/alpha_memory.hh => arch/alpha/tlb.hh rename : arch/alpha/alpha_tru64_process.cc => arch/alpha/tru64_process.cc rename : arch/alpha/alpha_tru64_process.hh => arch/alpha/tru64_process.hh extra : convert_revision : 9fe6863cc37347d2a6bd716c529b0a4a50b36ea7 --- arch/SConscript | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index 2036b6a56..c62e45763 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -46,9 +46,9 @@ sources = [] # List of headers to generate isa_switch_hdrs = Split(''' isa_traits.hh - alpha_linux_process.hh - alpha_tru64_process.hh - alpha_memory.hh + linux_process.hh + tru64_process.hh + tlb.hh aout_machdep.h ecoff_machdep.h arguments.hh -- cgit v1.2.3 From 7c4c623302dca7da95b1c95d4968f4ef76de391d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 4 Mar 2006 03:09:23 -0500 Subject: Filled out the object file loader so it can load object files for several OSs and architectures. SConscript: Added ./libelf as an include search directory. There might be a better spot for this than where I put it. arch/SConscript: Combined the linux_process.h and tru64_process.h into process.h. This allows each ISA to support processes from arbitrary OSs. arch/alpha/SConscript: Added process.cc as a source file. It provides an implementation of createProcess, which takes an object_file object and creates the appropriate process object, or dies. base/loader/elf_object.cc: Actually extract the OS and architecture from the elf file, rather than always guessing Alpha and Linux. base/loader/object_file.hh: Added constants for SPARC, MIPS, and Solaris, and changed the include for the Addr type. sim/process.cc: Pushed creation of specific process objects into the ISA specific code. --HG-- extra : convert_revision : b4754e7ca8328672d07e1394c4d162e199606b53 --- arch/SConscript | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index 5783b39dd..b4b7a1ddb 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -46,9 +46,8 @@ sources = [] # List of headers to generate isa_switch_hdrs = Split(''' isa_traits.hh - linux_process.hh - tru64_process.hh tlb.hh + process.hh aout_machdep.h ecoff_machdep.h arguments.hh -- cgit v1.2.3 From cd62fed1a7c535befaa00c8775de78f9f29b1274 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 7 Mar 2006 09:34:24 -0500 Subject: The a.out and ecoff object file formats will only be supported on Alpha for now. arch/SConscript: aout_machdep.h and ecoff_machdep.h are no longer bridging headers, since support of these formats is limitted to alpha. base/loader/exec_aout.h: Include the alpha specific version of aout_machdep.h, since only the alpha version of aout will be supported for now. base/loader/exec_ecoff.h: Include the alpha specific version of ecoff_machdep.h, since only the alpha version of ecoff will be supported for now. --HG-- extra : convert_revision : 15328aae54538c26d2c10d7476501e0daa3d22d0 --- arch/SConscript | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index b4b7a1ddb..380cda307 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -48,8 +48,6 @@ isa_switch_hdrs = Split(''' isa_traits.hh tlb.hh process.hh - aout_machdep.h - ecoff_machdep.h arguments.hh stacktrace.hh vtophys.hh -- cgit v1.2.3 From 8106a804508a42455650082a83f4cdb366ca5148 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 7 Mar 2006 14:08:01 -0500 Subject: Pushed ev5.hh out of the non-alpha code. arch/SConscript: ev5 should now be contained within alpha specific code. arch/alpha/ev5.cc: arch/alpha/isa_traits.hh: Added getInstAsid and getDataAsid functions. These should be removed when the SimpleScalar cpu model is removed. arch/sparc/isa_traits.hh: Added getInstAsid and getDataAsid functions. These should be removed when the SimpleScalar cpu model is removed. Also made some small fixes. cpu/o3/alpha_cpu.hh: Added typedefs which are required now that there isn't a using namespace EV5. cpu/o3/alpha_cpu_impl.hh: Some small changes so that ev5.hh isn't needed directly. cpu/o3/cpu.hh: Removed including ev5.hh, and pushed retrieving the Asid into the MiscRegFile. cpu/o3/regfile.hh: Removed the include of ev5.hh, using namespace EV5, and the now redundant ipr array. --HG-- extra : convert_revision : 5ef8f69435a3a888a3f06d0095d89326dafb33fd --- arch/SConscript | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/SConscript') diff --git a/arch/SConscript b/arch/SConscript index 380cda307..0533261a2 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -52,7 +52,6 @@ isa_switch_hdrs = Split(''' stacktrace.hh vtophys.hh faults.hh - ev5.hh ''') # Generate the header. target[0] is the full path of the output -- cgit v1.2.3