3 # Copyright (c) 2009 The Hewlett-Packard Development Company
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are
8 # met: redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer;
10 # redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution;
13 # neither the name of the copyright holders nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # Authors: Nathan Binkert
31 from __future__ import print_function
36 from os.path import basename, isdir, join as joinpath
40 from gem5_scons import Transform
44 DebugFlag('ProtocolTrace')
45 DebugFlag('RubyCache')
46 DebugFlag('RubyCacheTrace')
48 DebugFlag('RubyGenerated')
49 DebugFlag('RubyNetwork')
51 DebugFlag('RubyPrefetcher')
52 DebugFlag('RubyQueue')
53 DebugFlag('RubySequencer')
54 DebugFlag('RubySlicc')
55 DebugFlag('RubySystem')
56 DebugFlag('RubyTester')
57 DebugFlag('RubyStats')
58 DebugFlag('RubyResourceStalls')
60 CompoundFlag('Ruby', [ 'RubyQueue', 'RubyNetwork', 'RubyTester',
61 'RubyGenerated', 'RubySlicc', 'RubySystem', 'RubyCache',
62 'RubyDma', 'RubyPort', 'RubySequencer', 'RubyCacheTrace',
65 if env['PROTOCOL'] == 'None':
68 def 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
73 This is useful to embed scripts and configuration files in object files.
76 escape = [ "\'", "\"", "\\", "\?" ]
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());
83 # add escape sequences for the characters in escape
93 fout.write("\\n\"\n");
101 generated_dir = Dir('../protocol')
103 def MakeIncludeAction(target, source, env):
104 f = file(str(target[0]), 'w')
106 print('#include "%s"' % str(s.abspath), file=f)
109 def 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)
114 MakeInclude('slicc_interface/AbstractEntry.hh')
115 MakeInclude('slicc_interface/AbstractCacheEntry.hh')
116 MakeInclude('slicc_interface/Message.hh')
117 MakeInclude('slicc_interface/RubyRequest.hh')
120 MakeInclude('common/Address.hh')
121 MakeInclude('common/BoolVec.hh')
122 MakeInclude('common/DataBlock.hh')
123 MakeInclude('common/IntVec.hh')
124 MakeInclude('common/MachineID.hh')
125 MakeInclude('common/NetDest.hh')
126 MakeInclude('common/Set.hh')
127 MakeInclude('common/WriteMask.hh')
128 MakeInclude('filters/AbstractBloomFilter.hh')
129 MakeInclude('network/MessageBuffer.hh')
130 MakeInclude('structures/CacheMemory.hh')
131 MakeInclude('structures/DirectoryMemory.hh')
132 MakeInclude('structures/PerfectCacheMemory.hh')
133 MakeInclude('structures/PersistentTable.hh')
134 MakeInclude('structures/Prefetcher.hh')
135 MakeInclude('structures/TBETable.hh')
136 MakeInclude('structures/TimerTable.hh')
137 MakeInclude('structures/WireBuffer.hh')
138 MakeInclude('system/DMASequencer.hh')
139 MakeInclude('system/Sequencer.hh')
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')
145 MakeInclude('system/GPUCoalescer.hh')
146 MakeInclude('system/VIPERCoalescer.hh')