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

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



21
22
23
24
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 21

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.



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

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.



28
29
30
31
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 28

def at_flow_start
  flow.at_flow_start
  @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.



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

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



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 62

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



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

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

#flow_sheetsObject



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

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.



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

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



108
109
110
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 108

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.



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

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



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

def pattern_master_filename
  @pattern_master_filename || 'global'
end

#pattern_master_filename=(name) ⇒ Object



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

def pattern_master_filename=(name)
  @pattern_master_filename = name
end

#pattern_mastersObject

Returns a hash containing all pattern master generators



89
90
91
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 89

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.



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

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



48
49
50
51
52
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 48

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



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

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



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

def test_methods
  flow.test_methods
end

#test_suitesObject



141
142
143
# File 'lib/origen_testers/smartest_based_tester/base/generator.rb', line 141

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.



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

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



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

def variables_files
  @@variables_files ||= {}
end