Module: OrigenTesters::SmartestBasedTester::Base::Generator

Extended by:
ActiveSupport::Concern
Defined in:
lib/origen_testers/smartest_based_tester/base/generator.rb

Instance Method Summary collapse

Instance Method Details

#_internal_startup(options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This will be called at the start of every Flow.create block, :top_level will be true when it is a top-level Flow.create block



24
25
26
27
28
29
30
31
32
33
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 24

def _internal_startup(options)
  if options[:top_level]
    if options.key?(:unique_test_names)
      self.unique_test_names = options[:unique_test_names]
    end
    flow.flow_name = options[:flow_name]
    flow.flow_bypass = options[:flow_bypass].nil? ? false : options[:flow_bypass]
    flow.flow_description = options[:flow_description] || OrigenTesters::Flow.flow_comments.join(' ')
  end
end

#add_tml(name, methods) ⇒ Object Also known as: add_test_method_library



35
36
37
38
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 35

def add_tml(name, methods)
  methods[:class_name] ||= name.to_s.camelize
  custom_tmls[name] = methods
end

#at_flow_endObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 53

def at_flow_end
  flow.at_flow_end
end

#at_flow_startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
45
46
47
48
49
50
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 42

def at_flow_start
  f = flow
  f.at_flow_start
  # Initialize this to the value currently set on the tester, any further setting of
  # this by the interface will override
  flow.add_flow_enable = tester.add_flow_enable
  self.unique_test_names = tester.unique_test_names
  @pattern_master_filename = nil
end

#at_run_startObject Also known as: reset_globals

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
61
62
63
64
65
66
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 58

def at_run_start
  flow.at_run_start
  @@flow_sheets = nil
  @@pattern_masters = nil
  @@pattern_compilers = nil
  @@variables_files = nil
  @@limits_workbook = nil
  limits_workbook if tester.smt8? && !generating_sub_program?
end

#flow(id = Origen.file_handler.current_file.basename('.rb').to_s) ⇒ Object

Returns the current flow object (Origen.interface.flow)



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 84

def flow(id = Origen.file_handler.current_file.basename('.rb').to_s)
  return @current_flow if @current_flow
  id = id.to_s.sub(/_resources?/, '')
  filename = id.split('.').last
  return flow_sheets[id] if flow_sheets[id] # will return flow if already existing
  p = platform::Flow.new
  p.inhibit_output if Origen.interface.resources_mode?
  p.filename = filename
  p.test_suites ||= platform::TestSuites.new(p)
  p.test_methods ||= platform::TestMethods.new(p)
  flow_sheets[id] = p
end

#flow_generatorsObject

Returns an array containing all flow sheet generators. All Origen program generators must implement this method



211
212
213
214
215
216
217
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 211

def flow_generators
  g = []
  flow_sheets.each do |_name, sheet|
    g << sheet
  end
  g
end

#flow_sheetsObject



185
186
187
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 185

def flow_sheets
  @@flow_sheets ||= {}.with_indifferent_access
end

#initialize(options = {}) ⇒ Object

This is just to give all interfaces an initialize that takes one argument. The super is important for cases where this module is included late via Testers::ProgramGenerators



16
17
18
19
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 16

def initialize(options = {})
  super
  @initialized = true
end

#pattern_compilerObject

Returns the pattern compiler file (.aiv) for the current flow, by default a common pattern compiler file called ‘global’ will be used for all flows. To use a different one set the resources_filename at the start of the flow.



132
133
134
135
136
137
138
139
140
141
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 132

def pattern_compiler
  pattern_compilers[pattern_master_filename] ||= begin
    m = platform::PatternCompiler.new(manually_register: true)
    name = "#{pattern_master_filename}.aiv"
    name = "#{Origen.config.program_prefix}_#{name}" if Origen.config.program_prefix
    m.filename = name
    m.id = pattern_master_filename
    m
  end
end

#pattern_compilersObject

Returns a hash containing all pattern compiler generators



144
145
146
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 144

def pattern_compilers
  @@pattern_compilers ||= {}
end

#pattern_masterObject

Returns the pattern master file (.pmfl) for the current flow, by default a common pattern master file called ‘global’ will be used for all flows. To use a different one set the resources_filename at the start of the flow.



113
114
115
116
117
118
119
120
121
122
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 113

def pattern_master
  pattern_masters[pattern_master_filename] ||= begin
    m = platform::PatternMaster.new(manually_register: true)
    name = "#{pattern_master_filename}.pmfl"
    name = "#{Origen.config.program_prefix}_#{name}" if Origen.config.program_prefix
    m.filename = name
    m.id = pattern_master_filename
    m
  end
end

#pattern_master_filenameObject



79
80
81
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 79

def pattern_master_filename
  @pattern_master_filename || 'global'
end

#pattern_master_filename=(name) ⇒ Object



75
76
77
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 75

def pattern_master_filename=(name)
  @pattern_master_filename = name
end

#pattern_mastersObject

Returns a hash containing all pattern master generators



125
126
127
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 125

def pattern_masters
  @@pattern_masters ||= {}
end

#pattern_reference_recorded(name, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



169
170
171
172
173
174
175
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 169

def pattern_reference_recorded(name, options = {})
  # Will be called everytime a pattern reference is made that the ATE should be aware of,
  # don't need to remember it as it can be fetched from all_pattern_references later, but
  # need to instantiate a pattern master and compiler to handle it later
  pattern_master
  pattern_compiler
end

#resources_filename=(name) ⇒ Object



69
70
71
72
73
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 69

def resources_filename=(name)
  self.pattern_master_filename = name
  self.pattern_references_name = name
  flow.var_filename = name
end

#sheet_generatorsObject

Returns an array containing all sheet generators. All Origen program generators must implement this method



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 191

def sheet_generators # :nodoc:
  g = []
  flow_sheets.each do |_name, sheet|
    g << sheet
  end
  pattern_masters.each do |name, sheet|
    g << sheet
  end
  pattern_compilers.each do |name, sheet|
    g << sheet
  end
  variables_files.each do |name, sheet|
    g << sheet
  end
  g << limits_workbook if tester.smt8? && !generating_sub_program?
  g
end

#test_methodsObject



181
182
183
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 181

def test_methods
  flow.test_methods
end

#test_suitesObject



177
178
179
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 177

def test_suites
  flow.test_suites
end

#variables_file(flw = nil) ⇒ Object

Returns the variables file for the current or given flow, by default a common variable file called ‘global’ will be used for all flows. To use a different one set the resources_filename at the start of the flow.



151
152
153
154
155
156
157
158
159
160
161
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 151

def variables_file(flw = nil)
  name = (flw || flow).var_filename
  variables_files[name] ||= begin
    m = platform::VariablesFile.new(manually_register: true)
    filename = "#{name}_vars.tf"
    filename = "#{Origen.config.program_prefix}_#{filename}" if Origen.config.program_prefix
    m.filename = filename
    m.id = name
    m
  end
end

#variables_filesObject

Returns a hash containing all variables file generators



164
165
166
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 164

def variables_files
  @@variables_files ||= {}
end

#with_flow(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 98

def with_flow(name)
  @flow_stack ||= []
  @current_flow = nil
  f = flow(name)
  @flow_stack << f
  @current_flow = @flow_stack.last
  yield
  @flow_stack.pop
  @current_flow = @flow_stack.last
  f
end