SConscript revision 12892
16757SAli.Saidi@ARM.com# -*- mode:python -*- 210037SARM gem5 Developers 36757SAli.Saidi@ARM.com# Copyright (c) 2009 The Hewlett-Packard Development Company 46757SAli.Saidi@ARM.com# All rights reserved. 57111Sgblack@eecs.umich.edu# 67111Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 77111Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 87111Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 97111Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 107111Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 117111Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 127111Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 137111Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 146757SAli.Saidi@ARM.com# contributors may be used to endorse or promote products derived from 156757SAli.Saidi@ARM.com# this software without specific prior written permission. 166757SAli.Saidi@ARM.com# 176757SAli.Saidi@ARM.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 186757SAli.Saidi@ARM.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 196757SAli.Saidi@ARM.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 206757SAli.Saidi@ARM.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 216757SAli.Saidi@ARM.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 226757SAli.Saidi@ARM.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 236757SAli.Saidi@ARM.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 246757SAli.Saidi@ARM.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 256757SAli.Saidi@ARM.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 266757SAli.Saidi@ARM.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 276757SAli.Saidi@ARM.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 286757SAli.Saidi@ARM.com# 296757SAli.Saidi@ARM.com# Authors: Nathan Binkert 306757SAli.Saidi@ARM.com 316757SAli.Saidi@ARM.comfrom __future__ import print_function 326757SAli.Saidi@ARM.com 336757SAli.Saidi@ARM.comimport os 346757SAli.Saidi@ARM.comimport sys 356757SAli.Saidi@ARM.com 366757SAli.Saidi@ARM.comfrom os.path import basename, isdir, join as joinpath 376757SAli.Saidi@ARM.com 386757SAli.Saidi@ARM.comimport SCons 396735Sgblack@eecs.umich.edu 406757SAli.Saidi@ARM.comfrom gem5_scons import Transform 416757SAli.Saidi@ARM.com 427707Sgblack@eecs.umich.eduImport('*') 4310037SARM gem5 Developers 448782Sgblack@eecs.umich.eduif env['PROTOCOL'] == 'None': 456757SAli.Saidi@ARM.com Return() 468782Sgblack@eecs.umich.edu 478887Sgeoffrey.blake@arm.comDebugFlag('ProtocolTrace') 488886SAli.Saidi@ARM.comDebugFlag('RubyCache') 496757SAli.Saidi@ARM.comDebugFlag('RubyCacheTrace') 508706Sandreas.hansson@arm.comDebugFlag('RubyDma') 518782Sgblack@eecs.umich.eduDebugFlag('RubyGenerated') 527749SAli.Saidi@ARM.comDebugFlag('RubyNetwork') 536735Sgblack@eecs.umich.eduDebugFlag('RubyPort') 546735Sgblack@eecs.umich.eduDebugFlag('RubyPrefetcher') 556735Sgblack@eecs.umich.eduDebugFlag('RubyQueue') 566735Sgblack@eecs.umich.eduDebugFlag('RubySequencer') 576735Sgblack@eecs.umich.eduDebugFlag('RubySlicc') 586735Sgblack@eecs.umich.eduDebugFlag('RubySystem') 599058Satgutier@umich.eduDebugFlag('RubyTester') 606735Sgblack@eecs.umich.eduDebugFlag('RubyStats') 618886SAli.Saidi@ARM.comDebugFlag('RubyResourceStalls') 626757SAli.Saidi@ARM.com 638286SAli.Saidi@ARM.comCompoundFlag('Ruby', [ 'RubyQueue', 'RubyNetwork', 'RubyTester', 646735Sgblack@eecs.umich.edu 'RubyGenerated', 'RubySlicc', 'RubySystem', 'RubyCache', 656735Sgblack@eecs.umich.edu 'RubyDma', 'RubyPort', 'RubySequencer', 'RubyCacheTrace', 667707Sgblack@eecs.umich.edu 'RubyPrefetcher']) 677707Sgblack@eecs.umich.edu 687707Sgblack@eecs.umich.edudef do_embed_text(target, source, env): 698806Sgblack@eecs.umich.edu """convert a text file into a file that can be embedded in C 708806Sgblack@eecs.umich.edu using an #include statement, that defines a \"const char *\" pointing 718806Sgblack@eecs.umich.edu to the same text. 728806Sgblack@eecs.umich.edu 738706Sandreas.hansson@arm.com This is useful to embed scripts and configuration files in object files. 747693SAli.Saidi@ARM.com """ 757693SAli.Saidi@ARM.com 767693SAli.Saidi@ARM.com escape = [ "\'", "\"", "\\", "\?" ] 7710037SARM gem5 Developers 7810037SARM gem5 Developers # reads the text file in, line by line, converting it to a C string 7910037SARM gem5 Developers fin = open(str(source[0]), 'r') 8010037SARM gem5 Developers fout = open(str(target[0]), 'w' ) 8110037SARM gem5 Developers fout.write("static const char *%s =\n" % source[1].get_contents()); 8210037SARM gem5 Developers for l in fin: 837693SAli.Saidi@ARM.com # add escape sequences for the characters in escape 8410037SARM gem5 Developers fout.write("\"") 857693SAli.Saidi@ARM.com for char in l: 867693SAli.Saidi@ARM.com if char == "\n": 8710037SARM gem5 Developers break 8810318Sandreas.hansson@arm.com if char in escape: 8910037SARM gem5 Developers fout.write("\\") 9010037SARM gem5 Developers fout.write(char) 9110037SARM gem5 Developers else: 9210037SARM gem5 Developers fout.write(char) 9310037SARM gem5 Developers fout.write("\\n\"\n"); 9410037SARM gem5 Developers fout.write(";\n"); 9510037SARM gem5 Developers fin.close() 9610037SARM gem5 Developers fout.close() 9710037SARM gem5 Developers 9810037SARM gem5 Developers# 9910037SARM gem5 Developers# Link includes 10010037SARM gem5 Developers# 10110037SARM gem5 Developersgenerated_dir = Dir('../protocol') 10210037SARM gem5 Developers 10310037SARM gem5 Developersdef MakeIncludeAction(target, source, env): 10410037SARM gem5 Developers f = file(str(target[0]), 'w') 10510037SARM gem5 Developers for s in source: 10610037SARM gem5 Developers print('#include "%s"' % str(s.abspath), file=f) 10710037SARM gem5 Developers f.close() 10810037SARM gem5 Developers 10910037SARM gem5 Developersdef MakeInclude(source): 11010037SARM gem5 Developers target = generated_dir.File(basename(source)) 11110037SARM gem5 Developers include_action = MakeAction(MakeIncludeAction, Transform("MAKE INC", 1)) 11210037SARM gem5 Developers env.Command(target, source, include_action) 11310037SARM gem5 Developers 11410037SARM gem5 DevelopersMakeInclude('slicc_interface/AbstractEntry.hh') 11510037SARM gem5 DevelopersMakeInclude('slicc_interface/AbstractCacheEntry.hh') 11610037SARM gem5 DevelopersMakeInclude('slicc_interface/Message.hh') 1177693SAli.Saidi@ARM.comMakeInclude('slicc_interface/RubyRequest.hh') 11810037SARM gem5 Developers 11910037SARM gem5 Developers# External types 12010037SARM gem5 DevelopersMakeInclude('common/Address.hh') 12110037SARM gem5 DevelopersMakeInclude('common/BoolVec.hh') 12210037SARM gem5 DevelopersMakeInclude('common/DataBlock.hh') 1237693SAli.Saidi@ARM.comMakeInclude('common/IntVec.hh') 1247650SAli.Saidi@ARM.comMakeInclude('common/MachineID.hh') 12510037SARM gem5 DevelopersMakeInclude('common/NetDest.hh') 1266757SAli.Saidi@ARM.comMakeInclude('common/Set.hh') 1276757SAli.Saidi@ARM.comMakeInclude('common/WriteMask.hh') 1287693SAli.Saidi@ARM.comMakeInclude('filters/AbstractBloomFilter.hh') 1297693SAli.Saidi@ARM.comMakeInclude('network/MessageBuffer.hh') 1307693SAli.Saidi@ARM.comMakeInclude('structures/CacheMemory.hh') 1319920Syasuko.eckert@amd.comMakeInclude('structures/DirectoryMemory.hh') 13210037SARM gem5 DevelopersMakeInclude('structures/PerfectCacheMemory.hh') 13310037SARM gem5 DevelopersMakeInclude('structures/PersistentTable.hh') 13410037SARM gem5 DevelopersMakeInclude('structures/Prefetcher.hh') 13510037SARM gem5 DevelopersMakeInclude('structures/TBETable.hh') 13610037SARM gem5 DevelopersMakeInclude('structures/TimerTable.hh') 1378887Sgeoffrey.blake@arm.comMakeInclude('structures/WireBuffer.hh') 1388887Sgeoffrey.blake@arm.comMakeInclude('system/DMASequencer.hh') 1398887Sgeoffrey.blake@arm.comMakeInclude('system/Sequencer.hh') 1408887Sgeoffrey.blake@arm.com 1418887Sgeoffrey.blake@arm.com# External types : Group "mem/protocol" : include "header.hh" to the bottom 1428887Sgeoffrey.blake@arm.com# of this MakeIncludes if it is referenced as 1438887Sgeoffrey.blake@arm.com# <# include "mem/protocol/header.hh"> in any file 1447693SAli.Saidi@ARM.com# generated_dir = Dir('../protocol') 1457693SAli.Saidi@ARM.comMakeInclude('system/GPUCoalescer.hh') 1467748SAli.Saidi@ARM.comMakeInclude('system/VIPERCoalescer.hh') 1477748SAli.Saidi@ARM.com