SConscript revision 11755
12155SN/A# -*- mode:python -*- 22155SN/A 32155SN/A# Copyright (c) 2009 The Hewlett-Packard Development Company 42155SN/A# All rights reserved. 52155SN/A# 62155SN/A# Redistribution and use in source and binary forms, with or without 72155SN/A# modification, are permitted provided that the following conditions are 82155SN/A# met: redistributions of source code must retain the above copyright 92155SN/A# notice, this list of conditions and the following disclaimer; 102155SN/A# redistributions in binary form must reproduce the above copyright 112155SN/A# notice, this list of conditions and the following disclaimer in the 122155SN/A# documentation and/or other materials provided with the distribution; 132155SN/A# neither the name of the copyright holders nor the names of its 142155SN/A# contributors may be used to endorse or promote products derived from 152155SN/A# this software without specific prior written permission. 162155SN/A# 172155SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182155SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192155SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202155SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212155SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222155SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232155SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242155SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252155SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262155SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272155SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu# 292665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert 302155SN/A 314202Sbinkertn@umich.eduimport os 322155SN/Aimport sys 332178SN/A 342178SN/Afrom os.path import basename, isdir, join as joinpath 352178SN/A 362178SN/Aimport SCons 372178SN/A 382178SN/AImport('*') 392178SN/A 402178SN/ADebugFlag('ProtocolTrace') 412178SN/ADebugFlag('RubyCache') 422178SN/ADebugFlag('RubyCacheTrace') 432178SN/ADebugFlag('RubyDma') 442178SN/ADebugFlag('RubyGenerated') 452155SN/ADebugFlag('RubyNetwork') 462178SN/ADebugFlag('RubyPort') 472155SN/ADebugFlag('RubyPrefetcher') 482155SN/ADebugFlag('RubyQueue') 492178SN/ADebugFlag('RubySequencer') 502155SN/ADebugFlag('RubySlicc') 512155SN/ADebugFlag('RubySystem') 522623SN/ADebugFlag('RubyTester') 533918Ssaidi@eecs.umich.eduDebugFlag('RubyStats') 542623SN/ADebugFlag('RubyResourceStalls') 552623SN/A 563918Ssaidi@eecs.umich.eduCompoundFlag('Ruby', [ 'RubyQueue', 'RubyNetwork', 'RubyTester', 572155SN/A 'RubyGenerated', 'RubySlicc', 'RubySystem', 'RubyCache', 582155SN/A 'RubyDma', 'RubyPort', 'RubySequencer', 'RubyCacheTrace', 592292SN/A 'RubyPrefetcher']) 603918Ssaidi@eecs.umich.edu 612292SN/Aif env['PROTOCOL'] == 'None': 622292SN/A Return() 632292SN/A 643918Ssaidi@eecs.umich.edudef do_embed_text(target, source, env): 652292SN/A """convert a text file into a file that can be embedded in C 662292SN/A using an #include statement, that defines a \"const char *\" pointing 672766Sktlim@umich.edu to the same text. 682766Sktlim@umich.edu 692766Sktlim@umich.edu This is useful to embed scripts and configuration files in object files. 702921Sktlim@umich.edu """ 712921Sktlim@umich.edu 722766Sktlim@umich.edu escape = [ "\'", "\"", "\\", "\?" ] 732766Sktlim@umich.edu 742766Sktlim@umich.edu # reads the text file in, line by line, converting it to a C string 754762Snate@binkert.org fin = open(str(source[0]), 'r') 762155SN/A fout = open(str(target[0]), 'w' ) 772155SN/A fout.write("static const char *%s =\n" % source[1].get_contents()); 782155SN/A for l in fin: 792155SN/A # add escape sequences for the characters in escape 802155SN/A fout.write("\"") 812155SN/A for char in l: 822766Sktlim@umich.edu if char == "\n": 832155SN/A break 842623SN/A if char in escape: 852155SN/A fout.write("\\") 862155SN/A fout.write(char) 872155SN/A else: 882155SN/A fout.write(char) 892178SN/A fout.write("\\n\"\n"); 902178SN/A fout.write(";\n"); 912178SN/A fin.close() 922766Sktlim@umich.edu fout.close() 932178SN/A 942178SN/A# 952178SN/A# Link includes 962178SN/A# 972766Sktlim@umich.edugenerated_dir = Dir('../protocol') 982766Sktlim@umich.edu 992766Sktlim@umich.edudef MakeIncludeAction(target, source, env): 1002788Sktlim@umich.edu f = file(str(target[0]), 'w') 1012178SN/A for s in source: 1022733Sktlim@umich.edu print >>f, '#include "%s"' % str(s.abspath) 1032733Sktlim@umich.edu f.close() 1042817Sksewell@umich.edu 1052733Sktlim@umich.edudef MakeInclude(source): 1064486Sbinkertn@umich.edu target = generated_dir.File(basename(source)) 1074486Sbinkertn@umich.edu include_action = MakeAction(MakeIncludeAction, Transform("MAKE INC", 1)) 1084776Sgblack@eecs.umich.edu env.Command(target, source, include_action) 1094776Sgblack@eecs.umich.edu 1104486Sbinkertn@umich.eduMakeInclude('slicc_interface/AbstractEntry.hh') 1114202Sbinkertn@umich.eduMakeInclude('slicc_interface/AbstractCacheEntry.hh') 1124202Sbinkertn@umich.eduMakeInclude('slicc_interface/Message.hh') 1134202Sbinkertn@umich.eduMakeInclude('slicc_interface/RubyRequest.hh') 1144202Sbinkertn@umich.edu 1154202Sbinkertn@umich.edu# External types 1164776Sgblack@eecs.umich.eduMakeInclude('common/Address.hh') 1174202Sbinkertn@umich.eduMakeInclude('common/BoolVec.hh') 1184202Sbinkertn@umich.eduMakeInclude('common/DataBlock.hh') 1194202Sbinkertn@umich.eduMakeInclude('common/IntVec.hh') 1204202Sbinkertn@umich.eduMakeInclude('common/MachineID.hh') 1215217Ssaidi@eecs.umich.eduMakeInclude('common/NetDest.hh') 1224202Sbinkertn@umich.eduMakeInclude('common/Set.hh') 1232155SN/AMakeInclude('common/WriteMask.hh') 1244202Sbinkertn@umich.eduMakeInclude('filters/AbstractBloomFilter.hh') 1254486Sbinkertn@umich.eduMakeInclude('network/MessageBuffer.hh') 1264486Sbinkertn@umich.eduMakeInclude('structures/CacheMemory.hh') 1274202Sbinkertn@umich.eduMakeInclude('structures/DirectoryMemory.hh') 1284202Sbinkertn@umich.eduMakeInclude('structures/PerfectCacheMemory.hh') 1292821Sktlim@umich.eduMakeInclude('structures/PersistentTable.hh') 1304776Sgblack@eecs.umich.eduMakeInclude('structures/Prefetcher.hh') 1314776Sgblack@eecs.umich.eduMakeInclude('structures/TBETable.hh') 1324776Sgblack@eecs.umich.eduMakeInclude('structures/TimerTable.hh') 1334776Sgblack@eecs.umich.eduMakeInclude('structures/WireBuffer.hh') 1344776Sgblack@eecs.umich.eduMakeInclude('system/DMASequencer.hh') 1354776Sgblack@eecs.umich.eduMakeInclude('system/Sequencer.hh') 1364776Sgblack@eecs.umich.edu 1374776Sgblack@eecs.umich.edu# External types : Group "mem/protocol" : include "header.hh" to the bottom 1382766Sktlim@umich.edu# of this MakeIncludes if it is referenced as 1394202Sbinkertn@umich.edu# <# include "mem/protocol/header.hh"> in any file 1405192Ssaidi@eecs.umich.edu# generated_dir = Dir('../protocol') 1412733Sktlim@umich.eduMakeInclude('system/GPUCoalescer.hh') 1422733Sktlim@umich.eduMakeInclude('system/VIPERCoalescer.hh') 1432733Sktlim@umich.edu