SConscript revision 12892
13546Sgblack@eecs.umich.edu# -*- mode:python -*- 23546Sgblack@eecs.umich.edu 33546Sgblack@eecs.umich.edu# Copyright (c) 2009 The Hewlett-Packard Development Company 43546Sgblack@eecs.umich.edu# All rights reserved. 53546Sgblack@eecs.umich.edu# 63546Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 73546Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 83546Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 93546Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 103546Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 113546Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 123546Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 133546Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 143546Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 153546Sgblack@eecs.umich.edu# this software without specific prior written permission. 163546Sgblack@eecs.umich.edu# 173546Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 183546Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 193546Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 203546Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 213546Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 223546Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 233546Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 243546Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 253546Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 263546Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 273546Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 283546Sgblack@eecs.umich.edu# 293546Sgblack@eecs.umich.edu# Authors: Nathan Binkert 303546Sgblack@eecs.umich.edu 314202Sbinkertn@umich.edufrom __future__ import print_function 323546Sgblack@eecs.umich.edu 334202Sbinkertn@umich.eduimport os 344202Sbinkertn@umich.eduimport sys 354202Sbinkertn@umich.edu 363546Sgblack@eecs.umich.edufrom os.path import basename, isdir, join as joinpath 375192Ssaidi@eecs.umich.edu 385192Ssaidi@eecs.umich.eduimport SCons 395192Ssaidi@eecs.umich.edu 404202Sbinkertn@umich.edufrom gem5_scons import Transform 414202Sbinkertn@umich.edu 424202Sbinkertn@umich.eduImport('*') 433546Sgblack@eecs.umich.edu 444202Sbinkertn@umich.eduif env['PROTOCOL'] == 'None': 454202Sbinkertn@umich.edu Return() 464202Sbinkertn@umich.edu 474202Sbinkertn@umich.eduDebugFlag('ProtocolTrace') 484202Sbinkertn@umich.eduDebugFlag('RubyCache') 495192Ssaidi@eecs.umich.eduDebugFlag('RubyCacheTrace') 505192Ssaidi@eecs.umich.eduDebugFlag('RubyDma') 515401Ssaidi@eecs.umich.eduDebugFlag('RubyGenerated') 525401Ssaidi@eecs.umich.eduDebugFlag('RubyNetwork') 535401Ssaidi@eecs.umich.eduDebugFlag('RubyPort') 545401Ssaidi@eecs.umich.eduDebugFlag('RubyPrefetcher') 555401Ssaidi@eecs.umich.eduDebugFlag('RubyQueue') 565401Ssaidi@eecs.umich.eduDebugFlag('RubySequencer') 575403Shines@cs.fsu.eduDebugFlag('RubySlicc') 585403Shines@cs.fsu.eduDebugFlag('RubySystem') 59DebugFlag('RubyTester') 60DebugFlag('RubyStats') 61DebugFlag('RubyResourceStalls') 62 63CompoundFlag('Ruby', [ 'RubyQueue', 'RubyNetwork', 'RubyTester', 64 'RubyGenerated', 'RubySlicc', 'RubySystem', 'RubyCache', 65 'RubyDma', 'RubyPort', 'RubySequencer', 'RubyCacheTrace', 66 'RubyPrefetcher']) 67 68def do_embed_text(target, source, env): 69 """convert a text file into a file that can be embedded in C 70 using an #include statement, that defines a \"const char *\" pointing 71 to the same text. 72 73 This is useful to embed scripts and configuration files in object files. 74 """ 75 76 escape = [ "\'", "\"", "\\", "\?" ] 77 78 # reads the text file in, line by line, converting it to a C string 79 fin = open(str(source[0]), 'r') 80 fout = open(str(target[0]), 'w' ) 81 fout.write("static const char *%s =\n" % source[1].get_contents()); 82 for l in fin: 83 # add escape sequences for the characters in escape 84 fout.write("\"") 85 for char in l: 86 if char == "\n": 87 break 88 if char in escape: 89 fout.write("\\") 90 fout.write(char) 91 else: 92 fout.write(char) 93 fout.write("\\n\"\n"); 94 fout.write(";\n"); 95 fin.close() 96 fout.close() 97 98# 99# Link includes 100# 101generated_dir = Dir('../protocol') 102 103def MakeIncludeAction(target, source, env): 104 f = file(str(target[0]), 'w') 105 for s in source: 106 print('#include "%s"' % str(s.abspath), file=f) 107 f.close() 108 109def MakeInclude(source): 110 target = generated_dir.File(basename(source)) 111 include_action = MakeAction(MakeIncludeAction, Transform("MAKE INC", 1)) 112 env.Command(target, source, include_action) 113 114MakeInclude('slicc_interface/AbstractEntry.hh') 115MakeInclude('slicc_interface/AbstractCacheEntry.hh') 116MakeInclude('slicc_interface/Message.hh') 117MakeInclude('slicc_interface/RubyRequest.hh') 118 119# External types 120MakeInclude('common/Address.hh') 121MakeInclude('common/BoolVec.hh') 122MakeInclude('common/DataBlock.hh') 123MakeInclude('common/IntVec.hh') 124MakeInclude('common/MachineID.hh') 125MakeInclude('common/NetDest.hh') 126MakeInclude('common/Set.hh') 127MakeInclude('common/WriteMask.hh') 128MakeInclude('filters/AbstractBloomFilter.hh') 129MakeInclude('network/MessageBuffer.hh') 130MakeInclude('structures/CacheMemory.hh') 131MakeInclude('structures/DirectoryMemory.hh') 132MakeInclude('structures/PerfectCacheMemory.hh') 133MakeInclude('structures/PersistentTable.hh') 134MakeInclude('structures/Prefetcher.hh') 135MakeInclude('structures/TBETable.hh') 136MakeInclude('structures/TimerTable.hh') 137MakeInclude('structures/WireBuffer.hh') 138MakeInclude('system/DMASequencer.hh') 139MakeInclude('system/Sequencer.hh') 140 141# External types : Group "mem/protocol" : include "header.hh" to the bottom 142# of this MakeIncludes if it is referenced as 143# <# include "mem/protocol/header.hh"> in any file 144# generated_dir = Dir('../protocol') 145MakeInclude('system/GPUCoalescer.hh') 146MakeInclude('system/VIPERCoalescer.hh') 147