summaryrefslogtreecommitdiff
path: root/src/mem/ruby/config/cfg.rb
diff options
context:
space:
mode:
authorDerek Hower <drh5@cs.wisc.edu>2009-08-05 14:20:32 -0500
committerDerek Hower <drh5@cs.wisc.edu>2009-08-05 14:20:32 -0500
commitfbf7391bb0aa3c32289abb8a1b1066267df7c705 (patch)
treee05f36245b08938be2c87c29ef97c8f349e02956 /src/mem/ruby/config/cfg.rb
parent1276df51e245c6e836d7e96c0df66a7b74b549c9 (diff)
downloadgem5-fbf7391bb0aa3c32289abb8a1b1066267df7c705.tar.xz
ruby: configuration supports multiple runs in same session
These changes allow to run Ruby-gems multiple times from the same ruby-lang script with different configurations
Diffstat (limited to 'src/mem/ruby/config/cfg.rb')
-rw-r--r--src/mem/ruby/config/cfg.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mem/ruby/config/cfg.rb b/src/mem/ruby/config/cfg.rb
index 82fbb64a5..ffc36dd67 100644
--- a/src/mem/ruby/config/cfg.rb
+++ b/src/mem/ruby/config/cfg.rb
@@ -150,6 +150,9 @@ class NetPort < LibRubyObject
def cppClassName
"NetPort"
end
+ def self.totalOfType(mach_type)
+ return @@type_cnt[mach_type]
+ end
end
class MemoryVector < LibRubyObject
@@ -190,6 +193,7 @@ end
class RubySystem
@@params = Hash.new
+ @@defaults = Hash.new
@@network = nil
def self.init(iface_ports, network)
@@ -197,6 +201,14 @@ class RubySystem
@@network = network
end
+ def self.reset()
+ @@iface_ports = nil
+ @@network = nil
+ @@params.each { |param_name, param|
+ param = @@defaults[param_name]
+ }
+ end
+
def self.default_param(param_name, type, default)
if default.is_a?(FalseClass) || default.is_a?(TrueClass)
assert type.is_a?(Boolean), "default value of param \"#{param_name}\" must be either true or false"
@@ -204,6 +216,7 @@ class RubySystem
assert default.is_a?(type), "default value of param \"#{param_name}\" does not match type #{type}"
end
@@params[param_name] = default
+ @@defaults[param_name] = default
method_name = (param_name.to_s).to_sym
instance_eval <<-EOS
def #{method_name.to_s}