diff --git a/SConstruct b/SConstruct index 7a0bf2794..5cbb50dce 100644 --- a/SConstruct +++ b/SConstruct @@ -410,6 +410,10 @@ else: print ' Please fix SConstruct and src/SConscript and try again.' Exit(1) +# Set up common yacc/bison flags (needed for Ruby) +main['YACCFLAGS'] = '-d' +main['YACCHXXFILESUFFIX'] = '.hh' + # Do this after we save setting back, or else we'll tack on an # extra 'qdo' every time we run scons. if main['BATCH']: diff --git a/src/mem/gems_common/SConscript b/src/mem/gems_common/SConscript new file mode 100644 index 000000000..bd29a3737 --- /dev/null +++ b/src/mem/gems_common/SConscript @@ -0,0 +1,42 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +#benv['LEXCOM'] = "$LEX $LEXFLAGS -o$TARGET $SOURCES" +benv = env.Clone() +benv.Append(YACCFLAGS=["-pat"]) +benv.Append(LEXFLAGS=["-Pat"]) +benv.CXXFile('ioutil/attrlex.ll') +benv.CXXFile('ioutil/attrparse.yy') + +Source('ioutil/attrlex.cc', Werror=False) +Source('ioutil/attrparse.cc', Werror=False) +Source('util.cc') diff --git a/src/mem/gems_common/ioutil/SConscript b/src/mem/gems_common/ioutil/SConscript new file mode 100644 index 000000000..4c9357dfc --- /dev/null +++ b/src/mem/gems_common/ioutil/SConscript @@ -0,0 +1,34 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('confio.cc') +Source('initvar.cc') diff --git a/src/mem/protocol/SConscript b/src/mem/protocol/SConscript new file mode 100644 index 000000000..3a2e22151 --- /dev/null +++ b/src/mem/protocol/SConscript @@ -0,0 +1,94 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +import os +import re +import string +import sys + +from os.path import basename, dirname, exists, expanduser, isdir, isfile +from os.path import join as joinpath + +import SCons + +Import('*') + +slicc_dir = Dir('../slicc') +protocol_dir = Dir('.') +html_dir = Dir('html') + +# +# Use SLICC +# +def slicc_action(target, source, env): + slicc_bin = str(source[0]) + protocol = source[1].get_contents() + pdir = str(protocol_dir) + hdir = str(html_dir) + + if not isdir(pdir): + os.mkdir(pdir) + if not isdir(hdir): + os.mkdir(hdir) + + do_html = "no_html" + cmdline = [ slicc_bin, pdir, hdir, protocol, do_html ] + cmdline += [ str(s) for s in source[2:] ] + cmdline = ' '.join(cmdline) + os.system(cmdline) + +protocol = env['PROTOCOL'] +sources = [ protocol_dir.File("RubySlicc_interfaces.slicc"), + protocol_dir.File("%s.slicc" % protocol) ] + +sm_files = [] +for s in sources: + for sm_file in file(File(s).srcnode().abspath, "r"): + sm_file = sm_file.strip() + if not sm_file: + continue + if sm_file.startswith("#"): + continue + sm_file = protocol_dir.File(sm_file) + sm_file.srcnode().abspath + sm_files.append(sm_file) + +sys.path[0:0] = [env['ENV']['M5_PLY']] +execfile(slicc_dir.File('parser/parser.py').srcnode().abspath) + +hh, cc = scan([s.srcnode().abspath for s in sm_files]) +hh = [ protocol_dir.File(f) for f in hh ] +cc = [ protocol_dir.File(f) for f in cc ] + +slicc_bin = slicc_dir.File("slicc") +env.Command(hh + cc, [ slicc_bin, Value(protocol) ] + sm_files, slicc_action) + +for f in cc: + Source(f) diff --git a/src/mem/protocol/SConsopts b/src/mem/protocol/SConsopts new file mode 100644 index 000000000..6ca93ca06 --- /dev/null +++ b/src/mem/protocol/SConsopts @@ -0,0 +1,55 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +import os + +Import('*') + +all_protocols = [ + 'MESI_CMP_directory', + 'MESI_SCMP_bankdirectory', + 'MESI_SCMP_bankdirectory_m', + 'MI_example', + 'MOESI_CMP_directory', + 'MOESI_CMP_directory_m', + 'MOESI_CMP_token', + 'MOESI_SMP_directory', + 'MOESI_SMP_token', + 'MOSI_SMP_bcast', + 'MOSI_SMP_bcast_1level', + 'MOSI_SMP_bcast_m', + 'MOSI_SMP_directory_1level', + 'MSI_MOSI_CMP_directory', + ] + +opt = EnumVariable('PROTOCOL', 'Coherence Protocol for Ruby', 'MOSI_SMP_bcast', + all_protocols) + +sticky_vars.AddVariables(opt) diff --git a/src/mem/ruby/SConscript b/src/mem/ruby/SConscript new file mode 100644 index 000000000..6ac7dad6a --- /dev/null +++ b/src/mem/ruby/SConscript @@ -0,0 +1,116 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +import os +import sys + +from os.path import basename, isdir, join as joinpath + +import SCons + +Import('*') + +Source('init.cc') + +def do_embed_text(target, source, env): + """convert a text file into a file that can be embedded in C + using an #include statement, that defines a \"const char *\" pointing + to the same text. + + This is useful to embed scripts and configuration files in object files. + """ + + escape = [ "\'", "\"", "\\", "\?" ] + + # reads the text file in, line by line, converting it to a C string + fin = open(str(source[0]), 'r') + fout = open(str(target[0]), 'w' ) + fout.write("static const char *%s =\n" % source[1].get_contents()); + for l in fin: + # add escape sequences for the characters in escape + fout.write("\"") + for char in l: + if char == "\n": + break + if char in escape: + fout.write("\\") + fout.write(char) + else: + fout.write(char) + fout.write("\\n\"\n"); + fout.write(";\n"); + fin.close() + fout.close() + +def EmbedText(target, source, param): + env.Command(target, [source, Value(param)], do_embed_text) + +EmbedText('default_param.hh', 'config/rubyconfig.defaults', + 'global_default_param') +EmbedText('tester_param.hh', 'config/tester.defaults', + 'global_default_tester_param') + +# +# Link includes +# +generated_dir = Dir('../protocol') + +def MakeIncludeAction(target, source, env): + f = file(str(target[0]), 'w') + for s in source: + print >>f, '#include "%s"' % str(s.abspath) + f.close() + +def MakeInclude(source): + target = generated_dir.File(basename(source)) + env.Command(target, source, MakeIncludeAction) + +MakeInclude('buffers/MessageBuffer.hh') +MakeInclude('common/Address.hh') +MakeInclude('common/DataBlock.hh') +MakeInclude('common/NetDest.hh') +MakeInclude('common/Set.hh') +MakeInclude('slicc_interface/AbstractCacheEntry.hh') +MakeInclude('slicc_interface/AbstractProtocol.hh') +MakeInclude('slicc_interface/Message.hh') +MakeInclude('slicc_interface/NetworkMessage.hh') +MakeInclude('system/CacheMemory.hh') +MakeInclude('system/DirectoryMemory.hh') +MakeInclude('system/GenericBloomFilter.hh') +MakeInclude('system/MachineID.hh') +MakeInclude('system/MemoryControl.hh') +MakeInclude('system/NodeID.hh') +MakeInclude('system/NodePersistentTable.hh') +MakeInclude('system/PerfectCacheMemory.hh') +MakeInclude('system/PersistentTable.hh') +MakeInclude('system/Sequencer.hh') +MakeInclude('system/StoreBuffer.hh') +MakeInclude('system/TBETable.hh') +MakeInclude('system/TimerTable.hh') diff --git a/src/mem/ruby/SConsopts b/src/mem/ruby/SConsopts new file mode 100644 index 000000000..7278558fc --- /dev/null +++ b/src/mem/ruby/SConsopts @@ -0,0 +1,38 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +sticky_vars.AddVariables( + BoolVariable('NO_VECTOR_BOUNDS_CHECKS', "Don't do bounds checks", True), + BoolVariable('RUBY_DEBUG', "Add debugging stuff to Ruby", False)) + +export_vars += [ 'NO_VECTOR_BOUNDS_CHECKS', 'RUBY_DEBUG' ] + diff --git a/src/mem/ruby/buffers/SConscript b/src/mem/ruby/buffers/SConscript new file mode 100644 index 000000000..3b4873c6b --- /dev/null +++ b/src/mem/ruby/buffers/SConscript @@ -0,0 +1,34 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('MessageBuffer.cc') +Source('MessageBufferNode.cc') diff --git a/src/mem/ruby/common/Debug.hh b/src/mem/ruby/common/Debug.hh index 5ac171275..6dce98dd5 100644 --- a/src/mem/ruby/common/Debug.hh +++ b/src/mem/ruby/common/Debug.hh @@ -37,6 +37,8 @@ #include #include +#include "config/ruby_debug.hh" + extern std::ostream * debug_cout_ptr; // component enumeration diff --git a/src/mem/ruby/common/SConscript b/src/mem/ruby/common/SConscript new file mode 100644 index 000000000..8313aa7ad --- /dev/null +++ b/src/mem/ruby/common/SConscript @@ -0,0 +1,42 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('Address.cc') +Source('DataBlock.cc') +Source('Debug.cc') +Source('Driver.cc') +Source('Global.cc') +Source('Histogram.cc') +Source('Message.cc') +Source('NetDest.cc') +Source('Set.cc', Werror=False) +Source('SubBlock.cc') diff --git a/src/mem/ruby/config/RubyConfig.cc b/src/mem/ruby/config/RubyConfig.cc index 2d129bc7a..cb30281cd 100644 --- a/src/mem/ruby/config/RubyConfig.cc +++ b/src/mem/ruby/config/RubyConfig.cc @@ -36,6 +36,7 @@ * */ +#include "config/ruby_debug.hh" #include "mem/ruby/config/RubyConfig.hh" #include "mem/protocol/protocol_name.hh" #include "mem/gems_common/util.hh" diff --git a/src/mem/ruby/config/SConscript b/src/mem/ruby/config/SConscript new file mode 100644 index 000000000..d01c9236b --- /dev/null +++ b/src/mem/ruby/config/SConscript @@ -0,0 +1,33 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('RubyConfig.cc') diff --git a/src/mem/ruby/eventqueue/RubyEventQueue.hh b/src/mem/ruby/eventqueue/RubyEventQueue.hh index 7b2006535..a2112c922 100644 --- a/src/mem/ruby/eventqueue/RubyEventQueue.hh +++ b/src/mem/ruby/eventqueue/RubyEventQueue.hh @@ -59,6 +59,7 @@ #ifndef RUBYEVENTQUEUE_H #define RUBYEVENTQUEUE_H +#include "config/no_vector_bounds_checks.hh" #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" diff --git a/src/mem/ruby/eventqueue/SConscript b/src/mem/ruby/eventqueue/SConscript new file mode 100644 index 000000000..523d71c09 --- /dev/null +++ b/src/mem/ruby/eventqueue/SConscript @@ -0,0 +1,34 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('RubyEventQueue.cc') +Source('RubyEventQueueNode.cc') diff --git a/src/mem/ruby/init.cc b/src/mem/ruby/init.cc index 22a048b5b..ae81dfc57 100644 --- a/src/mem/ruby/init.cc +++ b/src/mem/ruby/init.cc @@ -54,7 +54,7 @@ using namespace std; // A generated file containing the default parameters in string form // The defaults are stored in the variable global_default_param -#include "mem/protocol/default_param.hh" +#include "mem/ruby/default_param.hh" static initvar_t *ruby_initvar_obj = NULL; diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/SConscript b/src/mem/ruby/network/garnet-fixed-pipeline/SConscript new file mode 100644 index 000000000..bcd1b09ac --- /dev/null +++ b/src/mem/ruby/network/garnet-fixed-pipeline/SConscript @@ -0,0 +1,46 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('GarnetNetwork_d.cc') +Source('InputUnit_d.cc') +Source('NetworkInterface_d.cc') +Source('NetworkLink_d.cc') +Source('OutVcState_d.cc') +Source('OutputUnit_d.cc') +Source('Router_d.cc') +Source('RoutingUnit_d.cc') +Source('SWallocator_d.cc') +Source('Switch_d.cc') +Source('VCallocator_d.cc') +Source('VirtualChannel_d.cc') +Source('flitBuffer_d.cc') +Source('flit_d.cc') diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/SConscript b/src/mem/ruby/network/garnet-flexible-pipeline/SConscript new file mode 100644 index 000000000..039ef41c2 --- /dev/null +++ b/src/mem/ruby/network/garnet-flexible-pipeline/SConscript @@ -0,0 +1,41 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('GarnetNetwork.cc') +Source('InVcState.cc') +Source('NetworkInterface.cc') +Source('NetworkLink.cc') +Source('OutVcState.cc') +Source('Router.cc') +Source('VCarbiter.cc') +Source('flit.cc') +Source('flitBuffer.cc') diff --git a/src/mem/ruby/network/orion/SConscript b/src/mem/ruby/network/orion/SConscript new file mode 100644 index 000000000..efa9025d6 --- /dev/null +++ b/src/mem/ruby/network/orion/SConscript @@ -0,0 +1,41 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('NetworkPower.cc', Werror=False) +Source('power_arbiter.cc') +Source('power_array.cc', Werror=False) +Source('power_bus.cc', Werror=False) +Source('power_crossbar.cc', Werror=False) +Source('power_ll.cc', Werror=False) +Source('power_router_init.cc') +Source('power_static.cc') +Source('power_utils.cc', Werror=False) diff --git a/src/mem/ruby/network/simple/SConscript b/src/mem/ruby/network/simple/SConscript new file mode 100644 index 000000000..b12bfc854 --- /dev/null +++ b/src/mem/ruby/network/simple/SConscript @@ -0,0 +1,37 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('PerfectSwitch.cc') +Source('SimpleNetwork.cc') +Source('Switch.cc') +Source('Throttle.cc') +Source('Topology.cc') diff --git a/src/mem/ruby/profiler/SConscript b/src/mem/ruby/profiler/SConscript new file mode 100644 index 000000000..b27d1da0c --- /dev/null +++ b/src/mem/ruby/profiler/SConscript @@ -0,0 +1,37 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('AccessTraceForAddress.cc') +Source('AddressProfiler.cc') +Source('CacheProfiler.cc') +Source('Profiler.cc') +Source('StoreTrace.cc') diff --git a/src/mem/ruby/recorder/SConscript b/src/mem/ruby/recorder/SConscript new file mode 100644 index 000000000..5b225edc6 --- /dev/null +++ b/src/mem/ruby/recorder/SConscript @@ -0,0 +1,33 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('TraceRecord.cc', Werror=False) diff --git a/src/mem/ruby/slicc_interface/SConscript b/src/mem/ruby/slicc_interface/SConscript new file mode 100644 index 000000000..d54b2dbc3 --- /dev/null +++ b/src/mem/ruby/slicc_interface/SConscript @@ -0,0 +1,35 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('AbstractCacheEntry.cc') +Source('AbstractChip.cc') +Source('RubySlicc_Profiler_interface.cc') diff --git a/src/mem/ruby/system/SConscript b/src/mem/ruby/system/SConscript new file mode 100644 index 000000000..1840ff0cc --- /dev/null +++ b/src/mem/ruby/system/SConscript @@ -0,0 +1,50 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('BlockBloomFilter.cc') +Source('BulkBloomFilter.cc') +Source('DirectoryMemory.cc') +Source('GenericBloomFilter.cc') +Source('H3BloomFilter.cc') +Source('LSB_CountingBloomFilter.cc') +Source('MemoryControl.cc') +Source('MemoryNode.cc') +Source('MultiBitSelBloomFilter.cc') +Source('MultiGrainBloomFilter.cc') +Source('NodePersistentTable.cc') +Source('NonCountingBloomFilter.cc') +Source('PersistentTable.cc') +Source('Sequencer.cc', Werror=False) +Source('StoreBuffer.cc') +Source('StoreCache.cc') +Source('System.cc') +Source('TimerTable.cc') diff --git a/src/mem/ruby/tester/SConscript b/src/mem/ruby/tester/SConscript new file mode 100644 index 000000000..e1a489106 --- /dev/null +++ b/src/mem/ruby/tester/SConscript @@ -0,0 +1,43 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +Import('*') + +Source('Check.cc') +Source('CheckTable.cc') +Source('DetermGETXGenerator.cc') +Source('DetermInvGenerator.cc') +Source('DetermSeriesGETSGenerator.cc') +Source('DeterministicDriver.cc') +Source('Instruction.cc') +Source('RequestGenerator.cc') +Source('SpecifiedGenerator.cc') +Source('SyntheticDriver.cc') +Source('Tester.cc') diff --git a/src/mem/slicc/SConscript b/src/mem/slicc/SConscript new file mode 100644 index 000000000..39a6ac387 --- /dev/null +++ b/src/mem/slicc/SConscript @@ -0,0 +1,125 @@ +# -*- mode:python -*- + +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +import os +import re +import string +import sys + +from os.path import basename, dirname, exists, expanduser, isdir, isfile +from os.path import join as joinpath + +import SCons + +Import('*') + +common_dir = Dir('../gems_common') + +# +# Build SLICC +# +slicc_env = env.Clone() +slicc_env['CPPDEFINES'] = '' +slicc_env['CPPPATH'] = Dir('../..') +slicc_env['CCFLAGS'] = '' +slicc_env['CXXFLAGS'] = '-Wall -W -Wwrite-strings -Woverloaded-virtual -Wno-unused -Wno-deprecated' +slicc_env['LIBS'] = '' +slicc_env['LIBPATH'] = '' +all_slicc_sources = [] +def SliccSource(filename): + if filename.endswith('.ll') or filename.endswith('.yy'): + slicc_env.CXXFile(filename) + filename = filename[:-2] + "cc" + x = slicc_env.StaticObject(filename) + all_slicc_sources.append(x) + return x + +# BE CAREFUL WITH THE ORDER OF FILENAMES HERE. SLICC IS VERY FRAGILE +# BECAUSE IT VIOLATES ESTABLISHED RULES ABOUT HOW YOU'RE ALLOWED TO +# CREATE STATIC OBJECTS. (SLICC HAS DEPENDENCIES DURING STATIC OBJECT +# CONSTRUCTION ACROSS FILES. THAT'S A NO-NO.) WITH THIS FILE ORDER, +# WE GET LUCKY AND OBJECTS GET CONSTRUCTED IN THE RIGHT ORDER. +SliccSource('parser/parser.yy') +SliccSource('parser/lexer.ll') +SliccSource('main.cc') +SliccSource('symbols/Func.cc') +SliccSource('symbols/StateMachine.cc') +SliccSource('symbols/Symbol.cc') +SliccSource('symbols/SymbolTable.cc') +SliccSource('symbols/Transition.cc') +SliccSource('symbols/Type.cc') +SliccSource('symbols/Var.cc') +SliccSource('generator/fileio.cc') +SliccSource('generator/html_gen.cc') +SliccSource('generator/mif_gen.cc') +SliccSource('ast/AST.cc') +SliccSource('ast/ActionDeclAST.cc') +SliccSource('ast/AssignStatementAST.cc') +SliccSource('ast/CheckAllocateStatementAST.cc') +SliccSource('ast/CheckStopSlotsStatementAST.cc') +SliccSource('ast/ChipComponentAccessAST.cc') +SliccSource('ast/CopyHeadStatementAST.cc') +SliccSource('ast/DeclAST.cc') +SliccSource('ast/DeclListAST.cc') +SliccSource('ast/EnqueueStatementAST.cc') +SliccSource('ast/EnumDeclAST.cc') +SliccSource('ast/EnumExprAST.cc') +SliccSource('ast/ExprAST.cc') +SliccSource('ast/ExprStatementAST.cc') +SliccSource('ast/FormalParamAST.cc') +SliccSource('ast/FuncCallExprAST.cc') +SliccSource('ast/FuncDeclAST.cc') +SliccSource('ast/IfStatementAST.cc') +SliccSource('ast/InPortDeclAST.cc') +SliccSource('ast/InfixOperatorExprAST.cc') +SliccSource('ast/LiteralExprAST.cc') +SliccSource('ast/Location.cc') +SliccSource('ast/MachineAST.cc') +SliccSource('ast/MemberExprAST.cc') +SliccSource('ast/MethodCallExprAST.cc') +SliccSource('ast/ObjDeclAST.cc') +SliccSource('ast/OutPortDeclAST.cc') +SliccSource('ast/PairAST.cc') +SliccSource('ast/PairListAST.cc') +SliccSource('ast/PeekStatementAST.cc') +SliccSource('ast/ReturnStatementAST.cc') +SliccSource('ast/StatementAST.cc') +SliccSource('ast/StatementListAST.cc') +SliccSource('ast/TransitionDeclAST.cc') +SliccSource('ast/TypeAST.cc') +SliccSource('ast/TypeDeclAST.cc') +SliccSource('ast/TypeFieldAST.cc') +SliccSource('ast/TypeFieldEnumAST.cc') +SliccSource('ast/TypeFieldMemberAST.cc') +SliccSource('ast/TypeFieldMethodAST.cc') +SliccSource('ast/VarExprAST.cc') + +slicc_bin = File('slicc') +slicc_env.Program(slicc_bin, all_slicc_sources + [ common_dir.File('util.o') ]) diff --git a/src/mem/slicc/parser/parser.py b/src/mem/slicc/parser/parser.py new file mode 100644 index 000000000..ac2dd294a --- /dev/null +++ b/src/mem/slicc/parser/parser.py @@ -0,0 +1,572 @@ +# Copyright (c) 2009 The Hewlett-Packard Development Company +# 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. +# +# Authors: Nathan Binkert + +from ply import lex, yacc +import re + +t_ignore = '\t ' + +# C or C++ comment (ignore) +def t_c_comment(t): + r'/\*(.|\n)*?\*/' + t.lexer.lineno += t.value.count('\n') + +def t_cpp_comment(t): + r'//.*' + pass + +# Define a rule so we can track line numbers +def t_newline(t): + r'\n+' + t.lexer.lineno += len(t.value) + +reserved = { + 'global' : 'GLOBAL', + 'machine' : 'MACHINE', + 'in_port' : 'IN_PORT', + 'out_port' : 'OUT_PORT', + 'action' : 'ACTION', + 'transition' : 'TRANS', + 'structure' : 'STRUCT', + 'external_type' : 'EXTERN_TYPE', + 'enumeration' : 'ENUM', + 'peek' : 'PEEK', + 'enqueue' : 'ENQUEUE', + 'copy_head' : 'COPY_HEAD', + 'check_allocate' : 'CHECK_ALLOCATE', + 'check_stop_slots' : 'CHECK_STOP_SLOTS', + 'if' : 'IF', + 'else' : 'ELSE', + 'return' : 'RETURN', + 'THIS' : 'THIS', + 'CHIP' : 'CHIP', + 'void' : 'VOID', +} + +literals = ':[]{}(),=' + +tokens = [ 'EQ', 'NE', 'LT', 'GT', 'LE', 'GE', + 'LEFTSHIFT', 'RIGHTSHIFT', + 'NOT', 'AND', 'OR', + 'PLUS', 'DASH', 'STAR', 'SLASH', + 'DOUBLE_COLON', 'SEMICOLON', + 'ASSIGN', 'DOT', + 'IDENT', 'LIT_BOOL', 'FLOATNUMBER', 'NUMBER', 'STRING' ] +tokens += reserved.values() + +t_EQ = r'==' +t_NE = r'!=' +t_LT = r'<' +t_GT = r'>' +t_LE = r'<=' +t_GE = r'>=' +t_LEFTSHIFT = r'<<' +t_RIGHTSHIFT = r'>>' +t_NOT = r'!' +t_AND = r'&&' +t_OR = r'\|\|' +t_PLUS = r'\+' +t_DASH = r'-' +t_STAR = r'\*' +t_SLASH = r'/' +t_DOUBLE_COLON = r'::' +t_SEMICOLON = r';' +t_ASSIGN = r':=' +t_DOT = r'\.' + +class TokenError(Exception): pass +class ParseError(Exception): pass + +def t_error(t): + raise TokenError("Illegal character", t) + +def t_IDENT(t): + r'[a-zA-Z_][a-zA-Z_0-9]*' + if t.value == 'true': + t.type = 'LIT_BOOL' + t.value = True + return t + + if t.value == 'false': + t.type = 'LIT_BOOL' + t.value = False + return t + + t.type = reserved.get(t.value, 'IDENT') # Check for reserved words + return t + +def t_FLOATNUMBER(t): + '[0-9]+[.][0-9]+' + try: + t.value = float(t.value) + except ValueError: + raise TokenError("Illegal float", t) + return t + +def t_NUMBER(t): + r'[0-9]+' + try: + t.value = int(t.value) + except ValueError: + raise TokenError("Illegal number", t) + return t + +def t_STRING1(t): + r'\"[^"\n]*\"' + t.type = 'STRING' + return t + +def t_STRING2(t): + r"\'[^'\n]*\'" + t.type = 'STRING' + return t + + +def p_file(p): + "file : decl_l" + p[0] = [ x for x in p[1] if x is not None ] + +def p_error(t): + raise ParseError(t) + +def p_empty(p): + "empty :" + pass + +def p_decl_l(p): + "decl_l : decls" + p[0] = p[1] + +def p_decls(p): + """decls : decl decls + | empty""" + if len(p) == 3: + p[0] = [ p[1] ] + p[2] + elif len(p) == 2: + p[0] = [] + +def p_decl(p): + """decl : d_machine + | d_action + | d_in_port + | d_out_port + | t_trans + | d_extern + | d_global + | d_struct + | d_enum + | d_object + | d_func_decl + | d_func_def""" + p[0] = p[1] + +def p_d_machine(p): + "d_machine : MACHINE '(' ident pair_l ')' '{' decl_l '}'" + decls = [ x for x in p[7] if x is not None ] + p[0] = Machine(p[3], decls) + +def p_d_action(p): + "d_action : ACTION '(' ident pair_l ')' statement_l" + p[0] = Action(p[3]) + +def p_d_in_port(p): + "d_in_port : IN_PORT '(' ident ',' type ',' var pair_l ')' statement_l" + p[0] = InPort(p[3]) + +def p_d_out_port(p): + "d_out_port : OUT_PORT '(' ident ',' type ',' var pair_l ')' SEMICOLON" + p[0] = OutPort(p[3]) + +def p_t_trans(p): + """t_trans : TRANS '(' ident_l ',' ident_l ',' ident pair_l ')' ident_l + | TRANS '(' ident_l ',' ident_l pair_l ')' ident_l""" + p[0] = Transition("transition") + +def p_d_extern(p): + """d_extern : EXTERN_TYPE '(' type pair_l ')' SEMICOLON + | EXTERN_TYPE '(' type pair_l ')' '{' type_methods '}'""" + p[0] = Extern(p[3]) + +def p_d_global(p): + "d_global : GLOBAL '(' type pair_l ')' '{' type_members '}'" + p[0] = Global(p[3]) + +def p_d_struct(p): + "d_struct : STRUCT '(' type pair_l ')' '{' type_members '}'" + p[0] = Struct(p[3]) + +def p_d_enum(p): + "d_enum : ENUM '(' type pair_l ')' '{' type_enums '}'" + p[0] = Enum(p[3]) + +def p_d_object(p): + "d_object : type ident pair_l SEMICOLON" + p[0] = Object(p[2]) + +def p_d_func_decl(p): + """d_func_decl : void ident '(' param_l ')' pair_l SEMICOLON + | type ident '(' param_l ')' pair_l SEMICOLON""" + pass + +def p_d_func_def(p): + """d_func_def : void ident '(' param_l ')' pair_l statement_l + | type ident '(' param_l ')' pair_l statement_l""" + p[0] = Function(p[2]) + +# Type fields +def p_type_members(p): + """type_members : type_member type_members + | empty""" + pass + +def p_type_member(p): + """type_member : type ident pair_l SEMICOLON + | type ident ASSIGN expr SEMICOLON""" + pass + +# Methods +def p_type_methods(p): + """type_methods : type_method type_methods + | empty""" + pass + +def p_type_method(p): + "type_method : type_or_void ident '(' type_l ')' pair_l SEMICOLON" + pass + +# Enum fields +def p_type_enums(p): + """type_enums : type_enum type_enums + | empty""" + pass + +def p_type_enum(p): + "type_enum : ident pair_l SEMICOLON" + pass + +# Type +def p_type_l(p): + """type_l : types + | empty""" + pass + +def p_types(p): + """types : type ',' types + | type""" + pass + +def p_type(p): + "type : ident" + p[0] = p[1] + +def p_void(p): + "void : VOID" + p[0] = None + +def p_type_or_void(p): + """type_or_void : type + | void""" + p[0] = p[1] + +# Formal Param +def p_param_l(p): + """param_l : params + | empty""" + pass + +def p_params(p): + """params : param ',' params + | param""" + pass + +def p_param(p): + "param : type ident" + pass + +# Idents and lists +def p_ident(p): + "ident : IDENT" + p[0] = p[1] + +def p_ident_l(p): + """ident_l : '{' idents '}' + | ident""" + p[0] = p[1] + +def p_idents(p): + """idents : ident SEMICOLON idents + | ident ',' idents + | ident idents + | empty""" + pass + +# Pair and pair lists +def p_pair_l(p): + """pair_l : ',' pairs + | empty""" + if len(p) == 3: + p[0] = p[2] + elif len(p) == 2: + p[0] = None + +def p_pairs(p): + """pairs : pair ',' pairs + | pair""" + if len(p) == 4: + p[3].append(p[1]) + p[0] = p[3] + elif len(p) == 2: + p[0] = [ p[1] ] + +def p_pair(p): + """pair : ident '=' STRING + | ident '=' ident + | STRING""" + if len(p) == 4: + p[0] = p[1], p[3] + elif len(p) == 2: + p[0] = "short", p[1] + +# Below are the rules for action descriptions +def p_statement_l(p): + "statement_l : '{' statements '}'" + pass + +def p_statements(p): + """statements : statement statements + | empty""" + pass + +def p_expr_l(p): + """expr_l : expr ',' expr_l + | expr + | empty""" + pass + +def p_statement(p): + """statement : expr SEMICOLON + | expr ASSIGN expr SEMICOLON + | ENQUEUE '(' var ',' type pair_l ')' statement_l + | PEEK '(' var ',' type ')' statement_l + | COPY_HEAD '(' var ',' var pair_l ')' SEMICOLON + | CHECK_ALLOCATE '(' var ')' SEMICOLON + | CHECK_STOP_SLOTS '(' var ',' STRING ',' STRING ')' SEMICOLON + | if_statement + | RETURN expr SEMICOLON""" + pass + +def p_if_statement(p): + """if_statement : IF '(' expr ')' statement_l ELSE statement_l + | IF '(' expr ')' statement_l + | IF '(' expr ')' statement_l ELSE if_statement""" + pass + +def p_expr(p): + """expr : var + | literal + | enumeration + | ident '(' expr_l ')' + | THIS DOT var '[' expr ']' DOT var DOT ident '(' expr_l ')' + | THIS DOT var '[' expr ']' DOT var DOT ident + | CHIP '[' expr ']' DOT var '[' expr ']' DOT var DOT ident '(' expr_l ')' + | CHIP '[' expr ']' DOT var '[' expr ']' DOT var DOT ident + | expr DOT ident + | expr DOT ident '(' expr_l ')' + | type DOUBLE_COLON ident '(' expr_l ')' + | expr '[' expr_l ']' + | expr STAR expr + | expr SLASH expr + | expr PLUS expr + | expr DASH expr + | expr LT expr + | expr GT expr + | expr LE expr + | expr GE expr + | expr EQ expr + | expr NE expr + | expr AND expr + | expr OR expr + | NOT expr + | expr RIGHTSHIFT expr + | expr LEFTSHIFT expr + | '(' expr ')'""" + pass + +def p_literal(p): + """literal : STRING + | NUMBER + | FLOATNUMBER + | LIT_BOOL""" + pass + +def p_enumeration(p): + "enumeration : ident ':' ident" + pass + +def p_var(p): + "var : ident" + pass + +lex.lex() +yacc.yacc(write_tables=0) + +slicc_generated_cc = set([ + 'AccessModeType.cc', + 'AccessPermission.cc', + 'AccessType.cc', + 'AllocationStrategy.cc', + 'CacheMsg.cc', + 'CacheRequestType.cc', + 'Chip.cc', + 'CoherenceRequestType.cc', + 'DetermGETXGeneratorStatus.cc', + 'DetermInvGeneratorStatus.cc', + 'DetermSeriesGETSGeneratorStatus.cc', + 'GenericMachineType.cc', + 'GenericRequestType.cc', + 'LinkType.cc', + 'LockStatus.cc', + 'MachineType.cc', + 'MaskPredictorIndex.cc', + 'MaskPredictorTraining.cc', + 'MaskPredictorType.cc', + 'MemoryMsg.cc', + 'MemoryRequestType.cc', + 'MessageSizeType.cc', + 'PrefetchBit.cc', + 'Protocol.cc', + 'RequestGeneratorStatus.cc', + 'SearchMechanism.cc', + 'SequencerStatus.cc', + 'SpecifiedGeneratorType.cc', + 'TesterStatus.cc', + 'TopologyType.cc', + 'TransientRequestType.cc', + 'TransitionResult.cc']) + +slicc_generated_hh = set([ + 'AccessType.hh', + 'AccessModeType.hh', + 'AccessPermission.hh', + 'AllocationStrategy.hh', + 'CacheMsg.hh', + 'CacheRequestType.hh', + 'Chip.hh', + 'CoherenceRequestType.hh', + 'DetermGETXGeneratorStatus.hh', + 'DetermInvGeneratorStatus.hh', + 'DetermSeriesGETSGeneratorStatus.hh', + 'GenericMachineType.hh', + 'GenericRequestType.hh', + 'LinkType.hh', + 'LockStatus.hh', + 'MachineType.hh', + 'MaskPredictorIndex.hh', + 'MaskPredictorTraining.hh', + 'MaskPredictorType.hh', + 'MemoryMsg.hh', + 'MemoryRequestType.hh', + 'MessageSizeType.hh', + 'PrefetchBit.hh', + 'Protocol.hh', + 'RequestGeneratorStatus.hh', + 'SearchMechanism.hh', + 'SequencerStatus.hh', + 'SpecifiedGeneratorType.hh', + 'TesterStatus.hh', + 'TopologyType.hh', + 'TransientRequestType.hh', + 'TransitionResult.hh', + 'Types.hh', + 'protocol_name.hh' ]) + +class Machine(object): + def __init__(self, name, decls): + self.name = name + self.decls = decls + + def add(self, hh, cc): + hh.add('%s_Controller.hh' % self.name) + hh.add('%s_Profiler.hh' % self.name) + + cc.add('%s_Controller.cc' % self.name) + cc.add('%s_Profiler.cc' % self.name) + cc.add('%s_Transitions.cc' % self.name) + cc.add('%s_Wakeup.cc' % self.name) + + for decl in self.decls: + decl.add(hh, cc, self.name) + +class Declaration(object): + hh = False + cc = False + def __init__(self, name): + self.name = name + + def add(self, hh, cc, name=None): + #print '>>>', type(self).__name__, self.name + if name: + name += '_' + else: + name = "" + if self.hh: + hh.add('%s%s.hh' % (name, self.name)) + if self.cc: + cc.add('%s%s.cc' % (name, self.name)) + +class Action(Declaration): pass +class InPort(Declaration): pass +class OutPort(Declaration): pass +class Transition(Declaration): pass +class Extern(Declaration): pass +class Global(Declaration): pass +class Struct(Declaration): + hh = True + cc = True +class Enum(Declaration): + hh = True + cc = True +class Object(Declaration): pass +class Function(Declaration): + cc = True + +def scan(filenames): + hh = slicc_generated_hh.copy() + cc = slicc_generated_cc.copy() + + for filename in filenames: + lex.lexer.lineno = 1 + try: + results = yacc.parse(file(filename, 'r').read()) + except (TokenError, ParseError), e: + raise type(e), tuple([filename] + [ i for i in e ]) + + for result in results: + result.add(hh, cc) + + return list(hh), list(cc)