lib/ruby-vpi.rb in ruby-vpi-20.0.0 vs lib/ruby-vpi.rb in ruby-vpi-21.0.0
- old
+ new
@@ -4,12 +4,12 @@
# See the file named LICENSE for details.
module RubyVPI
Project = {
:name => 'ruby-vpi',
- :version => '20.0.0',
- :release => '2008-01-27',
+ :version => '21.0.0',
+ :release => '2008-06-08',
:website => "http://ruby-vpi.rubyforge.org",
:home => File.expand_path(File.join(File.dirname(__FILE__), '..'))
}
Simulator = Struct.new(:id, :name, :compiler_args, :linker_args)
@@ -47,23 +47,31 @@
#
# aDesignHandleOrPath:: either a VPI handle or a path to an
# object in the Verilog simulation
#
def RubyVPI.load_test aDesignHandleOrPath, *aTestFilePaths
+ # access the design under test
design =
if aDesignHandleOrPath.is_a? VPI::Handle
aDesignHandleOrPath
else
VPI.vpi_handle_by_name(aDesignHandleOrPath.to_s, nil)
end
raise ArgumentError, "cannot access the design under test: #{aDesignHandleOrPath.inspect}" unless design
+ # create a sandbox
sandbox = Module.new
sandbox.const_set :DUT, design
+ sandboxBinding = sandbox.module_eval('binding')
+ # load files into sandbox
aTestFilePaths.flatten.compact.uniq.each do |path|
- sandbox.module_eval(File.read(path), path)
+ if HAVE_RUBY_19X
+ eval File.read(path), sandboxBinding, path
+ else
+ sandbox.module_eval File.read(path), path
+ end
end
sandbox
end
end