origen 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/bin/origen +3 -1
  3. data/config/boot.rb +1 -7
  4. data/config/commands.rb +0 -1
  5. data/config/version.rb +2 -2
  6. data/lib/c99/{j750_interface.rb → ate_interface.rb} +3 -11
  7. data/lib/c99/doc_interface.rb +1 -1
  8. data/lib/origen.rb +9 -30
  9. data/lib/origen/application.rb +10 -8
  10. data/lib/origen/application/configuration.rb +13 -26
  11. data/lib/origen/application/plugins.rb +122 -0
  12. data/lib/origen/application/plugins_manager.rb +16 -254
  13. data/lib/origen/application/release.rb +2 -2
  14. data/lib/origen/application/runner.rb +2 -4
  15. data/lib/origen/chips.rb +0 -0
  16. data/lib/origen/chips/chip.rb +0 -0
  17. data/lib/origen/chips/design_entry.rb +0 -0
  18. data/lib/origen/chips/doc_entry.rb +0 -0
  19. data/lib/origen/chips/note.rb +0 -0
  20. data/lib/origen/commands.rb +4 -44
  21. data/lib/origen/commands/compile.rb +1 -2
  22. data/lib/origen/commands/generate.rb +1 -1
  23. data/lib/origen/commands/interactive.rb +1 -2
  24. data/lib/origen/commands/plugin.rb +49 -56
  25. data/lib/origen/commands/program.rb +1 -1
  26. data/lib/origen/commands/rc.rb +2 -2
  27. data/lib/origen/commands/version.rb +2 -17
  28. data/lib/origen/commands_global.rb +3 -0
  29. data/lib/origen/file_handler.rb +10 -10
  30. data/lib/origen/generator.rb +1 -1
  31. data/lib/origen/generator/job.rb +1 -1
  32. data/lib/origen/generator/pattern.rb +2 -2
  33. data/lib/origen/generator/pattern_finder.rb +10 -9
  34. data/lib/origen/pins/pin.rb +0 -0
  35. data/lib/origen/regression_manager.rb +0 -0
  36. data/lib/origen/remote_manager.rb +2 -8
  37. data/lib/origen/revision_control/design_sync.rb +0 -0
  38. data/lib/origen/revision_control/git.rb +0 -0
  39. data/lib/origen/specs.rb +0 -0
  40. data/lib/origen/specs/checkers.rb +0 -0
  41. data/lib/origen/specs/creation_info.rb +0 -0
  42. data/lib/origen/specs/exhibit.rb +0 -0
  43. data/lib/origen/specs/spec.rb +0 -0
  44. data/lib/origen/utility.rb +0 -1
  45. data/lib/origen/utility/diff.rb +0 -0
  46. metadata +42 -119
  47. data/lib/origen/import_manager.rb +0 -596
  48. data/lib/origen/nvm.rb +0 -6
  49. data/lib/origen/nvm/block_array.rb +0 -72
  50. data/lib/origen/tester.rb +0 -56
  51. data/lib/origen/tester/api.rb +0 -277
  52. data/lib/origen/tester/bdm/bdm.rb +0 -25
  53. data/lib/origen/tester/doc/doc.rb +0 -226
  54. data/lib/origen/tester/doc/generator.rb +0 -126
  55. data/lib/origen/tester/doc/generator/flow.rb +0 -71
  56. data/lib/origen/tester/doc/generator/flow_line.rb +0 -203
  57. data/lib/origen/tester/doc/generator/test.rb +0 -68
  58. data/lib/origen/tester/doc/generator/test_group.rb +0 -66
  59. data/lib/origen/tester/doc/generator/tests.rb +0 -47
  60. data/lib/origen/tester/doc/model.rb +0 -162
  61. data/lib/origen/tester/generator.rb +0 -271
  62. data/lib/origen/tester/generator/flow_control_api.rb +0 -606
  63. data/lib/origen/tester/generator/identity_map.rb +0 -25
  64. data/lib/origen/tester/generator/placeholder.rb +0 -13
  65. data/lib/origen/tester/generator/test_numberer.rb +0 -25
  66. data/lib/origen/tester/interface.rb +0 -154
  67. data/lib/origen/tester/j750/files.rb +0 -45
  68. data/lib/origen/tester/j750/generator.rb +0 -203
  69. data/lib/origen/tester/j750/generator/flow.rb +0 -123
  70. data/lib/origen/tester/j750/generator/flow_line.rb +0 -288
  71. data/lib/origen/tester/j750/generator/patgroup.rb +0 -111
  72. data/lib/origen/tester/j750/generator/patgroups.rb +0 -41
  73. data/lib/origen/tester/j750/generator/patset.rb +0 -111
  74. data/lib/origen/tester/j750/generator/patsets.rb +0 -41
  75. data/lib/origen/tester/j750/generator/templates/flow.txt.erb +0 -9
  76. data/lib/origen/tester/j750/generator/templates/instances.txt.erb +0 -16
  77. data/lib/origen/tester/j750/generator/templates/patgroups.txt.erb +0 -8
  78. data/lib/origen/tester/j750/generator/templates/patsets.txt.erb +0 -10
  79. data/lib/origen/tester/j750/generator/test_instance.rb +0 -846
  80. data/lib/origen/tester/j750/generator/test_instance_group.rb +0 -60
  81. data/lib/origen/tester/j750/generator/test_instances.rb +0 -182
  82. data/lib/origen/tester/j750/j750.rb +0 -845
  83. data/lib/origen/tester/j750/j750_hpt.rb +0 -35
  84. data/lib/origen/tester/j750/parser.rb +0 -104
  85. data/lib/origen/tester/j750/parser/ac_spec.rb +0 -11
  86. data/lib/origen/tester/j750/parser/ac_specs.rb +0 -0
  87. data/lib/origen/tester/j750/parser/dc_spec.rb +0 -36
  88. data/lib/origen/tester/j750/parser/dc_specs.rb +0 -50
  89. data/lib/origen/tester/j750/parser/descriptions.rb +0 -340
  90. data/lib/origen/tester/j750/parser/flow.rb +0 -111
  91. data/lib/origen/tester/j750/parser/flow_line.rb +0 -207
  92. data/lib/origen/tester/j750/parser/flows.rb +0 -23
  93. data/lib/origen/tester/j750/parser/pattern_set.rb +0 -94
  94. data/lib/origen/tester/j750/parser/pattern_sets.rb +0 -33
  95. data/lib/origen/tester/j750/parser/test_instance.rb +0 -322
  96. data/lib/origen/tester/j750/parser/test_instances.rb +0 -26
  97. data/lib/origen/tester/j750/parser/timeset.rb +0 -15
  98. data/lib/origen/tester/j750/parser/timesets.rb +0 -0
  99. data/lib/origen/tester/jlink/jlink.rb +0 -33
  100. data/lib/origen/tester/parser.rb +0 -24
  101. data/lib/origen/tester/parser/description_lookup.rb +0 -64
  102. data/lib/origen/tester/parser/searchable_array.rb +0 -32
  103. data/lib/origen/tester/parser/searchable_hash.rb +0 -32
  104. data/lib/origen/tester/time.rb +0 -338
  105. data/lib/origen/tester/timing.rb +0 -253
  106. data/lib/origen/tester/ultraflex/files.rb +0 -45
  107. data/lib/origen/tester/ultraflex/generator.rb +0 -200
  108. data/lib/origen/tester/ultraflex/generator/flow.rb +0 -119
  109. data/lib/origen/tester/ultraflex/generator/flow_line.rb +0 -269
  110. data/lib/origen/tester/ultraflex/generator/patgroup.rb +0 -111
  111. data/lib/origen/tester/ultraflex/generator/patgroups.rb +0 -41
  112. data/lib/origen/tester/ultraflex/generator/patset.rb +0 -111
  113. data/lib/origen/tester/ultraflex/generator/patsets.rb +0 -41
  114. data/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb +0 -9
  115. data/lib/origen/tester/ultraflex/generator/templates/instances.txt.erb +0 -16
  116. data/lib/origen/tester/ultraflex/generator/templates/patgroups.txt.erb +0 -8
  117. data/lib/origen/tester/ultraflex/generator/templates/patsets.txt.erb +0 -10
  118. data/lib/origen/tester/ultraflex/generator/test_instance.rb +0 -622
  119. data/lib/origen/tester/ultraflex/generator/test_instance_group.rb +0 -60
  120. data/lib/origen/tester/ultraflex/generator/test_instances.rb +0 -174
  121. data/lib/origen/tester/ultraflex/parser.rb +0 -104
  122. data/lib/origen/tester/ultraflex/parser/ac_spec.rb +0 -11
  123. data/lib/origen/tester/ultraflex/parser/ac_specs.rb +0 -0
  124. data/lib/origen/tester/ultraflex/parser/dc_spec.rb +0 -36
  125. data/lib/origen/tester/ultraflex/parser/dc_specs.rb +0 -50
  126. data/lib/origen/tester/ultraflex/parser/descriptions.rb +0 -342
  127. data/lib/origen/tester/ultraflex/parser/flow.rb +0 -111
  128. data/lib/origen/tester/ultraflex/parser/flow_line.rb +0 -207
  129. data/lib/origen/tester/ultraflex/parser/flows.rb +0 -23
  130. data/lib/origen/tester/ultraflex/parser/pattern_set.rb +0 -94
  131. data/lib/origen/tester/ultraflex/parser/pattern_sets.rb +0 -33
  132. data/lib/origen/tester/ultraflex/parser/test_instance.rb +0 -262
  133. data/lib/origen/tester/ultraflex/parser/test_instances.rb +0 -26
  134. data/lib/origen/tester/ultraflex/parser/timeset.rb +0 -15
  135. data/lib/origen/tester/ultraflex/parser/timesets.rb +0 -0
  136. data/lib/origen/tester/ultraflex/ultraflex.rb +0 -759
  137. data/lib/origen/tester/v93k/generator.rb +0 -80
  138. data/lib/origen/tester/v93k/generator/flow.rb +0 -63
  139. data/lib/origen/tester/v93k/generator/flow_node.rb +0 -17
  140. data/lib/origen/tester/v93k/generator/flow_node/print.rb +0 -10
  141. data/lib/origen/tester/v93k/generator/pattern.rb +0 -16
  142. data/lib/origen/tester/v93k/generator/pattern_master.rb +0 -54
  143. data/lib/origen/tester/v93k/generator/templates/_test_method.txt.erb +0 -6
  144. data/lib/origen/tester/v93k/generator/templates/_test_suite.txt.erb +0 -11
  145. data/lib/origen/tester/v93k/generator/templates/template.flow.erb +0 -121
  146. data/lib/origen/tester/v93k/generator/templates/template.pmfl.erb +0 -9
  147. data/lib/origen/tester/v93k/generator/test_function.rb +0 -103
  148. data/lib/origen/tester/v93k/generator/test_functions.rb +0 -79
  149. data/lib/origen/tester/v93k/generator/test_method.rb +0 -46
  150. data/lib/origen/tester/v93k/generator/test_methods.rb +0 -75
  151. data/lib/origen/tester/v93k/generator/test_suite.rb +0 -54
  152. data/lib/origen/tester/v93k/generator/test_suites.rb +0 -65
  153. data/lib/origen/tester/v93k/v93k.rb +0 -420
  154. data/lib/origen/tester/vector.rb +0 -86
  155. data/lib/origen/tester/vector_generator.rb +0 -637
  156. data/lib/origen/tester/vector_pipeline.rb +0 -150
  157. data/lib/origen/utility/design_sync.rb +0 -494
  158. data/lib/origen/version_checker.rb +0 -117
@@ -1,45 +0,0 @@
1
- module Origen
2
- module Tester
3
- class Ultraflex
4
- # Methods for handling all Ultraflex file parsing, e.g. datalogs,
5
- # test time profiles, etc.
6
- module Files
7
- # Reads all lines from a Ultraflex detailed execution time file, returning the lines
8
- # as an array like this:
9
- #
10
- # [
11
- # {:name => "power_cycle", :index => 1, :group => 3, :time => 0.00461},
12
- # {:name => "power_cycle", :index => 2, :group => 3, :time => 0.00481},
13
- # {:name => "power_cycle", :index => 3, :group => 3, :time => 0.00438},
14
- # {:name => "nvm_mass_erase", :index => nil, :group => nil, :time => 0.19863},
15
- # ]
16
- def read_test_times(file, _options = {})
17
- tests = []
18
- File.readlines(file).each do |line|
19
- unless line.strip.empty? || line =~ /Entire Job/
20
- # http://rubular.com/r/vZOcqovTsf
21
- if line =~ /(\w+) ?(\(.*?\))? \d\d\d\d (\d+\.\d+).*/
22
- t = { name: Regexp.last_match[1], time: Regexp.last_match[3].to_f.round(6) }
23
- # If an indexed test
24
- if Regexp.last_match[2]
25
- str = Regexp.last_match[2].gsub('(', '').gsub(')', '')
26
- fields = str.split('/')
27
- i = fields[0].to_i
28
- g = fields[1].to_i
29
- t[:index] = i
30
- t[:group] = g
31
-
32
- else
33
- t[:index] = nil
34
- t[:group] = nil
35
- end
36
- tests << t
37
- end
38
- end
39
- end
40
- tests
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,200 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- module Origen
4
- module Tester
5
- class Ultraflex
6
- module Generator
7
- extend ActiveSupport::Concern
8
-
9
- autoload :TestInstance, 'origen/tester/ultraflex/generator/test_instance'
10
- autoload :TestInstanceGroup, 'origen/tester/ultraflex/generator/test_instance_group'
11
- autoload :TestInstances, 'origen/tester/ultraflex/generator/test_instances'
12
- autoload :Patset, 'origen/tester/ultraflex/generator/patset'
13
- autoload :Patsets, 'origen/tester/ultraflex/generator/patsets'
14
- autoload :Patgroup, 'origen/tester/ultraflex/generator/patgroup'
15
- autoload :Patgroups, 'origen/tester/ultraflex/generator/patgroups'
16
- autoload :Flow, 'origen/tester/ultraflex/generator/flow'
17
- autoload :FlowLine, 'origen/tester/ultraflex/generator/flow_line'
18
- autoload :Placeholder, 'origen/tester/generator/placeholder'
19
-
20
- included do
21
- include Origen::Tester::Interface # adds the interface helpers/Origen hook-up
22
- include Origen::Tester::Generator::FlowControlAPI::Interface
23
- PLATFORM = Origen::Tester::Ultraflex
24
- end
25
-
26
- def reset_globals
27
- flow.reset_globals
28
- @@test_instances_filename = nil
29
- @@patsets_filename = nil
30
- @@patgroups_filename = nil
31
- @@test_instances_filename = nil
32
- @@patsets_filename = nil
33
- @@patgroups_filename = nil
34
- @@test_instance_sheets = nil
35
- @@patset_sheets = nil
36
- @@flow_sheets = nil
37
- @@patgroup_sheets = nil
38
- end
39
-
40
- # Convenience method to allow the current name for the test instance,
41
- # patsets and patgroups sheets to be set to the same value.
42
- #
43
- # # my ultraflex interface
44
- #
45
- # resources_filename = "common"
46
- #
47
- # # The above is equivalent to:
48
- #
49
- # test_instances_filename = "common"
50
- # patsets_filename = "common"
51
- # patgroups_filename = "common"
52
- def resources_filename=(name)
53
- self.test_instances_filename = name
54
- self.patsets_filename = name
55
- self.patgroups_filename = name
56
- end
57
-
58
- # Set the name of the current test instances sheet. This does not change
59
- # the name of the current sheet, but rather sets the name of the sheet that
60
- # will be generated the next time you access test_instances.
61
- def test_instances_filename=(name)
62
- @@test_instances_filename = name
63
- end
64
-
65
- # Set the name of the current pattern sets sheet. This does not change
66
- # the name of the current sheet, but rather sets the name of the sheet that
67
- # will be generated the next time you access patsets.
68
- def patsets_filename=(name)
69
- @@patsets_filename = name
70
- end
71
-
72
- # Set the name of the current pattern groups sheet. This does not change
73
- # the name of the current sheet, but rather sets the name of the sheet that
74
- # will be generated the next time you access patgroups.
75
- def patgroups_filename=(name)
76
- @@patgroups_filename = name
77
- end
78
-
79
- # Returns the name of the current test instances sheet
80
- def test_instances_filename
81
- @@test_instances_filename ||= 'global'
82
- end
83
-
84
- # Returns the name of the current pat sets sheet
85
- def patsets_filename
86
- @@patsets_filename ||= 'global'
87
- end
88
-
89
- # Returns the name of the current pat groups sheet
90
- def patgroups_filename
91
- @@patgroups_filename ||= 'global'
92
- end
93
-
94
- # Returns a hash containing all test instance sheets
95
- def test_instance_sheets
96
- @@test_instance_sheets ||= {}
97
- end
98
-
99
- # Returns a hash containing all pat set sheets
100
- def patset_sheets
101
- @@patset_sheets ||= {}
102
- end
103
-
104
- # Returns a hash containing all flow sheets
105
- def flow_sheets
106
- @@flow_sheets ||= {}
107
- end
108
-
109
- # Returns a hash containing all pat group sheets
110
- def patgroup_sheets
111
- @@patgroup_sheets ||= {}
112
- end
113
-
114
- # Returns an array containing all sheet generators where a sheet generator is a flow,
115
- # test instance, patset or pat group sheet.
116
- # All Origen program generators must implement this method
117
- def sheet_generators # :nodoc:
118
- g = []
119
- [flow_sheets, test_instance_sheets, patset_sheets, patgroup_sheets].each do |sheets|
120
- sheets.each do |_name, sheet|
121
- g << sheet
122
- end
123
- end
124
- g
125
- end
126
-
127
- # Returns an array containing all flow sheet generators.
128
- # All Origen program generators must implement this method
129
- def flow_generators
130
- g = []
131
- flow_sheets.each do |_name, sheet|
132
- g << sheet
133
- end
134
- g
135
- end
136
-
137
- # Returns the current test instances sheet (as defined by the current value of
138
- # test_instances_filename).
139
- #
140
- # Pass in a filename argument to have a specific sheet returned instead.
141
- #
142
- # If the sheet does not exist yet it will be created.
143
- def test_instances(filename = test_instances_filename)
144
- f = filename.to_sym
145
- return test_instance_sheets[f] if test_instance_sheets[f]
146
- t = TestInstances.new
147
- t.filename = f
148
- test_instance_sheets[f] = t
149
- end
150
-
151
- # Returns the current pattern sets sheet (as defined by the current value of
152
- # patsets_filename).
153
- #
154
- # Pass in a filename argument to have a specific sheet returned instead.
155
- #
156
- # If the sheet does not exist yet it will be created.
157
- def patsets(filename = patsets_filename)
158
- f = filename.to_sym
159
- return patset_sheets[f] if patset_sheets[f]
160
- p = Patsets.new
161
- p.filename = f
162
- patset_sheets[f] = p
163
- end
164
- alias_method :pat_sets, :patsets
165
- alias_method :pattern_sets, :patsets
166
-
167
- # Returns the current flow sheet (as defined by the name of the current top
168
- # level flow source file).
169
- #
170
- # Pass in a filename argument to have a specific sheet returned instead.
171
- #
172
- # If the sheet does not exist yet it will be created.
173
- def flow(filename = Origen.file_handler.current_file.basename('.rb').to_s)
174
- f = filename.to_sym
175
- return flow_sheets[f] if flow_sheets[f]
176
- p = Flow.new
177
- p.inhibit_output if Origen.interface.resources_mode?
178
- p.filename = f
179
- flow_sheets[f] = p
180
- end
181
-
182
- # Returns the current pattern groups sheet (as defined by the current value of
183
- # patgroups_filename).
184
- #
185
- # Pass in a filename argument to have a specific sheet returned instead.
186
- #
187
- # If the sheet does not exist yet it will be created.
188
- def patgroups(filename = patgroups_filename)
189
- f = filename.to_sym
190
- return patgroup_sheets[f] if patgroup_sheets[f]
191
- p = Patgroups.new
192
- p.filename = f
193
- patgroup_sheets[f] = p
194
- end
195
- alias_method :pat_groups, :patgroups
196
- alias_method :pattern_groups, :patgroups
197
- end
198
- end
199
- end
200
- end
@@ -1,119 +0,0 @@
1
- module Origen
2
- module Tester
3
- class Ultraflex
4
- module Generator
5
- class Flow
6
- include Origen::Tester::Generator
7
- include Origen::Tester::Generator::FlowControlAPI
8
-
9
- TEMPLATE = "#{Origen.top}/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb"
10
- OUTPUT_POSTFIX = 'flow'
11
-
12
- def add(type, options = {})
13
- ins = false
14
- options = save_context(options) if [:test, :cz].include?(type)
15
- branch_unless_enabled(options) do |options|
16
- ins = track_relationships(options) do |options|
17
- FlowLine.new(type, options)
18
- end
19
- collection << ins unless Origen.interface.resources_mode?
20
- if ins.test?
21
- c = Origen.interface.consume_comments
22
- unless Origen.interface.resources_mode?
23
- Origen.interface.descriptions.add_for_test_usage(ins.parameter, Origen.interface.top_level_flow, c)
24
- end
25
- else
26
- Origen.interface.discard_comments
27
- end
28
- end
29
- ins
30
- end
31
-
32
- def logprint(message, options = {})
33
- message.gsub!(/\s/, '_')
34
- add(:logprint, options.merge(parameter: message))
35
- end
36
-
37
- def test(instance, options = {})
38
- add(:test, options.merge(parameter: instance))
39
- end
40
-
41
- def cz(instance, cz_setup, options = {})
42
- add(:cz, options.merge(parameter: instance, cz_setup: cz_setup))
43
- end
44
-
45
- def goto(label, options = {})
46
- add(:goto, options.merge(parameter: label))
47
- end
48
-
49
- def nop(options = {})
50
- add(:nop, options.merge(parameter: nil))
51
- end
52
-
53
- def set_device(options = {})
54
- add(:set_device, options)
55
- end
56
-
57
- def enable_flow_word(word, options = {})
58
- add(:enable_flow_word, options.merge(parameter: word))
59
- end
60
-
61
- def disable_flow_word(word, options = {})
62
- add(:disable_flow_word, options.merge(parameter: word))
63
- end
64
-
65
- # All tests generated will not run unless the given enable word is asserted.
66
- #
67
- # This is specially implemented for Ultraflex since it does not have a native
68
- # support for flow word not enabled.
69
- # It will generate a goto branch around the tests contained with the block
70
- # if the given flow word is enabled.
71
- def unless_enable(word, options = {})
72
- if options[:or]
73
- yield
74
- else
75
- @unless_enable_block = word
76
- options = options.merge(unless_enable: word)
77
- branch_unless_enabled(options.merge(_force_unless_enable: true)) do
78
- yield
79
- end
80
- @unless_enable_block = nil
81
- end
82
- end
83
- alias_method :unless_enabled, :unless_enable
84
-
85
- def start_flow_branch(identifier, options = {})
86
- goto(identifier, options)
87
- end
88
-
89
- def skip(identifier = nil, options = {})
90
- identifier, options = nil, identifier if identifier.is_a?(Hash)
91
- identifier = generate_unique_label(identifier)
92
- goto(identifier, options)
93
- yield
94
- nop(label: identifier)
95
- end
96
-
97
- private
98
-
99
- # If the test has an unless_enable then branch around it
100
- def branch_unless_enabled(options)
101
- word = options.delete(:unless_enable) || options.delete(:unless_enabled)
102
- if word && (word != @unless_enable_block || options.delete(:_force_unless_enable))
103
- # Not sure if this is really required, but duplicating these hashes here to ensure
104
- # that all other flow context keys are preserved and applied to the branch lines
105
- orig_options = options.merge({})
106
- close_options = options.merge({})
107
- label = generate_unique_label
108
- goto(label, options.merge(if_enable: word))
109
- yield orig_options
110
- nop(close_options.merge(label: label))
111
- else
112
- yield options
113
- end
114
- end
115
- end
116
- end
117
- end
118
- end
119
- end
@@ -1,269 +0,0 @@
1
- module Origen
2
- module Tester
3
- class Ultraflex
4
- module Generator
5
- class FlowLine
6
- attr_accessor :type, :id, :cz_setup # cz_setup is a virtual attrib since it is not part of the regular flow line
7
- # cz_setup combine with instance name when characterize opcode is used
8
-
9
- # Attributes for each flow line, these must be declared in the order they are to be output
10
- ATTRS = %w(label enable job part env opcode parameter tname tnum bin_pass bin_fail
11
- sort_pass sort_fail result flag_pass flag_fail state
12
- group_specifier group_sense group_condition group_name
13
- device_sense device_condition device_name
14
- debug_assume debug_sites comment
15
- )
16
-
17
- # Map any aliases to the official names here, multiple aliases for a given attribute
18
- # are allowed
19
- ALIASES = {
20
- bin: :bin_fail,
21
- softbin: :sort_fail,
22
- soft_bin: :sort_fail,
23
- name: :tname,
24
- number: :tnum,
25
- if_enable: :enable,
26
- if_enabled: :enable,
27
- enabled: :enable,
28
- # Aliases can also be used to set defaults on multiple attributes like this,
29
- # use :value to refer to the value passed in to the given alias
30
- flag_false: { device_condition: 'flag-false',
31
- device_name: :value
32
- },
33
- flag_true: { device_condition: 'flag-true',
34
- device_name: :value
35
- },
36
- flag_false_any: { group_specifier: 'any-active',
37
- group_condition: 'flag-false',
38
- group_name: :value
39
- },
40
- flag_false_all: { group_specifier: 'all-active',
41
- group_condition: 'flag-false',
42
- group_name: :value
43
- },
44
- flag_true_any: { group_specifier: 'any-active',
45
- group_condition: 'flag-true',
46
- group_name: :value
47
- },
48
- flag_true_all: { group_specifier: 'all-active',
49
- group_condition: 'flag-true',
50
- group_name: :value
51
- },
52
- flag_clear: { device_condition: 'flag-clear',
53
- device_name: :value
54
- }
55
- }
56
-
57
- # Assign attribute defaults here, generally this should match whatever defaults
58
- # Teradyne has set whenever you create a new test instance, etc.
59
- DEFAULTS = {
60
- test: {
61
- opcode: 'Test',
62
- result: 'Fail'
63
- },
64
- cz: {
65
- opcode: 'characterize',
66
- result: 'None'
67
- },
68
- goto: {
69
- opcode: 'goto'
70
- },
71
- nop: {
72
- opcode: 'nop'
73
- },
74
- set_device: {
75
- opcode: 'set-device'
76
- },
77
- enable_flow_word: {
78
- opcode: 'enable-flow-word'
79
- },
80
- disable_flow_word: {
81
- opcode: 'disable-flow-word'
82
- },
83
- logprint: {
84
- opcode: 'logprint'
85
- }
86
- }
87
-
88
- # Generate accessors for all attributes and their aliases
89
- ATTRS.each do |attr|
90
- attr_accessor attr.to_sym
91
- end
92
-
93
- ALIASES.each do |_alias, val|
94
- if val.is_a? Hash
95
- define_method("#{_alias}=") do |v|
96
- val.each do |k, _v|
97
- myval = _v == :value ? v : _v
98
- send("#{k}=", myval)
99
- end
100
- end
101
- else
102
- define_method("#{_alias}=") do |v|
103
- send("#{val}=", v)
104
- end
105
- define_method("#{_alias}") do
106
- send(val)
107
- end
108
- end
109
- end
110
-
111
- def initialize(type, attrs = {})
112
- @ignore_missing_instance = attrs.delete(:instance_not_available)
113
- self.cz_setup = attrs.delete(:cz_setup)
114
- @type = type
115
- # Set the defaults
116
- DEFAULTS[@type.to_sym].each do |k, v|
117
- send("#{k}=", v) if self.respond_to?("#{k}=")
118
- end
119
- # Then the values that have been supplied
120
- attrs.each do |k, v|
121
- send("#{k}=", v) if self.respond_to?("#{k}=")
122
- end
123
- end
124
-
125
- def parameter=(value)
126
- if (@type == :test || @test == :cz) && !@ignore_missing_instance
127
- if value.is_a?(String) || value.is_a?(Symbol)
128
- fail "You must supply the actual test instance object for #{value} when adding it to the flow"
129
- end
130
- end
131
- @parameter = value
132
- end
133
-
134
- def parameter
135
- # When referring to the test instance take the opportunity to refresh the current
136
- # version of the test instance
137
- @parameter = Origen.interface.identity_map.current_version_of(@parameter)
138
- end
139
-
140
- # Returns the fully formatted flow line for insertion into a flow sheet
141
- def to_s
142
- l = "\t"
143
- ATTRS.each do |attr|
144
- if attr == 'parameter'
145
- ins = parameter
146
- if ins.respond_to?(:name)
147
- l += "#{ins.name}"
148
- else
149
- l += "#{ins}"
150
- end
151
- if cz_setup
152
- l += " #{cz_setup}\t"
153
- else
154
- l += "\t"
155
- end
156
- else
157
- l += "#{send(attr)}\t"
158
- end
159
- end
160
- "#{l}"
161
- end
162
-
163
- def job
164
- if !if_jobs.empty? && !unless_jobs.empty?
165
- fail "Both if and unless jobs have been defined for test: #{parameter}"
166
- elsif !if_jobs.empty?
167
- if_jobs.join(',')
168
- elsif !unless_jobs.empty?
169
- unless_jobs.map { |j| "!#{j}" }.join(',')
170
- else
171
- ''
172
- end
173
- end
174
- alias_method :jobs, :job
175
-
176
- def unless_enable=(*_args)
177
- end
178
- alias_method :unless_enabled=, :unless_enable=
179
-
180
- def if_jobs
181
- @if_jobs ||= []
182
- end
183
-
184
- def unless_jobs
185
- @unless_jobs ||= []
186
- end
187
-
188
- def if_job=(jobs)
189
- [jobs].flatten.compact.each do |job|
190
- job = job.to_s.upcase
191
- if job =~ /!/
192
- self.unless_job = job
193
- else
194
- if_jobs << job unless if_jobs.include?(job)
195
- end
196
- end
197
- end
198
- alias_method :if_jobs=, :if_job=
199
- alias_method :add_if_jobs, :if_job=
200
- alias_method :add_if_job, :if_job=
201
-
202
- def unless_job=(jobs)
203
- [jobs].flatten.compact.each do |job|
204
- job = job.to_s.upcase
205
- job.gsub!('!', '')
206
- unless_jobs << job unless unless_jobs.include?(job)
207
- end
208
- end
209
- alias_method :unless_jobs=, :unless_job=
210
- alias_method :add_unless_jobs, :unless_job=
211
- alias_method :add_unless_job, :unless_job=
212
-
213
- def continue_on_fail
214
- self.result = 'None'
215
- end
216
-
217
- def set_flag_on_fail
218
- self.flag_fail = "#{id}_FAILED"
219
- end
220
-
221
- def set_flag_on_pass
222
- self.flag_pass = "#{id}_PASSED"
223
- end
224
-
225
- def set_flag_on_ran
226
- self.flag_pass = "#{id}_RAN"
227
- end
228
-
229
- def run_if_any_passed(parent)
230
- parent.continue_on_fail
231
- self.flag_true_any = parent.set_flag_on_pass
232
- end
233
-
234
- def run_if_all_passed(parent)
235
- parent.continue_on_fail
236
- self.flag_true_all = parent.set_flag_on_pass
237
- end
238
-
239
- def run_if_any_failed(parent)
240
- parent.continue_on_fail
241
- self.flag_true_any = parent.set_flag_on_fail
242
- end
243
-
244
- def run_if_all_failed(parent)
245
- parent.continue_on_fail
246
- self.flag_true_all = parent.set_flag_on_fail
247
- end
248
-
249
- def id
250
- @id || "#{parameter}_#{unique_counter}"
251
- end
252
-
253
- def unique_counter
254
- @unique_counter ||= self.class.unique_counter
255
- end
256
-
257
- def self.unique_counter
258
- @ix ||= -1
259
- @ix += 1
260
- end
261
-
262
- def test?
263
- @type == :test
264
- end
265
- end
266
- end
267
- end
268
- end
269
- end