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

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



33
34
35
36
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 33

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.



51
52
53
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 51

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.



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

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.



56
57
58
59
60
61
62
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 56

def at_run_start
  flow.at_run_start
  @@flow_sheets = nil
  @@pattern_masters = nil
  @@pattern_compilers = nil
  @@variables_files = nil
end

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



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 79

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

#flow_generatorsObject

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



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

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

#flow_sheetsObject



166
167
168
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 166

def flow_sheets
  @@flow_sheets ||= {}
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.



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

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



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

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.



94
95
96
97
98
99
100
101
102
103
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 94

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



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

def pattern_master_filename
  @pattern_master_filename || 'global'
end

#pattern_master_filename=(name) ⇒ Object



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

def pattern_master_filename=(name)
  @pattern_master_filename = name
end

#pattern_mastersObject

Returns a hash containing all pattern master generators



106
107
108
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 106

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.



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

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



65
66
67
68
69
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 65

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



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 172

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
end

#test_methodsObject



162
163
164
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 162

def test_methods
  flow.test_methods
end

#test_suitesObject



158
159
160
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 158

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.



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

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



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

def variables_files
  @@variables_files ||= {}
end