Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread Gabriel Michael Black
Ah, ok, that makes more sense. I didn't expand the little blurb so it  
looked like foo.cc's foo.hh would be last and not first. But in the  
example code it's first which would make that work.


Gabe

Quoting nathan binkert :


I don't see how it avoids depending on transitive includes...


It's not perfect, but with it, every (or almost every) include file is
included first in at least one file.  Since the file is first there
will have been no other includes from other files, and it will only
compile correctly if its own includes are correct.

  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev





___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread nathan binkert
> I don't see how it avoids depending on transitive includes...

It's not perfect, but with it, every (or almost every) include file is
included first in at least one file.  Since the file is first there
will have been no other includes from other files, and it will only
compile correctly if its own includes are correct.

  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: Ruby: Add support for functional accesses

2011-04-15 Thread Steve Reinhardt

---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/611/#review1130
---


Thanks for pointing these changes out.  I didn't look at the Ruby stuff since 
it looks like Brad has beaten you up plenty on that.

I think it's fine to check this in initially without any support for handling 
errors outside of the tester.  I checked and there aren't many unique calls to 
sendFunctional; most of the uses of functional accesses go through 
Port::readBlob() and Port::writeBlob().  Adding code to check the return cmd 
value at each call site and call warn() if it fails would be the next step in 
my opinion.




configs/example/ruby_mem_test.py


You probably don't want to commit this value, do you?  If you want to 
hardwire a number, I'd pick something more reasonable (somewhere between 10 and 
25, just guessing).



src/mem/packet.hh


I don't see much value in having separate error return codes for reads and 
writes.  I'd use a single code that ends in Error (like FunctionalAccessError), 
and put it up a couple of lines with the other Error codes.



src/mem/packet.hh


Way too much code duplication here :-).  I think this works, correct?

void
makeFunctionalResponse(bool success)
{
makeResponse();
if (!success) {
cmd = MemCmd::FunctionalAccessError;
}
}



- Steve


On 2011-04-13 14:29:01, Nilay Vaish wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/611/
> ---
> 
> (Updated 2011-04-13 14:29:01)
> 
> 
> Review request for Default.
> 
> 
> Summary
> ---
> 
> Ruby: Add support for functional accesses
> This patch is meant for implementing functional access support in Ruby.
> Currently, the patch does not functional accesses for the PioPort.
> 
> 
> Diffs
> -
> 
>   configs/example/ruby_mem_test.py 8b5f900233ee 
>   configs/ruby/MESI_CMP_directory.py 8b5f900233ee 
>   configs/ruby/Ruby.py 8b5f900233ee 
>   src/cpu/testers/memtest/memtest.cc 8b5f900233ee 
>   src/mem/packet.hh 8b5f900233ee 
>   src/mem/packet.cc 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-L1cache.sm 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-L2cache.sm 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-dir.sm 8b5f900233ee 
>   src/mem/protocol/RubySlicc_Types.sm 8b5f900233ee 
>   src/mem/ruby/network/Network.cc 8b5f900233ee 
>   src/mem/ruby/network/Network.py 8b5f900233ee 
>   src/mem/ruby/profiler/Profiler.cc 8b5f900233ee 
>   src/mem/ruby/profiler/Profiler.py 8b5f900233ee 
>   src/mem/ruby/recorder/Tracer.cc 8b5f900233ee 
>   src/mem/ruby/recorder/Tracer.py 8b5f900233ee 
>   src/mem/ruby/system/AbstractMemory.hh PRE-CREATION 
>   src/mem/ruby/system/AbstractMemory.cc PRE-CREATION 
>   src/mem/ruby/system/AbstractMemory.py PRE-CREATION 
>   src/mem/ruby/system/Cache.py 8b5f900233ee 
>   src/mem/ruby/system/CacheMemory.hh 8b5f900233ee 
>   src/mem/ruby/system/CacheMemory.cc 8b5f900233ee 
>   src/mem/ruby/system/DirectoryMemory.hh 8b5f900233ee 
>   src/mem/ruby/system/DirectoryMemory.cc 8b5f900233ee 
>   src/mem/ruby/system/DirectoryMemory.py 8b5f900233ee 
>   src/mem/ruby/system/RubyPort.hh 8b5f900233ee 
>   src/mem/ruby/system/RubyPort.cc 8b5f900233ee 
>   src/mem/ruby/system/RubySystem.py 8b5f900233ee 
>   src/mem/ruby/system/SConscript 8b5f900233ee 
>   src/mem/ruby/system/Sequencer.cc 8b5f900233ee 
>   src/mem/ruby/system/Sequencer.py 8b5f900233ee 
>   src/mem/ruby/system/System.hh 8b5f900233ee 
>   src/mem/ruby/system/System.cc 8b5f900233ee 
>   src/mem/slicc/ast/MemberExprAST.py 8b5f900233ee 
> 
> Diff: http://reviews.m5sim.org/r/611/diff
> 
> 
> Testing
> ---
> 
> I have tested functional accesses with the ratio between functional
> and timing accesses for different ratios -- 100:0, 99:1, 90:1, 50:50,
> 10:90, 1:99. It is working in all the cases.
> 
> 
> Thanks,
> 
> Nilay
> 
>

___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread Gabriel Michael Black

I don't see how it avoids depending on transitive includes...

Quoting nathan binkert :


I noticed a clever way to fix this in the google style guide that we
could adopt if we choose.
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Names_and_Order_of_Includes


Cute... seems like a nice little tweak.  I assume your script can do
this automatically?  :-)


Honestly, I think it could with only a little effort, assuming that we
like the idea.  We're generally pretty good about having .cc files
with a matching .hh, though _impl.hh might take some extra tweaking.

  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev




___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread nathan binkert
>> I noticed a clever way to fix this in the google style guide that we
>> could adopt if we choose.
>> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Names_and_Order_of_Includes
>
> Cute... seems like a nice little tweak.  I assume your script can do
> this automatically?  :-)

Honestly, I think it could with only a little effort, assuming that we
like the idea.  We're generally pretty good about having .cc files
with a matching .hh, though _impl.hh might take some extra tweaking.

  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread Steve Reinhardt
On Fri, Apr 15, 2011 at 3:42 PM, nathan binkert  wrote:
> I noticed a clever way to fix this in the google style guide that we
> could adopt if we choose.
> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Names_and_Order_of_Includes

Cute... seems like a nice little tweak.  I assume your script can do
this automatically?  :-)
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread nathan binkert
> Are these just fixups where we were getting away with not including
> needed files, and reordering the includes exposed that?
Yes. Exactly.

> Or are there
> other causes?  Superficially, the fact that a fix-up was needed after
> running your script doesn't look good for your script... I'm assuming
> it's a one-time thing but just want to verify that.
Should be a one time thing.

I noticed a clever way to fix this in the google style guide that we
could adopt if we choose.
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Names_and_Order_of_Includes


  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread Steve Reinhardt
Are these just fixups where we were getting away with not including
needed files, and reordering the includes exposed that?  Or are there
other causes?  Superficially, the fact that a fix-up was needed after
running your script doesn't look good for your script... I'm assuming
it's a one-time thing but just want to verify that.

Steve

On Fri, Apr 15, 2011 at 3:31 PM, Nathan Binkert  wrote:
> changeset 845c8eb5ac49 in /z/repo/m5
> details: http://repo.m5sim.org/m5?cmd=changeset;node=845c8eb5ac49
> description:
>        includes: fix up code after sorting
>
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


[m5-dev] changeset in m5: unittest: Make unit tests capable of using swig...

2011-04-15 Thread Nathan Binkert
changeset 6381dc8bcfcc in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=6381dc8bcfcc
description:
unittest: Make unit tests capable of using swig and python, convert 
stattest

diffstat:

 src/SConscript   |   43 ++-
 src/unittest/SConscript  |6 +-
 src/unittest/stattest.cc |  116 +++---
 src/unittest/stattest.i  |   36 +
 src/unittest/stattestmain.py |   19 +++
 5 files changed, 121 insertions(+), 99 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r a08c5fb4cd89 -r 6381dc8bcfcc src/SConscript
--- a/src/SConscriptFri Apr 15 10:44:59 2011 -0700
+++ b/src/SConscriptFri Apr 15 10:45:11 2011 -0700
@@ -233,15 +233,26 @@
 self.cc_source = Source(cc_file, swig=True, parent=self)
 self.py_source = PySource(package, py_file, parent=self)
 
-unit_tests = []
-def UnitTest(target, sources):
-'''Create a unit test, specify the target name and a source or
-list of sources'''
-if not isinstance(sources, (list, tuple)):
-sources = [ sources ]
+class UnitTest(object):
+'''Create a UnitTest'''
 
-sources = [ Source(src, skip_lib=True) for src in sources ]
-unit_tests.append((target, sources))
+all = []
+def __init__(self, target, *sources):
+'''Specify the target name and any sources.  Sources that are
+not SourceFiles are evalued with Source().  All files are
+guarded with a guard of the same name as the UnitTest
+target.'''
+
+srcs = []
+for src in sources:
+if not isinstance(src, SourceFile):
+src = Source(src, skip_lib=True)
+src.guards[target] = True
+srcs.append(src)
+
+self.sources = srcs
+self.target = target
+UnitTest.all.append(self)
 
 # Children should have access
 Export('Source')
@@ -673,10 +684,11 @@
 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode,
 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG")))
-init_file = 'python/swig/init_%s.cc' % swig.module
+cc_file = str(swig.tnode)
+init_file = '%s/init_%s.cc' % (dirname(cc_file), basename(cc_file))
 env.Command(init_file, Value(swig.module),
 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW")))
-Source(init_file)
+Source(init_file, **swig.guards)
 
 #
 # Handle debug flags
@@ -904,13 +916,16 @@
 static_lib = new_env.StaticLibrary(libname, static_objs)
 shared_lib = new_env.SharedLibrary(libname, shared_objs)
 
-for target, sources in unit_tests:
-objs = [ make_obj(s, static=True) for s in sources ]
-new_env.Program("unittest/%s.%s" % (target, label), objs + static_objs)
-
 # Now link a stub with main() and the static library.
 main_objs = [ make_obj(s, True) for s in Source.get(main=True) ]
 
+for test in UnitTest.all:
+flags = { test.target : True }
+test_sources = Source.get(**flags)
+test_objs = [ make_obj(s, static=True) for s in test_sources ]
+testname = "unittest/%s.%s" % (test.target, label)
+new_env.Program(testname, main_objs + test_objs + static_objs)
+
 progname = exename
 if strip:
 progname += '.unstripped'
diff -r a08c5fb4cd89 -r 6381dc8bcfcc src/unittest/SConscript
--- a/src/unittest/SConscript   Fri Apr 15 10:44:59 2011 -0700
+++ b/src/unittest/SConscript   Fri Apr 15 10:45:11 2011 -0700
@@ -47,8 +47,12 @@
 UnitTest('rangemaptest', 'rangemaptest.cc')
 UnitTest('rangemultimaptest', 'rangemultimaptest.cc')
 UnitTest('refcnttest', 'refcnttest.cc')
-UnitTest('stattest', 'stattest.cc')
 UnitTest('strnumtest', 'strnumtest.cc')
+
+stattest_py = PySource('m5', 'stattestmain.py', skip_lib=True)
+stattest_swig = SwigSource('m5.internal', 'stattest.i', skip_lib=True)
+UnitTest('stattest', 'stattest.cc', stattest_py, stattest_swig)
+
 UnitTest('symtest', 'symtest.cc')
 UnitTest('tokentest', 'tokentest.cc')
 UnitTest('tracetest', 'tracetest.cc')
diff -r a08c5fb4cd89 -r 6381dc8bcfcc src/unittest/stattest.cc
--- a/src/unittest/stattest.cc  Fri Apr 15 10:44:59 2011 -0700
+++ b/src/unittest/stattest.cc  Fri Apr 15 10:45:11 2011 -0700
@@ -32,8 +32,6 @@
 #include 
 #include 
 
-#include "base/stats/mysql.hh"
-#include "base/stats/text.hh"
 #include "base/cprintf.hh"
 #include "base/misc.hh"
 #include "base/statistics.hh"
@@ -41,6 +39,13 @@
 #include "sim/core.hh"
 #include "sim/stat_control.hh"
 
+// override the default main() code for this unittest
+const char *m5MainCommands[] = {
+"import m5.stattestmain",
+"m5.stattestmain.main()",
+0 // sentinel is required
+};
+
 using namespace std;
 using namespace Stats;
 
@@ -55,67 +60,8 @@
 double operator()() { return 9.7; }
 };
 
-const char *progname = "";
-
-void
-usage()
+struct StatTest
 {
-panic("incorrect usage.\n"
-  "us

[m5-dev] changeset in m5: scons: make a flexible system for guarding sour...

2011-04-15 Thread Nathan Binkert
changeset 15b5ea80fd95 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=15b5ea80fd95
description:
scons: make a flexible system for guarding source files
This is similar to guards on mercurial queues and they're used for 
selecting
which files are compiled into some given object.  We already do 
something
similar, but it's mostly hard coded for the m5 binary and the m5 library
and I'd like to make it more flexible to better support the unittests

diffstat:

 src/SConscript |  116 +++-
 src/sim/SConscript |2 +-
 2 files changed, 87 insertions(+), 31 deletions(-)

diffs (220 lines):

diff -r b28d06a175be -r 15b5ea80fd95 src/SConscript
--- a/src/SConscriptFri Apr 15 10:44:32 2011 -0700
+++ b/src/SConscriptFri Apr 15 10:44:44 2011 -0700
@@ -56,42 +56,92 @@
 
 # Code for adding source files of various types
 #
+# When specifying a source file of some type, a set of guards can be
+# specified for that file.  When get() is used to find the files, if
+# get specifies a set of filters, only files that match those filters
+# will be accepted (unspecified filters on files are assumed to be
+# false).  Current filters are:
+# main -- specifies the m5 main() function
+# skip_lib -- do not put this file into the m5 library
+#  -- unit tests use filters based on the unit test name
+#
+# A parent can now be specified for a source file and default filter
+# values will be retrieved recursively from parents (children override
+# parents).
+#
 class SourceMeta(type):
+'''Meta class for source files that keeps track of all files of a
+particular type and has a get function for finding all functions
+of a certain type that match a set of guards'''
 def __init__(cls, name, bases, dict):
 super(SourceMeta, cls).__init__(name, bases, dict)
 cls.all = []
 
-def get(cls, **kwargs):
+def get(cls, **guards):
+'''Find all files that match the specified guards.  If a source
+file does not specify a flag, the default is False'''
 for src in cls.all:
-for attr,value in kwargs.iteritems():
-if getattr(src, attr) != value:
+for flag,value in guards.iteritems():
+# if the flag is found and has a different value, skip
+# this file
+if src.all_guards.get(flag, False) != value:
 break
 else:
 yield src
 
 class SourceFile(object):
+'''Base object that encapsulates the notion of a source file.
+This includes, the source node, target node, various manipulations
+of those.  A source file also specifies a set of guards which
+describing which builds the source file applies to.  A parent can
+also be specified to get default guards from'''
 __metaclass__ = SourceMeta
-def __init__(self, source):
+def __init__(self, source, parent=None, **guards):
+self.guards = guards
+self.parent = parent
+
 tnode = source
 if not isinstance(source, SCons.Node.FS.File):
 tnode = File(source)
 
 self.tnode = tnode
 self.snode = tnode.srcnode()
-self.filename = str(tnode)
-self.dirname = dirname(self.filename)
-self.basename = basename(self.filename)
-index = self.basename.rfind('.')
-if index <= 0:
-# dot files aren't extensions
-self.extname = self.basename, None
-else:
-self.extname = self.basename[:index], self.basename[index+1:]
 
 for base in type(self).__mro__:
 if issubclass(base, SourceFile):
 base.all.append(self)
 
+@property
+def filename(self):
+return str(self.tnode)
+
+@property
+def dirname(self):
+return dirname(self.filename)
+
+@property
+def basename(self):
+return basename(self.filename)
+
+@property
+def extname(self):
+index = self.basename.rfind('.')
+if index <= 0:
+# dot files aren't extensions
+return self.basename, None
+
+return self.basename[:index], self.basename[index+1:]
+
+@property
+def all_guards(self):
+'''find all guards for this object getting default values
+recursively from its parents'''
+guards = {}
+if self.parent:
+guards.update(self.parent.guards)
+guards.update(self.guards)
+return guards
+
 def __lt__(self, other): return self.filename < other.filename
 def __le__(self, other): return self.filename <= other.filename
 def __gt__(self, other): return self.filename > other.filename
@@ -101,14 +151,12 @@
 
 class Source(SourceFile):
 '''Add a c/c++ source file to the build'''
-def __init__(self, source, Werror=Tr

[m5-dev] changeset in m5: python: cleanup python code so stuff doesn't au...

2011-04-15 Thread Nathan Binkert
changeset a08c5fb4cd89 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=a08c5fb4cd89
description:
python: cleanup python code so stuff doesn't automatically happen at 
startup
this allows things to be overridden at startup (e.g. for tests)

diffstat:

 src/python/m5/__init__.py |2 +-
 src/python/m5/main.py |  171 +
 src/python/m5/simulate.py |3 +-
 src/sim/init.cc   |   36 ++---
 4 files changed, 120 insertions(+), 92 deletions(-)

diffs (truncated from 302 to 300 lines):

diff -r 15b5ea80fd95 -r a08c5fb4cd89 src/python/m5/__init__.py
--- a/src/python/m5/__init__.py Fri Apr 15 10:44:44 2011 -0700
+++ b/src/python/m5/__init__.py Fri Apr 15 10:44:59 2011 -0700
@@ -49,5 +49,5 @@
 import util
 
 from event import *
-from main import options, main
+from main import main
 from simulate import *
diff -r 15b5ea80fd95 -r a08c5fb4cd89 src/python/m5/main.py
--- a/src/python/m5/main.py Fri Apr 15 10:44:44 2011 -0700
+++ b/src/python/m5/main.py Fri Apr 15 10:44:59 2011 -0700
@@ -32,10 +32,6 @@
 import socket
 import sys
 
-from util import attrdict, fatal
-import config
-from options import OptionParser
-
 __all__ = [ 'options', 'arguments', 'main' ]
 
 usage="%prog [m5 options] script.py [script options]"
@@ -46,87 +42,96 @@
 All Rights Reserved
 '''
 
-options = OptionParser(usage=usage, version=version,
-   description=brief_copyright)
-add_option = options.add_option
-set_group = options.set_group
-usage = options.usage
+def parse_options():
+import config
+from options import OptionParser
 
-# Help options
-add_option('-A', "--authors", action="store_true", default=False,
-help="Show author information")
-add_option('-B', "--build-info", action="store_true", default=False,
-help="Show build information")
-add_option('-C', "--copyright", action="store_true", default=False,
-help="Show full copyright information")
-add_option('-R', "--readme", action="store_true", default=False,
-help="Show the readme")
+options = OptionParser(usage=usage, version=version,
+   description=brief_copyright)
+option = options.add_option
+group = options.set_group
 
-# Options for configuring the base simulator
-add_option('-d', "--outdir", metavar="DIR", default="m5out",
-help="Set the output directory to DIR [Default: %default]")
-add_option('-r', "--redirect-stdout", action="store_true", default=False,
-   help="Redirect stdout (& stderr, without -e) to file")
-add_option('-e', "--redirect-stderr", action="store_true", default=False,
-   help="Redirect stderr to file")
-add_option("--stdout-file", metavar="FILE", default="simout",
-   help="Filename for -r redirection [Default: %default]")
-add_option("--stderr-file", metavar="FILE", default="simerr",
-   help="Filename for -e redirection [Default: %default]")
-add_option('-i', "--interactive", action="store_true", default=False,
-help="Invoke the interactive interpreter after running the script")
-add_option("--pdb", action="store_true", default=False,
-help="Invoke the python debugger before running the script")
-add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':',
-help="Prepend PATH to the system path when invoking the script")
-add_option('-q', "--quiet", action="count", default=0,
-help="Reduce verbosity")
-add_option('-v', "--verbose", action="count", default=0,
-help="Increase verbosity")
+# Help options
+option('-A', "--authors", action="store_true", default=False,
+help="Show author information")
+option('-B', "--build-info", action="store_true", default=False,
+help="Show build information")
+option('-C', "--copyright", action="store_true", default=False,
+help="Show full copyright information")
+option('-R', "--readme", action="store_true", default=False,
+help="Show the readme")
 
-# Statistics options
-set_group("Statistics Options")
-add_option("--stats-file", metavar="FILE", default="stats.txt",
-help="Sets the output file for statistics [Default: %default]")
+# Options for configuring the base simulator
+option('-d', "--outdir", metavar="DIR", default="m5out",
+help="Set the output directory to DIR [Default: %default]")
+option('-r', "--redirect-stdout", action="store_true", default=False,
+help="Redirect stdout (& stderr, without -e) to file")
+option('-e', "--redirect-stderr", action="store_true", default=False,
+help="Redirect stderr to file")
+option("--stdout-file", metavar="FILE", default="simout",
+help="Filename for -r redirection [Default: %default]")
+option("--stderr-file", metavar="FILE", default="simerr",
+help="Filename for -e redirection [Default: %default]")
+option('-i', "--interactive", action="store_true", default=False,
+help="Invok

[m5-dev] changeset in m5: trace: reimplement the DTRACE function so it do...

2011-04-15 Thread Nathan Binkert
changeset b28d06a175be in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=b28d06a175be
description:
trace: reimplement the DTRACE function so it doesn't use a vector
At the same time, rename the trace flags to debug flags since they
have broader usage than simply tracing.  This means that
--trace-flags is now --debug-flags and --trace-help is now --debug-help

diffstat:

 src/SConscript|  260 
++---
 src/arch/alpha/interrupts.hh  |2 +
 src/arch/alpha/kernel_stats.cc|1 +
 src/arch/alpha/linux/process.cc   |1 +
 src/arch/alpha/linux/system.cc|1 +
 src/arch/alpha/process.cc |1 +
 src/arch/alpha/remote_gdb.cc  |2 +
 src/arch/alpha/stacktrace.hh  |1 +
 src/arch/alpha/system.cc  |1 +
 src/arch/alpha/tlb.cc |1 +
 src/arch/alpha/vtophys.cc |1 +
 src/arch/arm/faults.cc|1 +
 src/arch/arm/isa.cc   |2 +
 src/arch/arm/isa.hh   |1 +
 src/arch/arm/isa/includes.isa |1 +
 src/arch/arm/nativetrace.cc   |1 +
 src/arch/arm/predecoder.cc|1 +
 src/arch/arm/process.cc   |1 +
 src/arch/arm/remote_gdb.cc|2 +
 src/arch/arm/stacktrace.hh|1 +
 src/arch/arm/tlb.cc   |3 +
 src/arch/arm/types.hh |1 +
 src/arch/mips/faults.cc   |1 +
 src/arch/mips/isa.cc  |1 +
 src/arch/mips/isa/includes.isa|1 +
 src/arch/mips/linux/process.cc|1 +
 src/arch/mips/locked_mem.hh   |1 +
 src/arch/mips/process.cc  |1 +
 src/arch/mips/stacktrace.hh   |1 +
 src/arch/mips/tlb.cc  |2 +
 src/arch/power/process.cc |1 +
 src/arch/power/stacktrace.hh  |1 +
 src/arch/power/tlb.cc |2 +
 src/arch/sparc/interrupts.hh  |1 +
 src/arch/sparc/isa.cc |2 +
 src/arch/sparc/isa/includes.isa   |1 +
 src/arch/sparc/process.cc |1 +
 src/arch/sparc/remote_gdb.cc  |1 +
 src/arch/sparc/stacktrace.hh  |1 +
 src/arch/sparc/tlb.cc |2 +
 src/arch/sparc/ua2005.cc  |2 +
 src/arch/sparc/vtophys.cc |1 +
 src/arch/x86/faults.cc|2 +
 src/arch/x86/insts/microregop.cc  |1 +
 src/arch/x86/insts/static_inst.hh |1 +
 src/arch/x86/interrupts.cc|1 +
 src/arch/x86/isa/includes.isa |1 +
 src/arch/x86/nativetrace.cc   |1 +
 src/arch/x86/pagetable_walker.cc  |1 +
 src/arch/x86/predecoder.cc|1 +
 src/arch/x86/predecoder.hh|1 +
 src/arch/x86/process.cc   |1 +
 src/arch/x86/stacktrace.hh|1 +
 src/arch/x86/tlb.cc   |1 +
 src/arch/x86/vtophys.cc   |1 +
 src/base/debug.cc |  135 +
 src/base/debug.hh |   75 ++
 src/base/loader/aout_object.cc|1 +
 src/base/loader/ecoff_object.cc   |1 +
 src/base/loader/elf_object.cc |1 +
 sr

[m5-dev] changeset in m5: debug: create a Debug namespace

2011-04-15 Thread Nathan Binkert
changeset 51cf7f3cf9ac in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=51cf7f3cf9ac
description:
debug: create a Debug namespace

diffstat:

 src/arch/alpha/ev5.cc  |  2 +-
 src/base/debug.cc  |  8 ++--
 src/base/debug.hh  |  6 +-
 src/base/statistics.cc |  2 +-
 src/cpu/pc_event.cc|  2 +-
 src/dev/ns_gige.cc |  8 
 src/dev/sinic.cc   |  2 +-
 src/sim/debug.cc   |  4 ++--
 src/sim/pseudo_inst.cc |  2 +-
 9 files changed, 22 insertions(+), 14 deletions(-)

diffs (156 lines):

diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/arch/alpha/ev5.cc
--- a/src/arch/alpha/ev5.cc Fri Apr 15 10:44:14 2011 -0700
+++ b/src/arch/alpha/ev5.cc Fri Apr 15 10:44:15 2011 -0700
@@ -289,7 +289,7 @@
   case IPR_IPLR:
 #ifdef DEBUG
 if (break_ipl != -1 && break_ipl == (int)(val & 0x1f))
-debug_break();
+Debug::breakpoint();
 #endif
 
 // only write least significant five bits - interrupt level
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/base/debug.cc
--- a/src/base/debug.cc Fri Apr 15 10:44:14 2011 -0700
+++ b/src/base/debug.cc Fri Apr 15 10:44:15 2011 -0700
@@ -35,12 +35,16 @@
 
 #include "base/cprintf.hh"
 
+namespace Debug {
+
 void
-debug_break()
+breakpoint()
 {
 #ifndef NDEBUG
 kill(getpid(), SIGTRAP);
 #else
-cprintf("debug_break suppressed, compiled with NDEBUG\n");
+cprintf("Debug::breakpoint suppressed, compiled with NDEBUG\n");
 #endif
 }
+
+} // namespace Debug
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/base/debug.hh
--- a/src/base/debug.hh Fri Apr 15 10:44:14 2011 -0700
+++ b/src/base/debug.hh Fri Apr 15 10:44:15 2011 -0700
@@ -31,6 +31,10 @@
 #ifndef __BASE_DEBUG_HH__
 #define __BASE_DEBUG_HH__
 
-void debug_break();
+namespace Debug {
+
+void breakpoint();
+
+} // namespace Debug
 
 #endif // __BASE_DEBUG_HH__
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/base/statistics.cc
--- a/src/base/statistics.ccFri Apr 15 10:44:14 2011 -0700
+++ b/src/base/statistics.ccFri Apr 15 10:44:15 2011 -0700
@@ -130,7 +130,7 @@
 {
 id = id_count++;
 if (debug_break_id >= 0 and debug_break_id == id)
-debug_break();
+Debug::breakpoint();
 }
 
 Info::~Info()
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/cpu/pc_event.cc
--- a/src/cpu/pc_event.cc   Fri Apr 15 10:44:14 2011 -0700
+++ b/src/cpu/pc_event.cc   Fri Apr 15 10:44:15 2011 -0700
@@ -132,7 +132,7 @@
 {
 StringWrap name(tc->getCpuPtr()->name() + ".break_event");
 DPRINTFN("break event %s triggered\n", descr());
-debug_break();
+Debug::breakpoint();
 if (remove)
 delete this;
 }
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/dev/ns_gige.cc
--- a/src/dev/ns_gige.ccFri Apr 15 10:44:14 2011 -0700
+++ b/src/dev/ns_gige.ccFri Apr 15 10:44:15 2011 -0700
@@ -937,7 +937,7 @@
 
 intrTick = when;
 if (intrTick < curTick()) {
-debug_break();
+Debug::breakpoint();
 intrTick = curTick();
 }
 
@@ -1705,7 +1705,7 @@
 udp->sum(cksum(udp));
 txUdpChecksums++;
 } else {
-debug_break();
+Debug::breakpoint();
 warn_once("UDPPKT set, but not UDP!\n");
 }
 } else if (extsts & EXTSTS_TCPPKT) {
@@ -1715,7 +1715,7 @@
 tcp->sum(cksum(tcp));
 txTcpChecksums++;
 } else {
-debug_break();
+Debug::breakpoint();
 warn_once("TCPPKT set, but not UDP!\n");
 }
 }
@@ -1725,7 +1725,7 @@
 ip->sum(cksum(ip));
 txIpChecksums++;
 } else {
-debug_break();
+Debug::breakpoint();
 warn_once("IPPKT set, but not UDP!\n");
 }
 }
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/dev/sinic.cc
--- a/src/dev/sinic.cc  Fri Apr 15 10:44:14 2011 -0700
+++ b/src/dev/sinic.cc  Fri Apr 15 10:44:15 2011 -0700
@@ -687,7 +687,7 @@
 
 intrTick = when;
 if (intrTick < curTick()) {
-debug_break();
+Debug::breakpoint();
 intrTick = curTick();
 }
 
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/sim/debug.cc
--- a/src/sim/debug.cc  Fri Apr 15 10:44:14 2011 -0700
+++ b/src/sim/debug.cc  Fri Apr 15 10:44:15 2011 -0700
@@ -67,14 +67,14 @@
 void
 DebugBreakEvent::process()
 {
-debug_break();
+Debug::breakpoint();
 }
 
 
 const char *
 DebugBreakEvent::description() const
 {
-return "debug break";
+return "debug breakpoint";
 }
 
 //
diff -r 845c8eb5ac49 -r 51cf7f3cf9ac src/sim/pseudo_inst.cc
--- a/src/sim/pseudo_inst.ccFri Apr 15 10:44:14 2011 -0700
+++ b/src/sim/pseudo_inst.ccFri 

[m5-dev] changeset in m5: includes: sort all includes

2011-04-15 Thread Nathan Binkert
changeset 78bf55f23338 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=78bf55f23338
description:
includes: sort all includes

diffstat:

 src/arch/alpha/faults.cc  |   6 +-
 src/arch/alpha/isa.hh |   5 +-
 src/arch/alpha/isa/main.isa   |  12 +-
 src/arch/alpha/linux/system.cc|   8 +-
 src/arch/alpha/mt.hh  |   6 +-
 src/arch/alpha/process.cc |   2 +-
 src/arch/alpha/remote_gdb.cc  |   4 +-
 src/arch/alpha/remote_gdb.hh  |   6 +-
 src/arch/alpha/tlb.cc |   2 +-
 src/arch/alpha/tru64/process.cc   |   2 +-
 src/arch/alpha/types.hh   |   2 +-
 src/arch/alpha/utility.hh |   2 +-
 src/arch/arm/faults.cc|   4 +-
 src/arch/arm/faults.hh|   2 +-
 src/arch/arm/insts/macromem.cc|   3 +-
 src/arch/arm/insts/static_inst.cc |   4 +-
 src/arch/arm/insts/vfp.hh |   6 +-
 src/arch/arm/intregs.hh   |   2 +-
 src/arch/arm/isa/includes.isa |   8 +-
 src/arch/arm/linux/atag.hh|   1 +
 src/arch/arm/linux/linux.cc   |   4 +-
 src/arch/arm/linux/process.cc |   2 -
 src/arch/arm/linux/process.hh |   1 -
 src/arch/arm/linux/system.cc  |   2 +-
 src/arch/arm/locked_mem.hh|   1 -
 src/arch/arm/pagetable.hh |   1 -
 src/arch/arm/predecoder.hh|   2 +-
 src/arch/arm/process.hh   |   1 +
 src/arch/arm/registers.hh |   2 +-
 src/arch/arm/remote_gdb.cc|  10 +-
 src/arch/arm/system.cc|   3 +-
 src/arch/arm/system.hh|   2 +-
 src/arch/arm/table_walker.cc  |   2 +-
 src/arch/arm/table_walker.hh  |   1 -
 src/arch/arm/tlb.hh   |   2 +-
 src/arch/arm/vtophys.hh   |   1 -
 src/arch/generic/debugfaults.hh   |   4 +-
 src/arch/generic/types.hh |   2 +-
 src/arch/mips/dsp.cc  |   6 +-
 src/arch/mips/dsp.hh  |   2 +-
 src/arch/mips/isa.cc  |   2 +-
 src/arch/mips/isa.hh  |   2 +-
 src/arch/mips/isa/includes.isa|  39 
-
 src/arch/mips/isa_traits.hh   |   2 +-
 src/arch/mips/linux/linux.cc  |   4 +-
 src/arch/mips/linux/process.cc|   4 +-
 src/arch/mips/linux/process.hh|   2 +-
 src/arch/mips/linux/system.cc |   8 +-
 src/arch/mips/mt.hh   |   6 +-
 src/arch/mips/process.cc  |   2 +-
 src/arch/mips/process.hh  |   1 +
 src/arch/mips/system.cc   |   3 +-
 src/arch/mips/system.hh   |   4 +-
 src/arch/mips/tlb.cc  |   6 +-
 src/arch/mips/tlb.hh  |   4 +-
 src/arch/mips/utility.cc  |   8 +-
 src/arch/mips/utility.hh  |   3 +-
 src/arch/mips/vtophys.hh  |   1 -
 src/arch/power/insts/floating.hh  |   2 +-
 src/arch/power/insts/integer.hh   |   2 +-
 src/arch/power/isa/includes.isa   |  16 ++--
 src/arch/power/linux/linux.cc |   4 +-
 src/arch/power/linux/process.cc   |   2 -
 src/arch/power/linux/process.hh

[m5-dev] changeset in m5: includes: fix up code after sorting

2011-04-15 Thread Nathan Binkert
changeset 845c8eb5ac49 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=845c8eb5ac49
description:
includes: fix up code after sorting

diffstat:

 src/arch/power/isa/includes.isa |  7 +++
 src/base/statistics.hh  |  2 +-
 src/base/stats/mysql.hh |  9 ++---
 src/base/stats/text.cc  |  4 ++--
 src/base/stats/visit.hh |  1 -
 src/cpu/o3/commit.hh|  2 ++
 src/cpu/o3/commit_impl.hh   |  1 +
 src/cpu/o3/decode_impl.hh   |  4 
 src/cpu/o3/iew.hh   |  1 +
 src/cpu/o3/iew_impl.hh  |  1 +
 src/cpu/o3/lsq_unit.hh  |  1 +
 src/cpu/o3/rob.hh   |  2 ++
 src/cpu/smt.hh  |  2 ++
 13 files changed, 26 insertions(+), 11 deletions(-)

diffs (192 lines):

diff -r 78bf55f23338 -r 845c8eb5ac49 src/arch/power/isa/includes.isa
--- a/src/arch/power/isa/includes.isa   Fri Apr 15 10:44:06 2011 -0700
+++ b/src/arch/power/isa/includes.isa   Fri Apr 15 10:44:14 2011 -0700
@@ -71,14 +71,13 @@
 
 output exec {{
 #include 
+#if defined(linux)
+#include 
+#endif
 
 #include "arch/power/faults.hh"
 #include "arch/power/isa_traits.hh"
 #include "arch/power/utility.hh"
-#if defined(linux)
-#include 
-#endif
-
 #include "base/condcodes.hh"
 #include "cpu/base.hh"
 #include "cpu/exetrace.hh"
diff -r 78bf55f23338 -r 845c8eb5ac49 src/base/statistics.hh
--- a/src/base/statistics.hhFri Apr 15 10:44:06 2011 -0700
+++ b/src/base/statistics.hhFri Apr 15 10:44:14 2011 -0700
@@ -50,7 +50,7 @@
 #include 
 #include 
 #ifdef __SUNPRO_CC
-#include 
+#include 
 #endif
 #include 
 #include 
diff -r 78bf55f23338 -r 845c8eb5ac49 src/base/stats/mysql.hh
--- a/src/base/stats/mysql.hh   Fri Apr 15 10:44:06 2011 -0700
+++ b/src/base/stats/mysql.hh   Fri Apr 15 10:44:14 2011 -0700
@@ -31,6 +31,8 @@
 #ifndef __BASE_STATS_MYSQL_HH__
 #define __BASE_STATS_MYSQL_HH__
 
+#include 
+#include 
 #include 
 #include 
 
@@ -40,7 +42,8 @@
 namespace MySQL { class Connection; }
 namespace Stats {
 
-class DistInfo;
+class DistData;
+class DistParams;
 class MySqlRun;
 
 struct SetupStat
@@ -70,9 +73,9 @@
 {
   private:
 char *query;
-size_type size;
+std::size_t size;
 bool first;
-static const size_type maxsize = 1024*1024;
+static const std::size_t maxsize = 1024*1024;
 
   public:
 MySqlRun *run;
diff -r 78bf55f23338 -r 845c8eb5ac49 src/base/stats/text.cc
--- a/src/base/stats/text.ccFri Apr 15 10:44:06 2011 -0700
+++ b/src/base/stats/text.ccFri Apr 15 10:44:14 2011 -0700
@@ -33,12 +33,12 @@
 #endif
 
 #if defined(__sun)
-#include 
+#include 
 #endif
 
 #include 
 #ifdef __SUNPRO_CC
-#include 
+#include 
 #endif
 #include 
 #include 
diff -r 78bf55f23338 -r 845c8eb5ac49 src/base/stats/visit.hh
--- a/src/base/stats/visit.hh   Fri Apr 15 10:44:06 2011 -0700
+++ b/src/base/stats/visit.hh   Fri Apr 15 10:44:14 2011 -0700
@@ -37,7 +37,6 @@
 class ScalarInfo;
 class VectorInfo;
 class DistInfo;
-class DistInfo;
 class VectorDistInfo;
 class Vector2dInfo;
 class FormulaInfo;
diff -r 78bf55f23338 -r 845c8eb5ac49 src/cpu/o3/commit.hh
--- a/src/cpu/o3/commit.hh  Fri Apr 15 10:44:06 2011 -0700
+++ b/src/cpu/o3/commit.hh  Fri Apr 15 10:44:14 2011 -0700
@@ -44,6 +44,8 @@
 #ifndef __CPU_O3_COMMIT_HH__
 #define __CPU_O3_COMMIT_HH__
 
+#include 
+
 #include "base/statistics.hh"
 #include "cpu/exetrace.hh"
 #include "cpu/inst_seq.hh"
diff -r 78bf55f23338 -r 845c8eb5ac49 src/cpu/o3/commit_impl.hh
--- a/src/cpu/o3/commit_impl.hh Fri Apr 15 10:44:06 2011 -0700
+++ b/src/cpu/o3/commit_impl.hh Fri Apr 15 10:44:14 2011 -0700
@@ -55,6 +55,7 @@
 #include "cpu/exetrace.hh"
 #include "cpu/timebuf.hh"
 #include "params/DerivO3CPU.hh"
+#include "sim/faults.hh"
 
 #if USE_CHECKER
 #include "cpu/checker/cpu.hh"
diff -r 78bf55f23338 -r 845c8eb5ac49 src/cpu/o3/decode_impl.hh
--- a/src/cpu/o3/decode_impl.hh Fri Apr 15 10:44:06 2011 -0700
+++ b/src/cpu/o3/decode_impl.hh Fri Apr 15 10:44:14 2011 -0700
@@ -28,8 +28,12 @@
  * Authors: Kevin Lim
  */
 
+#include "arch/types.hh"
+#include "base/trace.hh"
+#include "config/full_system.hh"
 #include "config/the_isa.hh"
 #include "cpu/o3/decode.hh"
+#include "cpu/inst_seq.hh"
 #include "params/DerivO3CPU.hh"
 
 using namespace std;
diff -r 78bf55f23338 -r 845c8eb5ac49 src/cpu/o3/iew.hh
--- a/src/cpu/o3/iew.hh Fri Apr 15 10:44:06 2011 -0700
+++ b/src/cpu/o3/iew.hh Fri Apr 15 10:44:14 2011 -0700
@@ -44,6 +44,7 @@
 #define __CPU_O3_IEW_HH__
 
 #include 
+#include 
 
 #include "base/statistics.hh"
 #include "config/full_system.hh"
diff -r 78bf55f23338 -r 845c8eb5ac49 src/cpu/o3/iew_impl.hh
--- a/src/cpu/o3/iew_impl.hhFri Apr 15 10:44:06 2011 -0700
+++ b/src/cpu/o3/iew_impl.hhFri Apr 15 10:44:14 2011 -0700
@@ -46,6 +46,7 @@
 
 #include 
 
+#include "arch/utility.hh"
 #include "config/the_isa.hh"
 #include "cpu/o3/fu_pool.hh"
 #include "cpu/o3/iew.hh"
diff -r 78bf55f23338 -r 845c8eb5ac49 src/cpu/o3/lsq_unit.hh
--- a/src/cpu/o3/lsq_unit.hhFri Apr 15 10:44:06 2011 -0700

[m5-dev] changeset in m5: style: move style verifiers into classes

2011-04-15 Thread Nathan Binkert
changeset f3aaa2470b5a in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=f3aaa2470b5a
description:
style: move style verifiers into classes

diffstat:

 util/style.py |  250 -
 1 files changed, 139 insertions(+), 111 deletions(-)

diffs (truncated from 337 to 300 lines):

diff -r bca419132437 -r f3aaa2470b5a util/style.py
--- a/util/style.py Fri Apr 15 10:43:30 2011 -0700
+++ b/util/style.py Fri Apr 15 10:43:47 2011 -0700
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 # Copyright (c) 2006 The Regents of The University of Michigan
-# Copyright (c) 2007 The Hewlett-Packard Development Company
+# Copyright (c) 2007,2011 The Hewlett-Packard Development Company
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -28,23 +28,59 @@
 #
 # Authors: Nathan Binkert
 
+import heapq
+import os
 import re
-import os
 import sys
 
-sys.path.insert(0, os.path.dirname(__file__))
+from os.path import dirname, join as joinpath
+from itertools import count
+from mercurial import bdiff, mdiff
 
+current_dir = dirname(__file__)
+sys.path.insert(0, current_dir)
+sys.path.insert(1, joinpath(dirname(current_dir), 'src', 'python'))
+
+from m5.util import neg_inf, pos_inf, Region, Regions
 from file_types import lang_type
 
+all_regions = Region(neg_inf, pos_inf)
+
 tabsize = 8
 lead = re.compile(r'^([ \t]+)')
 trail = re.compile(r'([ \t]+)$')
 any_control = re.compile(r'\b(if|while|for)[ \t]*[(]')
 good_control = re.compile(r'\b(if|while|for) [(]')
 
-whitespace_types = set(('C', 'C++', 'swig', 'python', 'asm', 'isa', 'scons'))
 format_types = set(('C', 'C++'))
 
+def modified_regions(old_data, new_data):
+regions = Regions()
+beg = None
+for pbeg, pend, fbeg, fend in bdiff.blocks(old_data, new_data):
+if beg is not None and beg != fbeg:
+regions.append(beg, fbeg)
+beg = fend
+return regions
+
+def modregions(wctx, fname):
+fctx = wctx.filectx(fname)
+pctx = fctx.parents()
+
+file_data = fctx.data()
+lines = mdiff.splitnewlines(file_data)
+if len(pctx) in (1, 2):
+mod_regions = modified_regions(pctx[0].data(), file_data)
+if len(pctx) == 2:
+m2 = modified_regions(pctx[1].data(), file_data)
+# only the lines that are new in both
+mod_regions &= m2
+else:
+mod_regions = Regions()
+mod_regions.add(0, len(lines))
+
+return mod_regions
+
 class UserInterface(object):
 def __init__(self, verbose=False, auto=False):
 self.auto = auto
@@ -77,67 +113,106 @@
 def write(self, string):
 sys.stdout.write(string)
 
-def checkwhite_line(line):
-match = lead.search(line)
-if match and match.group(1).find('\t') != -1:
-return False
+class Region(object):
+def __init__(self, asdf):
+self.regions = Foo
 
-match = trail.search(line)
-if match:
-return False
+class Verifier(object):
+def __init__(self, ui, repo=None):
+self.ui = ui
+self.repo = repo
+if repo is None:
+self.wctx = None
 
-return True
+def __getattr__(self, attr):
+if attr in ('prompt', 'write'):
+return getattr(self.ui, attr)
 
-def checkwhite(filename):
-if lang_type(filename) not in whitespace_types:
-return
+if attr == 'wctx':
+try:
+wctx = repo.workingctx()
+except:
+from mercurial import context
+wctx = context.workingctx(repo)
+self.wctx = wctx
+return wctx
 
-try:
-f = file(filename, 'r+')
-except OSError, msg:
-print 'could not open file %s: %s' % (filename, msg)
-return
+raise AttributeError
 
-for num,line in enumerate(f):
-if not checkwhite_line(line):
-yield line,num + 1
+def open(self, filename, mode):
+if self.repo:
+filename = self.repo.wjoin(filename)
 
-def fixwhite_line(line):
-if lead.search(line):
-newline = ''
-for i,c in enumerate(line):
-if c == ' ':
-newline += ' '
-elif c == '\t':
-newline += ' ' * (tabsize - len(newline) % tabsize)
-else:
-newline += line[i:]
-break
+try:
+f = file(filename, mode)
+except OSError, msg:
+print 'could not open file %s: %s' % (filename, msg)
+return None
 
-line = newline
+return f
 
-return line.rstrip() + '\n'
+def skip(self, filename):
+return lang_type(filename) not in self.languages
 
-def fixwhite(filename, fixonly=None):
-if lang_type(filename) not in whitespace_types:
-return
+def check(self, filename, regions=all_regions):
+f = self.open(filename, 'r')
 
-try:
-f = file(filename, 'r+')
- 

[m5-dev] changeset in m5: style: add sort_includes to the style hook

2011-04-15 Thread Nathan Binkert
changeset 59d3bfa85f16 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=59d3bfa85f16
description:
style: add sort_includes to the style hook

diffstat:

 util/style.py |  83 +++---
 1 files changed, 72 insertions(+), 11 deletions(-)

diffs (128 lines):

diff -r f3aaa2470b5a -r 59d3bfa85f16 util/style.py
--- a/util/style.py Fri Apr 15 10:43:47 2011 -0700
+++ b/util/style.py Fri Apr 15 10:43:51 2011 -0700
@@ -42,6 +42,7 @@
 sys.path.insert(1, joinpath(dirname(current_dir), 'src', 'python'))
 
 from m5.util import neg_inf, pos_inf, Region, Regions
+import sort_includes
 from file_types import lang_type
 
 all_regions = Region(neg_inf, pos_inf)
@@ -184,6 +185,15 @@
 f.write(line)
 f.close()
 
+def apply(self, filename, prompt, regions=all_regions):
+if not self.skip(filename):
+errors = self.check(filename, regions)
+if errors:
+if prompt(filename, self.fix, regions):
+return True
+return False
+
+
 class Whitespace(Verifier):
 languages = set(('C', 'C++', 'swig', 'python', 'asm', 'isa', 'scons'))
 test_name = 'whitespace'
@@ -214,6 +224,53 @@
 
 return line.rstrip() + '\n'
 
+class SortedIncludes(Verifier):
+languages = sort_includes.default_languages
+def __init__(self, *args, **kwargs):
+super(SortedIncludes, self).__init__(*args, **kwargs)
+self.sort_includes = sort_includes.SortIncludes()
+
+def check(self, filename, regions=all_regions):
+f = self.open(filename, 'r')
+
+lines = [ l.rstrip('\n') for l in f.xreadlines() ]
+old = ''.join(line + '\n' for line in lines)
+f.close()
+
+language = lang_type(filename, lines[0])
+sort_lines = list(self.sort_includes(lines, filename, language))
+new = ''.join(line + '\n' for line in sort_lines)
+
+mod = modified_regions(old, new)
+modified = mod & regions
+print mod, regions, modified
+
+if modified:
+self.write("invalid sorting of includes\n")
+if self.ui.verbose:
+for start, end in modified.regions:
+self.write("bad region [%d, %d)\n" % (start, end))
+return 1
+
+return 0
+
+def fix(self, filename, regions=all_regions):
+f = self.open(filename, 'r+')
+
+old = f.readlines()
+lines = [ l.rstrip('\n') for l in old ]
+language = lang_type(filename, lines[0])
+sort_lines = list(self.sort_includes(lines, filename, language))
+new = ''.join(line + '\n' for line in sort_lines)
+
+f.seek(0)
+f.truncate()
+
+for i,line in enumerate(sort_lines):
+f.write(line)
+f.write('\n')
+f.close()
+
 def linelen(line):
 tabs = line.count('\t')
 if not tabs:
@@ -343,15 +400,16 @@
 modified, added, removed, deleted, unknown, ignore, clean = repo.status()
 
 whitespace = Whitespace(ui)
+sorted_includes = SortedIncludes(ui)
 for fname in added:
-if skip(fname) or whitespace.skip(fname):
+if skip(fname):
 continue
 
-errors = whitespace.check(fname)
-if errors:
-print errors
-if prompt(fname, whitespace.fix):
-return True
+if whitespace.apply(fname, prompt):
+return True
+
+if sorted_includes.apply(fname, prompt):
+return True
 
 try:
 wctx = repo.workingctx()
@@ -360,15 +418,18 @@
 wctx = context.workingctx(repo)
 
 for fname in modified:
-if skip(fname) or whitespace.skip(fname):
+if skip(fname):
 continue
 
 regions = modregions(wctx, fname)
 
-errors = whitespace.check(fname, regions)
-if errors:
-if prompt(fname, whitespace.fix, regions):
-return True
+if whitespace.apply(fname, prompt, regions):
+return True
+
+if sorted_includes.apply(fname, prompt, regions):
+return True
+
+return False
 
 def do_check_format(hgui, repo, **args):
 ui = MercurialUI(hgui, hgui.verbose, auto)
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


[m5-dev] changeset in m5: style: add a user interface wrapper class

2011-04-15 Thread Nathan Binkert
changeset bca419132437 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=bca419132437
description:
style: add a user interface wrapper class
makes things work both with mercurial and stand alone with stdio

diffstat:

 util/style.py |  60 +++---
 1 files changed, 44 insertions(+), 16 deletions(-)

diffs (102 lines):

diff -r ae1182b73fdb -r bca419132437 util/style.py
--- a/util/style.py Fri Apr 15 10:43:06 2011 -0700
+++ b/util/style.py Fri Apr 15 10:43:30 2011 -0700
@@ -45,6 +45,38 @@
 whitespace_types = set(('C', 'C++', 'swig', 'python', 'asm', 'isa', 'scons'))
 format_types = set(('C', 'C++'))
 
+class UserInterface(object):
+def __init__(self, verbose=False, auto=False):
+self.auto = auto
+self.verbose = verbose
+
+def prompt(self, prompt, results, default):
+if self.auto:
+return self.auto
+
+while True:
+result = self.do_prompt(prompt, results, default)
+if result in results:
+return result
+
+class MercurialUI(UserInterface):
+def __init__(self, ui, *args, **kwargs):
+super(MercurialUI, self).__init__(*args, **kwargs)
+self.ui = ui
+
+def do_prompt(self, prompt, results, default):
+return self.ui.prompt(prompt, default=default)
+
+def write(self, string):
+self.ui.write(string)
+
+class StdioUI(UserInterface):
+def do_prompt(self, prompt, results, default):
+return raw_input(prompt) or default
+
+def write(self, string):
+sys.stdout.write(string)
+
 def checkwhite_line(line):
 match = lead.search(line)
 if match and match.group(1).find('\t') != -1:
@@ -225,10 +257,15 @@
 break
 return modified
 
-def do_check_style(ui, repo, *files, **args):
+def do_check_style(hgui, repo, *files, **args):
 """check files for proper m5 style guidelines"""
 from mercurial import mdiff, util
 
+auto = args.get('auto', False)
+if auto:
+auto = 'f'
+ui = MercurialUI(hgui, hgui.verbose, auto)
+
 if files:
 files = frozenset(files)
 
@@ -236,14 +273,7 @@
 return files and name in files
 
 def prompt(name, func, fixonly=None):
-if args.get('auto', False):
-result = 'f'
-else:
-while True:
-result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", default='a')
-if result in 'aif':
-break
-
+result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", 'aif', 'a')
 if result == 'a':
 return True
 elif result == 'f':
@@ -312,7 +342,9 @@
 if prompt(fname, fixwhite, fixonly):
 return True
 
-def do_check_format(ui, repo, **args):
+def do_check_format(hgui, repo, **args):
+ui = MercurialUI(hgui, hgui.verbose, auto)
+
 modified, added, removed, deleted, unknown, ignore, clean = repo.status()
 
 verbose = 0
@@ -323,13 +355,9 @@
 if stats:
 stats.dump()
 result = ui.prompt("invalid formatting\n(i)gnore or (a)bort?",
-   "^[ia]$", "a")
-if result.startswith('i'):
-pass
-elif result.startswith('a'):
+   'ai', 'a')
+if result == 'a':
 return True
-else:
-raise util.Abort(_("Invalid response: '%s'") % result)
 
 return False
 
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


[m5-dev] changeset in m5: util: python implementation of a routine that w...

2011-04-15 Thread Nathan Binkert
changeset ae1182b73fdb in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=ae1182b73fdb
description:
util: python implementation of a routine that will sort includes
I didn't realize that the perl version existed when I started this,
this version has a lot more features than the previous one since it will
sort and separate python, system, and m5 headers in separate groups, it
will remove duplicates, it will also convert c headers to stl headers

diffstat:

 util/file_types.py|   82 ++
 util/sort-includes|   91 
 util/sort_includes.py |  220 ++
 3 files changed, 302 insertions(+), 91 deletions(-)

diffs (truncated from 408 to 300 lines):

diff -r 75527411e636 -r ae1182b73fdb util/file_types.py
--- a/util/file_types.pyFri Apr 15 10:42:32 2011 -0700
+++ b/util/file_types.pyFri Apr 15 10:43:06 2011 -0700
@@ -87,3 +87,85 @@
 
 # sorry, we couldn't detect the language
 return None
+
+# directories and files to ignore by default
+default_dir_ignore = frozenset(('.hg', '.svn', 'build', 'ext'))
+default_file_ignore = frozenset(('parsetab.py', ))
+
+def find_files(base, languages=all_languages,
+   dir_ignore=default_dir_ignore,
+   file_ignore=default_file_ignore):
+'''find all files in a directory and its subdirectories based on a
+set of languages, ignore directories specified in dir_ignore and
+files specified in file_ignore'''
+if base[-1] != '/':
+base += '/'
+
+def update_dirs(dirs):
+'''strip the ignored directories out of the provided list'''
+index = len(dirs) - 1
+for i,d in enumerate(reversed(dirs)):
+if d in dir_ignore:
+del dirs[index - i]
+
+# walk over base
+for root,dirs,files in os.walk(base):
+root = root.replace(base, '', 1)
+
+# strip ignored directories from the list
+update_dirs(dirs)
+
+for filename in files:
+if filename in file_ignore:
+# skip ignored files
+continue
+
+# try to figure out the language of the specified file
+fullpath = os.path.join(base, root, filename)
+language = lang_type(fullpath)
+
+# if the file is one of the langauges that we want return
+# its name and the language
+if language in languages:
+yield fullpath, language
+
+def update_file(dst, src, language, mutator):
+'''update a file of the specified language with the provided
+mutator generator.  If inplace is provided, update the file in
+place and return the handle to the updated file.  If inplace is
+false, write the updated file to cStringIO'''
+
+# if the source and destination are the same, we're updating in place
+inplace = dst == src
+
+if isinstance(src, str):
+# if a filename was provided, open the file
+mode = 'r+' if inplace else 'r'
+src = file(src, mode)
+
+orig_lines = []
+
+# grab all of the lines of the file and strip them of their line ending
+old_lines = list(line.rstrip('\r\n') for line in src.xreadlines())
+new_lines = list(mutator(old_lines, src.name, language))
+
+for line in src.xreadlines():
+line = line
+
+if inplace:
+# if we're updating in place and the file hasn't changed, do nothing
+if old_lines == new_lines:
+return
+
+# otherwise, truncate the file and seek to the beginning.
+dst = src
+dst.truncate(0)
+dst.seek(0)
+elif isinstance(dst, str):
+# if we're not updating in place and a destination file name
+# was provided, create a file object
+dst = file(dst, 'w')
+
+for line in new_lines:
+dst.write(line)
+dst.write('\n')
diff -r 75527411e636 -r ae1182b73fdb util/sort-includes
--- a/util/sort-includesFri Apr 15 10:42:32 2011 -0700
+++ /dev/null   Thu Jan 01 00:00:00 1970 +
@@ -1,91 +0,0 @@
-#! /usr/bin/env perl
-# Copyright (c) 2003 The Regents of The University of Michigan
-# 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 CONTRIBUT

[m5-dev] changeset in m5: region: add a utility class for keeping track o...

2011-04-15 Thread Nathan Binkert
changeset 75527411e636 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=75527411e636
description:
region: add a utility class for keeping track of regions of some range

This is basically like the range_map stuff in src/base (range already
exists in Python).  This code is like a set of ranges.  I'm using it
to keep track of changed lines in source code, but it could be use to
keep track of memory ranges and holes in memory regions.  It could
also be used in memory allocation type stuff.  (Though it's not at all
optimized.)

diffstat:

 src/python/SConscript  |1 +
 src/python/m5/util/__init__.py |1 +
 src/python/m5/util/region.py   |  279 +
 3 files changed, 281 insertions(+), 0 deletions(-)

diffs (truncated from 305 to 300 lines):

diff -r 394cb2dc3f7c -r 75527411e636 src/python/SConscript
--- a/src/python/SConscript Fri Apr 15 10:38:02 2011 -0700
+++ b/src/python/SConscript Fri Apr 15 10:42:32 2011 -0700
@@ -58,6 +58,7 @@
 PySource('m5.util', 'm5/util/jobfile.py')
 PySource('m5.util', 'm5/util/multidict.py')
 PySource('m5.util', 'm5/util/orderdict.py')
+PySource('m5.util', 'm5/util/region.py')
 PySource('m5.util', 'm5/util/smartdict.py')
 PySource('m5.util', 'm5/util/sorteddict.py')
 PySource('m5.util', 'm5/util/terminal.py')
diff -r 394cb2dc3f7c -r 75527411e636 src/python/m5/util/__init__.py
--- a/src/python/m5/util/__init__.pyFri Apr 15 10:38:02 2011 -0700
+++ b/src/python/m5/util/__init__.pyFri Apr 15 10:42:32 2011 -0700
@@ -40,6 +40,7 @@
 from orderdict import orderdict
 from smartdict import SmartDict
 from sorteddict import SortedDict
+from region import neg_inf, pos_inf, Region, Regions
 
 # define this here so we can use it right away if necessary
 def errorURL(prefix, s):
diff -r 394cb2dc3f7c -r 75527411e636 src/python/m5/util/region.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/src/python/m5/util/region.py  Fri Apr 15 10:42:32 2011 -0700
@@ -0,0 +1,279 @@
+# Copyright (c) 2006 Nathan Binkert 
+# 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.
+
+class _neg_inf(object):
+'''This object always compares less than any other object'''
+def __repr__(self): return ''
+def __lt__(self, other): return type(self) != type(other)
+def __le__(self, other): return True
+def __gt__(self, other): return False
+def __ge__(self, other): return type(self) == type(other)
+def __eq__(self, other): return type(self) == type(other)
+def __ne__(self, other): return type(self) != type(other)
+neg_inf = _neg_inf()
+
+class _pos_inf(object):
+'''This object always compares greater than any other object'''
+def __repr__(self): return ''
+def __lt__(self, other): return False
+def __le__(self, other): return type(self) == type(other)
+def __gt__(self, other): return type(self) != type(other)
+def __ge__(self, other): return True
+def __eq__(self, other): return type(self) == type(other)
+def __ne__(self, other): return type(self) != type(other)
+pos_inf = _pos_inf()
+
+class Region(tuple):
+'''A region (range) of [start, end).
+This includes utility functions to compare overlap of regions.'''
+def __new__(cls, *args):
+if len(args) == 1:
+arg = args[0]
+if isinstance(arg, Region):
+return arg
+args = tuple(arg)
+
+if len(args) != 2:
+raise AttributeError, \
+"Only one 

[m5-dev] changeset in m5: SortedDict: add functions for getting ranges of...

2011-04-15 Thread Nathan Binkert
changeset 394cb2dc3f7c in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=394cb2dc3f7c
description:
SortedDict: add functions for getting ranges of keys, values, items

diffstat:

 src/python/m5/util/sorteddict.py |  61 
 1 files changed, 61 insertions(+), 0 deletions(-)

diffs (89 lines):

diff -r 95fe5c720cfa -r 394cb2dc3f7c src/python/m5/util/sorteddict.py
--- a/src/python/m5/util/sorteddict.py  Fri Apr 15 10:37:28 2011 -0700
+++ b/src/python/m5/util/sorteddict.py  Fri Apr 15 10:38:02 2011 -0700
@@ -24,6 +24,8 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from bisect import bisect_left, bisect_right
+
 class SortedDict(dict):
 def _get_sorted(self):
 return getattr(self, '_sorted', sorted)
@@ -41,6 +43,42 @@
 self._sorted_keys = _sorted_keys
 return _sorted_keys
 
+def _left_eq(self, key):
+index = self._left_ge(self, key)
+if self._keys[index] != key:
+raise KeyError(key)
+return index
+
+def _right_eq(self, key):
+index = self._right_le(self, key)
+if self._keys[index] != key:
+raise KeyError(key)
+return index
+
+def _right_lt(self, key):
+index = bisect_left(self._keys, key)
+if index:
+return index - 1
+raise KeyError(key)
+
+def _right_le(self, key):
+index = bisect_right(self._keys, key)
+if index:
+return index - 1
+raise KeyError(key)
+
+def _left_gt(self, key):
+index = bisect_right(self._keys, key)
+if index != len(self._keys):
+return index
+raise KeyError(key)
+
+def _left_ge(self, key):
+index = bisect_left(self._keys, key)
+if index != len(self._keys):
+return index
+raise KeyError(key)
+
 def _del_keys(self):
 try:
 del self._sorted_keys
@@ -86,6 +124,26 @@
 for k in self._keys:
 yield k, self[k]
 
+def keyrange(self, start=None, end=None, inclusive=False):
+if start is not None:
+start = self._left_ge(start)
+
+if end is not None:
+if inclusive:
+end = self._right_le(end)
+else:
+end = self._right_lt(end)
+
+return iter(self._keys[start:end+1])
+
+def valuerange(self, *args, **kwargs):
+for k in self.keyrange(*args, **kwargs):
+yield self[k]
+
+def itemrange(self, *args, **kwargs):
+for k in self.keyrange(*args, **kwargs):
+yield k, self[k]
+
 def update(self, *args, **kwargs):
 dict.update(self, *args, **kwargs)
 self._del_keys()
@@ -157,3 +215,6 @@
 print `d`
 
 print d.copy()
+
+for k,v in d.itemrange('d', 'z', inclusive=True):
+print k,v
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


[m5-dev] changeset in m5: python: figure out if the m5.internal package e...

2011-04-15 Thread Nathan Binkert
changeset 95fe5c720cfa in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=95fe5c720cfa
description:
python: figure out if the m5.internal package exists even with 
demandimport

diffstat:

 src/python/m5/__init__.py |  7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r 8b5f900233ee -r 95fe5c720cfa src/python/m5/__init__.py
--- a/src/python/m5/__init__.py Wed Apr 13 09:32:19 2011 -0700
+++ b/src/python/m5/__init__.py Fri Apr 15 10:37:28 2011 -0700
@@ -31,8 +31,13 @@
 # scripts while allowing new SCons code to operate properly.
 
 try:
-import internal
+# Try to import something that's generated by swig
+import internal.core
+
+# Try to grab something from it in case demandimport is being used
+internal.core.__package__
 except ImportError:
+# The import failed
 internal = None
 
 if internal:
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Ruby patch touching classic memory system

2011-04-15 Thread Steve Reinhardt
Thanks for the heads up... I've been kind of swamped and am way behind
on code reviews.  I just took a look and I will have some comments for
you :-).

Steve

On Thu, Apr 14, 2011 at 9:30 AM, Nilay Vaish  wrote:
> Ali, Nate, Steve
>
> Can you go through this patch? I have made some changes to src/mem/packet.hh
> and src/mem/packet.cc files.
>
> http://reviews.m5sim.org/r/611/
>
>
> Thanks
> Nilay
>
>
> On Thu, 14 Apr 2011, Nilay Vaish wrote:
>
>>
>>
>>> On 2011-04-13 13:43:26, Gabe Black wrote:

 Please fix these style issues, including the ones in this file I haven't
 explicitly pointed out. You should be using M5 style generally, but
 especially when your in M5 code. Also, please be sure to point this out to
 one of the classic memory system experts (Nate, Steve, or Ali) and get them
 to sign off. They might not see that this change touches outside of Ruby.
>>
>> Gabe, I made the changes that you had pointed.
>>
>>
>> - Nilay
>>
>>
>
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: ruby: dbg: use system ticks instead of cycles

2011-04-15 Thread Brad Beckmann

---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/635/#review1129
---

Ship it!


Just a few minor alignment requests.  Other than that, it looks good to me.


src/mem/slicc/symbols/StateMachine.py


Since you're already modifying this DPRINTFR, can you align all the lines 
to the open paranethesis?

Thanks



src/mem/slicc/symbols/StateMachine.py


align here please



src/mem/slicc/symbols/StateMachine.py


align here please


- Brad


On 2011-04-15 10:33:39, Korey Sewell wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/635/
> ---
> 
> (Updated 2011-04-15 10:33:39)
> 
> 
> Review request for Default, Ali Saidi, Gabe Black, Steve Reinhardt, and 
> Nathan Binkert.
> 
> 
> Summary
> ---
> 
> ruby: dbg: use system ticks instead of cycles
> It's easier to debug simulations (find the exact point to rerun a trace) when 
> the output is in
> the system ticks instead of the Ruby cycle time
> 
> 
> Diffs
> -
> 
>   src/mem/ruby/buffers/MessageBuffer.cc 54a65799e4c1 
>   src/mem/ruby/network/simple/PerfectSwitch.cc 54a65799e4c1 
>   src/mem/ruby/system/Sequencer.cc 54a65799e4c1 
>   src/mem/slicc/symbols/StateMachine.py 54a65799e4c1 
>   src/mem/slicc/symbols/Type.py 54a65799e4c1 
> 
> Diff: http://reviews.m5sim.org/r/635/diff
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Korey
> 
>

___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: ruby: dbg: use system ticks instead of cycles

2011-04-15 Thread Korey Sewell

---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/635/
---

(Updated 2011-04-15 10:33:39.285902)


Review request for Default, Ali Saidi, Gabe Black, Steve Reinhardt, and Nathan 
Binkert.


Summary
---

ruby: dbg: use system ticks instead of cycles
It's easier to debug simulations (find the exact point to rerun a trace) when 
the output is in
the system ticks instead of the Ruby cycle time


Diffs (updated)
-

  src/mem/ruby/buffers/MessageBuffer.cc 54a65799e4c1 
  src/mem/ruby/network/simple/PerfectSwitch.cc 54a65799e4c1 
  src/mem/ruby/system/Sequencer.cc 54a65799e4c1 
  src/mem/slicc/symbols/StateMachine.py 54a65799e4c1 
  src/mem/slicc/symbols/Type.py 54a65799e4c1 

Diff: http://reviews.m5sim.org/r/635/diff


Testing
---


Thanks,

Korey

___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: Ruby: Add support for functional accesses

2011-04-15 Thread Brad Beckmann


> On 2011-04-13 10:28:08, Brad Beckmann wrote:
> > src/mem/protocol/MESI_CMP_directory-L1cache.sm, line 141
> > 
> >
> > Why are you adding this function?  SLICC already generates a similar 
> > function: getPermission().
> > 
> > Overall, I hope/think we can add functional access support without 
> > requiring any more changes to the protocol specific .sm files beyond the 
> > changeset:   8086:bf0335d98250 that I checked in a couple months ago.
> 
> Nilay Vaish wrote:
> How would you use the function that is generated by SLICC inside the
> sm file? I am concerned about the visibility of the function.
> 
> Brad Beckmann wrote:
> You can certainly use a function that is generated by SLICC inside the sm 
> file.  The 'trigger' function is one such example.
> 
> However, I'm not clear why you need to do that?  Specifically, why do you 
> need to explicitly set the permissions in the getCacheEntry function?  I 
> beleive the controller's doTransition function already does that when a 
> transition successfully completes.
> 
> Nilay Vaish wrote:
> I checked the generated code. It seems that permissions are being
> set only for the cache entries and not for the directory entries.
> 
> Brad Beckmann wrote:
> Really?  You should see a call to set_permissions inside the 
> Directory_Transitions.cc file.  For example, when I compile the MOESI_hammer 
> protocol, I see the set_permission call on line 51 in 
> Directory_Transitions.cc.
> 
>
> 
> Nilay Vaish wrote:
> The permissions would be set for the probe filter entry and not for the
> directory entry. The directory entry pointer is not passed around like
> the cache entry or TBE pointer.

Doh!  Yep, that is a problem.  So what are the potential solutions:

1. Inside the setState functions for the DirectoryControllers, we also call 
set_permission.  This would require us to expose set_permissions to SLICC 
similar to how trigger is exposed to SLICC.  Certainly possilbe, but not ideal. 
 Especially because it will require directory controllers and cache controllers 
to have different functionality in their setState functions.
2. Instead of allowing an entry's state to be directly assigned in the setState 
functions, make the state variable private, thus requiring a public funciton to 
modify state.  When SLICC generates the implementation of that public function, 
have that function modify both the state and the permissions.
3. Remove the m_permission field in all entries and just rely on get_permission 
to return the current permissions for cache and directory entries.  I'm not 
sure how to do that unless we create an AbstractState class so that the state 
can be accessed by the Ruby side.  Do we want to make such a change?

If we can make it work, I would prefer the second solution.  What do you think? 
 Do you see other potential solutions?  If you agree that the second solution 
is best, do you want to take a crack at it or would you like me to?  Since it 
is my patch that is broken, I feel responsible to fix it.  However, I'm fine 
with you making the fix as well.


- Brad


---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/611/#review
---


On 2011-04-13 14:29:01, Nilay Vaish wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/611/
> ---
> 
> (Updated 2011-04-13 14:29:01)
> 
> 
> Review request for Default.
> 
> 
> Summary
> ---
> 
> Ruby: Add support for functional accesses
> This patch is meant for implementing functional access support in Ruby.
> Currently, the patch does not functional accesses for the PioPort.
> 
> 
> Diffs
> -
> 
>   configs/example/ruby_mem_test.py 8b5f900233ee 
>   configs/ruby/MESI_CMP_directory.py 8b5f900233ee 
>   configs/ruby/Ruby.py 8b5f900233ee 
>   src/cpu/testers/memtest/memtest.cc 8b5f900233ee 
>   src/mem/packet.hh 8b5f900233ee 
>   src/mem/packet.cc 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-L1cache.sm 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-L2cache.sm 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-dir.sm 8b5f900233ee 
>   src/mem/protocol/RubySlicc_Types.sm 8b5f900233ee 
>   src/mem/ruby/network/Network.cc 8b5f900233ee 
>   src/mem/ruby/network/Network.py 8b5f900233ee 
>   src/mem/ruby/profiler/Profiler.cc 8b5f900233ee 
>   src/mem/ruby/profiler/Profiler.py 8b5f900233ee 
>   src/mem/ruby/recorder/Tracer.cc 8b5f900233ee 
>   src/mem/ruby/recorder/Tracer.py 8b5f900233ee 
>   src/mem/ruby/system/AbstractMemory.hh PRE-CREATION 
>   src/mem/ruby/system/AbstractMemory.cc PRE-CREATION 
>   src/mem/ruby/system/AbstractMemory.py PRE-CREATION 
>   

Re: [m5-dev] Review Request: Ruby: Add support for functional accesses

2011-04-15 Thread Nilay Vaish


> On 2011-04-13 10:28:08, Brad Beckmann wrote:
> > src/mem/protocol/MESI_CMP_directory-L1cache.sm, line 141
> > 
> >
> > Why are you adding this function?  SLICC already generates a similar 
> > function: getPermission().
> > 
> > Overall, I hope/think we can add functional access support without 
> > requiring any more changes to the protocol specific .sm files beyond the 
> > changeset:   8086:bf0335d98250 that I checked in a couple months ago.
> 
> Nilay Vaish wrote:
> How would you use the function that is generated by SLICC inside the
> sm file? I am concerned about the visibility of the function.
> 
> Brad Beckmann wrote:
> You can certainly use a function that is generated by SLICC inside the sm 
> file.  The 'trigger' function is one such example.
> 
> However, I'm not clear why you need to do that?  Specifically, why do you 
> need to explicitly set the permissions in the getCacheEntry function?  I 
> beleive the controller's doTransition function already does that when a 
> transition successfully completes.
> 
> Nilay Vaish wrote:
> I checked the generated code. It seems that permissions are being
> set only for the cache entries and not for the directory entries.
> 
> Brad Beckmann wrote:
> Really?  You should see a call to set_permissions inside the 
> Directory_Transitions.cc file.  For example, when I compile the MOESI_hammer 
> protocol, I see the set_permission call on line 51 in 
> Directory_Transitions.cc.
> 
>

The permissions would be set for the probe filter entry and not for the
directory entry. The directory entry pointer is not passed around like
the cache entry or TBE pointer.


> On 2011-04-13 10:28:08, Brad Beckmann wrote:
> > src/mem/ruby/system/CacheMemory.cc, line 270
> > 
> >
> > Why are you commenting this line out?  If you think it is no longer 
> > needed, just remove it.  If we remove it, can we guarentee that the 
> > permission is initialized to some value?  For instance, do we know whether 
> > the "entry" constructor will allows initialize the value?
> 
> Nilay Vaish wrote:
> I expect the state to decide what the permission should be.
> 
> Brad Beckmann wrote:
> However, if we don't set the permission to some later time, say at the 
> end of a transition, what happens if we access the permission before then?

Fine, I will uncomment the line.


- Nilay


---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/611/#review
---


On 2011-04-13 14:29:01, Nilay Vaish wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/611/
> ---
> 
> (Updated 2011-04-13 14:29:01)
> 
> 
> Review request for Default.
> 
> 
> Summary
> ---
> 
> Ruby: Add support for functional accesses
> This patch is meant for implementing functional access support in Ruby.
> Currently, the patch does not functional accesses for the PioPort.
> 
> 
> Diffs
> -
> 
>   configs/example/ruby_mem_test.py 8b5f900233ee 
>   configs/ruby/MESI_CMP_directory.py 8b5f900233ee 
>   configs/ruby/Ruby.py 8b5f900233ee 
>   src/cpu/testers/memtest/memtest.cc 8b5f900233ee 
>   src/mem/packet.hh 8b5f900233ee 
>   src/mem/packet.cc 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-L1cache.sm 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-L2cache.sm 8b5f900233ee 
>   src/mem/protocol/MESI_CMP_directory-dir.sm 8b5f900233ee 
>   src/mem/protocol/RubySlicc_Types.sm 8b5f900233ee 
>   src/mem/ruby/network/Network.cc 8b5f900233ee 
>   src/mem/ruby/network/Network.py 8b5f900233ee 
>   src/mem/ruby/profiler/Profiler.cc 8b5f900233ee 
>   src/mem/ruby/profiler/Profiler.py 8b5f900233ee 
>   src/mem/ruby/recorder/Tracer.cc 8b5f900233ee 
>   src/mem/ruby/recorder/Tracer.py 8b5f900233ee 
>   src/mem/ruby/system/AbstractMemory.hh PRE-CREATION 
>   src/mem/ruby/system/AbstractMemory.cc PRE-CREATION 
>   src/mem/ruby/system/AbstractMemory.py PRE-CREATION 
>   src/mem/ruby/system/Cache.py 8b5f900233ee 
>   src/mem/ruby/system/CacheMemory.hh 8b5f900233ee 
>   src/mem/ruby/system/CacheMemory.cc 8b5f900233ee 
>   src/mem/ruby/system/DirectoryMemory.hh 8b5f900233ee 
>   src/mem/ruby/system/DirectoryMemory.cc 8b5f900233ee 
>   src/mem/ruby/system/DirectoryMemory.py 8b5f900233ee 
>   src/mem/ruby/system/RubyPort.hh 8b5f900233ee 
>   src/mem/ruby/system/RubyPort.cc 8b5f900233ee 
>   src/mem/ruby/system/RubySystem.py 8b5f900233ee 
>   src/mem/ruby/system/SConscript 8b5f900233ee 
>   src/mem/ruby/system/Sequencer.cc 8b5f900233ee 
>   src/mem/ruby/system/Sequencer.py 8b5f900233ee 
>   src/mem/ruby/system/System.hh 8b5f900233ee 
>   

[m5-dev] Cron /z/m5/regression/do-regression quick

2011-04-15 Thread Cron Daemon
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/linux/inorder-timing 
passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/linux/o3-timing passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/linux/simple-atomic passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/linux/simple-timing-ruby 
passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/linux/simple-timing passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/tru64/o3-timing passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/tru64/simple-atomic passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/tru64/simple-timing-ruby 
passed.
* build/ALPHA_SE/tests/fast/quick/00.hello/alpha/tru64/simple-timing passed.
* build/ALPHA_SE/tests/fast/quick/01.hello-2T-smt/alpha/linux/o3-timing 
passed.
* build/ALPHA_SE/tests/fast/quick/20.eio-short/alpha/eio/simple-atomic 
passed.
* build/ALPHA_SE/tests/fast/quick/20.eio-short/alpha/eio/simple-timing 
passed.
* build/ALPHA_SE/tests/fast/quick/30.eio-mp/alpha/eio/simple-atomic-mp 
passed.
* build/ALPHA_SE/tests/fast/quick/50.memtest/alpha/linux/memtest passed.
* build/ALPHA_SE/tests/fast/quick/50.memtest/alpha/linux/memtest-ruby 
passed.
* build/ALPHA_SE/tests/fast/quick/60.rubytest/alpha/linux/rubytest-ruby 
passed.
* 
build/ALPHA_SE_MOESI_hammer/tests/fast/quick/00.hello/alpha/linux/simple-timing-ruby-MOESI_hammer
 passed.
* build/ALPHA_SE/tests/fast/quick/30.eio-mp/alpha/eio/simple-timing-mp 
passed.
* 
build/ALPHA_SE_MOESI_hammer/tests/fast/quick/00.hello/alpha/tru64/simple-timing-ruby-MOESI_hammer
 passed.
* 
build/ALPHA_SE_MOESI_hammer/tests/fast/quick/50.memtest/alpha/linux/memtest-ruby-MOESI_hammer
 passed.
* 
build/ALPHA_SE_MOESI_hammer/tests/fast/quick/60.rubytest/alpha/linux/rubytest-ruby-MOESI_hammer
 passed.
* 
build/ALPHA_SE_MESI_CMP_directory/tests/fast/quick/00.hello/alpha/linux/simple-timing-ruby-MESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MESI_CMP_directory/tests/fast/quick/00.hello/alpha/tru64/simple-timing-ruby-MESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MESI_CMP_directory/tests/fast/quick/50.memtest/alpha/linux/memtest-ruby-MESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MESI_CMP_directory/tests/fast/quick/60.rubytest/alpha/linux/rubytest-ruby-MESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MOESI_CMP_directory/tests/fast/quick/00.hello/alpha/linux/simple-timing-ruby-MOESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MOESI_CMP_directory/tests/fast/quick/00.hello/alpha/tru64/simple-timing-ruby-MOESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MOESI_CMP_directory/tests/fast/quick/50.memtest/alpha/linux/memtest-ruby-MOESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MOESI_CMP_directory/tests/fast/quick/60.rubytest/alpha/linux/rubytest-ruby-MOESI_CMP_directory
 passed.
* 
build/ALPHA_SE_MOESI_CMP_token/tests/fast/quick/00.hello/alpha/linux/simple-timing-ruby-MOESI_CMP_token
 passed.
* 
build/ALPHA_SE_MOESI_CMP_token/tests/fast/quick/00.hello/alpha/tru64/simple-timing-ruby-MOESI_CMP_token
 passed.
* 
build/ALPHA_SE_MOESI_CMP_token/tests/fast/quick/50.memtest/alpha/linux/memtest-ruby-MOESI_CMP_token
 passed.
* 
build/ALPHA_SE_MOESI_CMP_token/tests/fast/quick/60.rubytest/alpha/linux/rubytest-ruby-MOESI_CMP_token
 passed.
* 
build/ALPHA_FS/tests/fast/quick/10.linux-boot/alpha/linux/tsunami-simple-atomic 
passed.
* 
build/ALPHA_FS/tests/fast/quick/10.linux-boot/alpha/linux/tsunami-simple-atomic-dual
 passed.
* 
build/ALPHA_FS/tests/fast/quick/10.linux-boot/alpha/linux/tsunami-simple-timing 
passed.
* 
build/ALPHA_FS/tests/fast/quick/10.linux-boot/alpha/linux/tsunami-simple-timing-dual
 passed.
* 
build/ALPHA_FS/tests/fast/quick/80.netperf-stream/alpha/linux/twosys-tsunami-simple-atomic
 passed.
* build/MIPS_SE/tests/fast/quick/00.hello/mips/linux/inorder-timing passed.
* build/MIPS_SE/tests/fast/quick/00.hello/mips/linux/o3-timing passed.
* build/MIPS_SE/tests/fast/quick/00.hello/mips/linux/simple-atomic passed.
* build/MIPS_SE/tests/fast/quick/00.hello/mips/linux/simple-timing passed.
* build/MIPS_SE/tests/fast/quick/00.hello/mips/linux/simple-timing-ruby 
passed.
* build/POWER_SE/tests/fast/quick/00.hello/power/linux/o3-timing passed.
* build/POWER_SE/tests/fast/quick/00.hello/power/linux/simple-atomic passed.
* build/SPARC_SE/tests/fast/quick/00.hello/sparc/linux/simple-atomic passed.
* build/SPARC_SE/tests/fast/quick/00.hello/sparc/linux/simple-timing passed.
* build/SPARC_SE/tests/fast/quick/00.hello/sparc/linux/simple-timing-ruby 
passed.
* build/SPARC_SE/tests/fast/quick/02.insttest/sparc/linux/simple-atomic 
passed.
* build/SPARC_SE/tests/fast/quick/02.insttest/sparc/linux/simple-timing 
passed.
* build/SPARC_SE/tests/fast/quick/02.insttest/sparc/linux/o3-timing passed.
* 
build/SPARC_SE/tests/fast/quick/40.m5threads-test-atomic/sparc/linux/o3-timing-mp
 passed.
* 
build/SPA