Command line option to print out List of SimObjects and their parameters
authorNathan Binkert <nate@binkert.org>
Sun, 15 Jun 2008 04:51:08 +0000 (21:51 -0700)
committerNathan Binkert <nate@binkert.org>
Sun, 15 Jun 2008 04:51:08 +0000 (21:51 -0700)
src/python/m5/main.py

index 4f28cf385b0e8f48b9834efb9368b372e988f817..dbabd9600f6c91fecc63127451d0516ef95e0cb2 100644 (file)
@@ -116,6 +116,11 @@ add_option("--trace-file", metavar="FILE", default="cout",
 add_option("--trace-ignore", metavar="EXPR", action='append', split=':',
     help="Ignore EXPR sim objects")
 
+# Help options
+set_group("Help Options")
+add_option("--list-sim-objects", action='store_true', default=False,
+    help="List all built-in SimObjects, their parameters and default values")
+
 def main():
     import defines
     import event
@@ -187,6 +192,27 @@ def main():
             print_list(traceflags.compoundFlagMap[flag], indent=8)
             print
 
+    if options.list_sim_objects:
+        import SimObject
+        done = True
+        print "SimObjects:"
+        objects = SimObject.allClasses.keys()
+        objects.sort()
+        for name in objects:
+            obj = SimObject.allClasses[name]
+            print "    %s" % obj
+            params = obj._params.keys()
+            params.sort()
+            for pname in params:
+                param = obj._params[pname]
+                default = getattr(param, 'default', '')
+                print "        %s" % pname
+                if default:
+                    print "            default: %s" % default
+                print "            desc: %s" % param.desc
+                print
+            print
+
     if done:
         sys.exit(0)