bin/generate.rb in ruby-vpi-19.0.0 vs bin/generate.rb in ruby-vpi-20.0.0
- old
+ new
@@ -1,6 +1,6 @@
-# Generates Ruby-VPI tests from Verilog 2001 and Verilog 95 module declarations.
+# Generates test skeletons from Verilog 2001/1995 module declarations.
#
# * The standard input stream is read if no input files are specified.
#
# = Progress indicators
#
@@ -30,11 +30,11 @@
$: << File.join(File.dirname(__FILE__), '..', 'lib')
require 'ruby-vpi' # for project info
require 'ruby-vpi/verilog_parser'
require 'fileutils'
-require 'digest/md5'
+require 'digest/sha1'
# Notify the user about some action being performed.
def notify *args # :nodoc:
printf "%8s %s\n", *args
@@ -42,12 +42,12 @@
# Writes the given contents to the file at the given path. If the given path
# already exists, then a backup is created before invoking the merging tool.
def write_file aPath, aContent # :nodoc:
if File.exist? aPath
- oldDigest = Digest::MD5.digest(File.read(aPath))
- newDigest = Digest::MD5.digest(aContent)
+ oldDigest = Digest::SHA1.digest(File.read(aPath))
+ newDigest = Digest::SHA1.digest(aContent)
if oldDigest == newDigest
notify :skip, aPath
else
notify :update, aPath
@@ -81,51 +81,55 @@
# Holds information about the output destinations of a parsed Verilog module.
class OutputInfo # :nodoc:
RUBY_EXT = '.rb'
VERILOG_EXT = '.v'
- RUNNER_EXT = '.rake'
+ RAKE_EXT = '.rake'
DESIGN_SUFFIX = '_design'
SPEC_SUFFIX = '_spec'
RUNNER_SUFFIX = '_runner'
PROTO_SUFFIX = '_proto'
+ LOADER_SUFFIX = '_loader'
SPEC_FORMATS = [:rSpec, :tSpec, :xUnit, :generic]
- attr_reader :designPath, :designName, :designClassName,
+ attr_reader :designPath, :designName,
:specPath, :specName, :specClassName, :specFormat,
:runnerPath, :runnerName,
- :protoPath, :protoName
+ :protoPath, :protoName,
+ :loaderPath, :loaderName
def initialize aModuleName, aSpecFormat
raise ArgumentError unless SPEC_FORMATS.include? aSpecFormat
- @specFormat = aSpecFormat
+ @specFormat = aSpecFormat
- @designName = aModuleName + DESIGN_SUFFIX
- @designPath = @designName + RUBY_EXT
+ @designName = aModuleName + DESIGN_SUFFIX
+ @designPath = @designName + RUBY_EXT
- @protoName = aModuleName + PROTO_SUFFIX
- @protoPath = @protoName + RUBY_EXT
+ @protoName = aModuleName + PROTO_SUFFIX
+ @protoPath = @protoName + RUBY_EXT
- @specName = aModuleName + SPEC_SUFFIX
- @specPath = @specName + RUBY_EXT
+ @specName = aModuleName + SPEC_SUFFIX
+ @specPath = @specName + RUBY_EXT
+ @specClassName = @specName.to_ruby_const_name
- @designClassName = aModuleName.to_ruby_const_name
- @specClassName = @specName.to_ruby_const_name
+ @runnerName = aModuleName + RUNNER_SUFFIX
+ @runnerPath = @runnerName + RAKE_EXT
- @runnerName = aModuleName + RUNNER_SUFFIX
- @runnerPath = @runnerName + RUNNER_EXT
+ @loaderName = aModuleName + LOADER_SUFFIX
+ @loaderPath = @loaderName + RUBY_EXT
end
end
# obtain templates for output generation
DESIGN_TEMPLATE = Template.new('design.rb')
PROTO_TEMPLATE = Template.new('proto.rb')
SPEC_TEMPLATE = Template.new('spec.rb')
RUNNER_TEMPLATE = Template.new('runner.rake')
+ LOADER_TEMPLATE = Template.new('loader.rb')
# parse command-line options
require 'optparse'
@@ -171,7 +175,8 @@
write_file o.runnerPath, RUNNER_TEMPLATE.result(binding)
write_file o.designPath, DESIGN_TEMPLATE.result(binding)
write_file o.protoPath, PROTO_TEMPLATE.result(binding)
write_file o.specPath, SPEC_TEMPLATE.result(binding)
+ write_file o.loaderPath, LOADER_TEMPLATE.result(binding)
write_file 'Rakefile', "require 'ruby-vpi/runner_proxy'"
end