changeset eaf2fd8f54c0 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=eaf2fd8f54c0
description:
ruby: Migrate all of ruby and slicc to SCons.
Add the PROTOCOL sticky option sets the coherence protocol that slicc
will parse and therefore ruby will use. This whole process was made
difficult by the fact that the set of files that are output by slicc
are not easily known ahead of time. The easiest thing wound up being
to write a parser for slicc that would tell me. Incidentally this
means we now have a slicc grammar written in python.
diffstat:
26 files changed, 1591 insertions(+), 1 deletion(-)
SConstruct | 4
src/mem/gems_common/SConscript | 42 +
src/mem/gems_common/ioutil/SConscript | 34
src/mem/protocol/SConscript | 94 ++
src/mem/protocol/SConsopts | 55 +
src/mem/ruby/SConscript | 116 ++
src/mem/ruby/SConsopts | 38
src/mem/ruby/buffers/SConscript | 34
src/mem/ruby/common/Debug.hh | 2
src/mem/ruby/common/SConscript | 42 +
src/mem/ruby/config/RubyConfig.cc | 1
src/mem/ruby/config/SConscript | 33
src/mem/ruby/eventqueue/RubyEventQueue.hh | 1
src/mem/ruby/eventqueue/SConscript | 34
src/mem/ruby/init.cc | 2
src/mem/ruby/network/garnet-fixed-pipeline/SConscript | 46 +
src/mem/ruby/network/garnet-flexible-pipeline/SConscript | 41 +
src/mem/ruby/network/orion/SConscript | 41 +
src/mem/ruby/network/simple/SConscript | 37
src/mem/ruby/profiler/SConscript | 37
src/mem/ruby/recorder/SConscript | 33
src/mem/ruby/slicc_interface/SConscript | 35
src/mem/ruby/system/SConscript | 50 +
src/mem/ruby/tester/SConscript | 43 +
src/mem/slicc/SConscript | 125 +++
src/mem/slicc/parser/parser.py | 572 ++++++++++++++
diffs (truncated from 1726 to 300 lines):
diff -r 76de2027b8ad -r eaf2fd8f54c0 SConstruct
--- a/SConstruct Mon May 11 10:38:45 2009 -0700
+++ b/SConstruct Mon May 11 10:38:46 2009 -0700
@@ -410,6 +410,10 @@
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 -r 76de2027b8ad -r eaf2fd8f54c0 src/mem/gems_common/SConscript
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mem/gems_common/SConscript Mon May 11 10:38:46 2009 -0700
@@ -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 -r 76de2027b8ad -r eaf2fd8f54c0 src/mem/gems_common/ioutil/SConscript
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mem/gems_common/ioutil/SConscript Mon May 11 10:38:46 2009 -0700
@@ -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 -r 76de2027b8ad -r eaf2fd8f54c0 src/mem/protocol/SConscript
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mem/protocol/SConscript Mon May 11 10:38:46 2009 -0700
@@ -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 -r 76de2027b8ad -r eaf2fd8f54c0 src/mem/protocol/SConsopts
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mem/protocol/SConsopts Mon May 11 10:38:46 2009 -0700
@@ -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 -r 76de2027b8ad -r eaf2fd8f54c0 src/mem/ruby/SConscript
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mem/ruby/SConscript Mon May 11 10:38:46 2009 -0700
@@ -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')
+
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev