lib/origen/generator/job.rb in origen-0.7.22 vs lib/origen/generator/job.rb in origen-0.7.23
- old
+ new
@@ -1,10 +1,11 @@
module Origen
class Generator
# A job is responsible for executing a single pattern source
class Job # :nodoc: all
attr_accessor :output_file_body, :pattern
+ attr_reader :split_counter
def initialize(pattern, options)
@testing = options[:testing]
@options = options
@requested_pattern = pattern
@@ -18,10 +19,15 @@
def no_comments?
@no_comments
end
+ def inc_split_counter
+ @split_counter ||= 0
+ @split_counter += 1
+ end
+
def requested_pattern
@requested_pattern
end
alias_method :requested_file, :requested_pattern
@@ -43,11 +49,11 @@
return @output_pattern_filename if @output_pattern_filename
if !@pattern && !@output_file_body
fail 'Sorry the output_pattern is not available until the job has been run'
end
body = @output_file_body ? @output_file_body : File.basename(@pattern, '.rb')
- output_prefix + body + output_postfix + output_extension
+ output_prefix + body + output_postfix + split_number + output_extension
end
# This can be modified at runtime by the pattern generator in response to
# iterator substitutions
def output_pattern_filename=(val)
@@ -90,9 +96,17 @@
Origen.config.pattern_postfix ? '_' + Origen.config.pattern_postfix : ''
end
def output_extension
'.' + Origen.tester.pat_extension
+ end
+
+ def split_number
+ if split_counter
+ "_part#{split_counter}"
+ else
+ ''
+ end
end
def run
Origen.app.current_job = self
begin