Module: OrigenTesters::Interface
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/origen_testers/interface.rb
Overview
Include this module in any class you define as a test interface
Defined Under Namespace
Modules: ClassMethods
Classes: PatternArray
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.resources_mode? ⇒ Boolean
38
39
40
|
# File 'lib/origen_testers/interface.rb', line 38
def self.resources_mode?
!!@resources_mode
end
|
.with_resources_mode ⇒ Object
31
32
33
34
35
36
|
# File 'lib/origen_testers/interface.rb', line 31
def self.with_resources_mode
orig = @resources_mode
@resources_mode = true
yield
@resources_mode = orig
end
|
.write=(val) ⇒ Object
42
43
44
|
# File 'lib/origen_testers/interface.rb', line 42
def self.write=(val)
@write = val
end
|
.write? ⇒ Boolean
46
47
48
|
# File 'lib/origen_testers/interface.rb', line 46
def self.write?
!!@write
end
|
Instance Method Details
#all_pattern_references ⇒ Object
180
181
182
183
|
# File 'lib/origen_testers/interface.rb', line 180
def all_pattern_references
pattern_references
@@pattern_references
end
|
#app_identifier ⇒ Object
This identifier will be used to make labels and other references unique to the current application. This will help to avoid name duplication if a program is comprised of many modules generated by Origen.
Override in the application interface to customize, by default the identifier will be Origen.config.initials
60
61
62
|
# File 'lib/origen_testers/interface.rb', line 60
def app_identifier
Origen.config.initials || 'Anon App'
end
|
#clean_referenced_patterns ⇒ Object
Remove duplicates and file extensions from the referenced pattern lists
208
209
210
211
212
213
214
215
216
217
218
219
|
# File 'lib/origen_testers/interface.rb', line 208
def clean_referenced_patterns
refs = [:referenced_patterns]
refs.each do |ref|
var = send(ref)
var = var.uniq.map do |pat|
pat = pat.sub(/\..*/, '')
pat unless pat =~ /_part\d+$/
end.uniq.compact
singleton_class.class_variable_set("@@#{ref}", var)
end
end
|
#clear_top_level_flow ⇒ Object
254
255
256
|
# File 'lib/origen_testers/interface.rb', line 254
def clear_top_level_flow
@@top_level_flow = nil
end
|
#close(options = {}) ⇒ Object
64
65
66
67
68
|
# File 'lib/origen_testers/interface.rb', line 64
def close(options = {})
sheet_generators.each do |generator|
generator.close(options)
end
end
|
Add a comment line into the buffer
222
223
224
|
# File 'lib/origen_testers/interface.rb', line 222
def (text)
<< text
end
|
226
227
228
|
# File 'lib/origen_testers/interface.rb', line 226
def
@@comments ||= []
end
|
#compile(file, options = {}) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/origen_testers/interface.rb', line 71
def compile(file, options = {})
return unless write?
options[:initial_options] = options
Origen.file_handler.preserve_state do
begin
file = Origen.file_handler.clean_path_to_template(file)
Origen.generator.compile_file_or_directory(file, options)
rescue
file = Origen.file_handler.clean_path_to(file)
Origen.generator.compile_file_or_directory(file, options)
end
end
end
|
Returns the buffered description comments and clears the buffer
235
236
237
238
239
|
# File 'lib/origen_testers/interface.rb', line 235
def
c =
c
end
|
#descriptions ⇒ Object
A storage Hash that all generators can push comment descriptions into when generating. At the end of a generation run this will contain all descriptions for all flows that were just created.
Access via Origen.interface.descriptions
264
265
266
|
# File 'lib/origen_testers/interface.rb', line 264
def descriptions
@@descriptions ||= Parser::DescriptionLookup.new
end
|
230
231
232
|
# File 'lib/origen_testers/interface.rb', line 230
def
@@comments = nil
end
|
#flow_generator ⇒ Object
246
247
248
|
# File 'lib/origen_testers/interface.rb', line 246
def flow_generator
flow
end
|
#import(file, options = {}) ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/origen_testers/interface.rb', line 87
def import(file, options = {})
generator = flow || sheet_generators.first
generator.import(file, options)
end
|
#on_program_completion(options = {}) ⇒ Object
114
115
116
117
118
|
# File 'lib/origen_testers/interface.rb', line 114
def on_program_completion(options = {})
reset_globals
@@pattern_references = {}
@@referenced_patterns = nil
end
|
#pattern_references ⇒ Object
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/origen_testers/interface.rb', line 164
def pattern_references
@@pattern_references ||= {}
@@pattern_references[pattern_references_name] ||= {
main: {
all: [],
origen: [],
ate: []
},
subroutine: {
all: [],
origen: [],
ate: []
}
}
end
|
#pattern_references_name ⇒ Object
189
190
191
|
# File 'lib/origen_testers/interface.rb', line 189
def pattern_references_name
@pattern_references_name || 'global'
end
|
#pattern_references_name=(name) ⇒ Object
185
186
187
|
# File 'lib/origen_testers/interface.rb', line 185
def pattern_references_name=(name)
@pattern_references_name = name
end
|
286
287
288
289
290
291
292
293
294
|
# File 'lib/origen_testers/interface.rb', line 286
def platform
if singleton_class.const_defined? :PLATFORM
singleton_class::PLATFORM
else
self.class::PLATFORM
end
end
|
#record_pattern_reference(name, options = {}) ⇒ Object
A secondary pattern is one where the pattern has been created by Origen as an output from generating another pattern (a primary pattern). For example, on V93K anytime a tester handshake is done, the pattern will be split into separate components, such as meas_bgap.avc (the primary pattern) and meas_bgap_part1.avc (a secondary pattern).
Any such secondary pattern references should be pushed to this array, rather than the referenced_patterns array. By using the dedicated secondary array, the pattern will not appear in the referenced.list file so that Origen is not asked to generate it (since it will be created naturally from the primary pattern reference). However if the ATE requires a reference to the pattern (e.g. the V93K pattern master file), then it will be included in the relevant ATE files.
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# File 'lib/origen_testers/interface.rb', line 132
def record_pattern_reference(name, options = {})
if name.is_a?(String) || name.is_a?(Symbol)
name = name.to_s
else
fail "Pattern name must be a string or a symbol, not a #{name.class}"
end
unless options[:type]
if name.sub(/\..*/, '') =~ /part\d+$/
options[:type] = :ate
end
end
unless options[:type] == :origen
if respond_to?(:pattern_reference_recorded)
pattern_reference_recorded(name, options)
end
end
base = options[:subroutine] ? pattern_references[:subroutine] : pattern_references[:main]
case options[:type]
when :origen
base[:origen] << name
when :ate
base[:ate] << name
when nil
base[:all] << name
else
fail "Unknown pattern reference type, #{options[:type]}, valid values are :origen or :ate"
end
nil
end
|
#referenced_patterns ⇒ Object
Deprecated.
Use record_pattern_reference instead
All generators should push to this array whenever they reference a pattern so that it is captured in the pattern list, e.g.
Origen.interface.referenced_patterns << pattern
If the ATE platform also has a pattern list, e.g. the pattern master file on V93K, then this will also be updated. Duplicates will be automatically eliminated, so no duplicate checking should be performed on the application side.
203
204
205
|
# File 'lib/origen_testers/interface.rb', line 203
def referenced_patterns
@@referenced_patterns ||= PatternArray.new
end
|
#render(file, options = {}) ⇒ Object
95
96
97
98
99
100
101
|
# File 'lib/origen_testers/interface.rb', line 95
def render(file, options = {})
if sheet_generators.size > 1
fail "You must specify which generator to render content to! e.g. i.test_instances.render '#{file}'"
else
sheet_generators.first.render(file, options)
end
end
|
#resources_mode ⇒ Object
Also known as:
with_resources_mode
Any tests generated within the given block will be generated in resources mode. Generally this means that all resources for a given test will be generated but flow entries will be inhibited.
#resources_mode? ⇒ Boolean
#set_top_level_flow ⇒ Object
250
251
252
|
# File 'lib/origen_testers/interface.rb', line 250
def set_top_level_flow
@@top_level_flow = flow_generator.output_file
end
|
#top_level_flow ⇒ Object
Also known as:
top_level_flow_filename
241
242
243
|
# File 'lib/origen_testers/interface.rb', line 241
def top_level_flow
@@top_level_flow ||= nil
end
|
#write_files(options = {}) ⇒ Object
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/origen_testers/interface.rb', line 103
def write_files(options = {})
sheet_generators.each do |generator|
generator.finalize(options)
end
sheet_generators.each do |generator|
generator.write_to_file(options) if generator.to_be_written?
end
clean_referenced_patterns
flow.save_program
end
|