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

Extended by:
ActiveSupport::Concern
Includes:
Interface
Included in:
V93K::Generator, V93K_SMT8::Generator
Defined in:
lib/origen_testers/smartest_based_tester/base/generator.rb

Instance Method Summary collapse

Methods included from Interface

#add_description!, #add_flow_enable, #add_flow_enable=, #add_meta!, #all_pattern_references, #app_identifier, #atp, #clean_referenced_patterns, #clear_pattern_references, #clear_top_level_flow, #close, #comment, #comments, #compile, #consume_comments, #context_changed?, #context_or_parameter_changed?, #descriptions, #discard_comments, #discard_top_level_flow, #flow_generator, #generating_sub_program?, #identity_map, #import, #merge_pattern_references, #on_program_completion, #parameter_changed?, #pattern_references, #pattern_references_name, #pattern_references_name=, #platform, #record_pattern_reference, #referenced_patterns, #render, #resources_mode, resources_mode?, #resources_mode?, #set_top_level_flow, #test, #top_level_flow, #unique_test_names, #unique_test_names=, with_resources_mode, write=, write?, #write?, #write_files

Methods included from ATP::FlowAPI

#atp, #atp=, #hi_limit, #limit, #lo_limit, #loop

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
# 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



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

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

#flow_sheetsObject



189
190
191
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 189

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.



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

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



148
149
150
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 148

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.



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

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



129
130
131
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 129

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.



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

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



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

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



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

def test_methods
  flow.test_methods
end

#test_suitesObject



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

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.



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

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



168
169
170
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 168

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.



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

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