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
96
97
98
99
100
101
# 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?
  if id == Origen.file_handler.current_file.basename('.rb').to_s && Origen.interface.try(:use_flow_name_for_top_level)
    p.filename = Origen.interface.flow_name
  else
    p.filename = filename
  end
  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



217
218
219
220
221
222
223
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 217

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

#flow_sheetsObject



191
192
193
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 191

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.



138
139
140
141
142
143
144
145
146
147
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 138

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



150
151
152
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 150

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.



119
120
121
122
123
124
125
126
127
128
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 119

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



131
132
133
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 131

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.



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

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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 197

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



187
188
189
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 187

def test_methods
  flow.test_methods
end

#test_suitesObject



183
184
185
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 183

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.



157
158
159
160
161
162
163
164
165
166
167
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 157

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



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

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.



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 104

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