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,79 +0,0 @@
1
- module Origen
2
- module Tester
3
- class V93K
4
- module Generator
5
- class TestFunctions
6
- # Origen::Tester::Generator not included since test functions do not have their
7
- # own top-level sheet, they will be incorporated within the flow sheet
8
-
9
- attr_accessor :flow, :collection
10
-
11
- def initialize(flow)
12
- @flow = flow
13
- @collection = {}
14
- @ix = 0
15
- end
16
-
17
- def filename
18
- flow.filename
19
- end
20
-
21
- def add(name, type, options = {})
22
- check_for_duplicates(name)
23
- record_test_function(name)
24
- func = TestFunction.new(next_name, type, options)
25
- @collection[name] = func
26
- # c = Origen.interface.consume_comments
27
- # Origen.interface.descriptions.add_for_test_definition(name, c)
28
- func
29
- end
30
-
31
- def functional(name, options = {})
32
- add(name, :functional, options)
33
- end
34
-
35
- def [](name)
36
- @collection[name]
37
- end
38
-
39
- # Returns true if the given test function name has already been added to the current flow.
40
- #
41
- # Pass in :global => true for all test flows to be considered.
42
- def duplicate?(name, options = {})
43
- files = existing_test_functions[name]
44
- if files && !files.empty?
45
- options[:global] || files.include?(filename)
46
- else
47
- false
48
- end
49
- end
50
-
51
- private
52
-
53
- def next_name
54
- @ix += 1
55
- "tf_#{@ix}"
56
- end
57
-
58
- def check_for_duplicates(name)
59
- if duplicate?(name)
60
- error "Duplicate test function #{name} generated in #{filename}"
61
- exit 1
62
- elsif duplicate?(name, global: true)
63
- warning "Test function #{name} is duplicated in: #{existing_test_functions[name].join(', ')}"
64
- end
65
- end
66
-
67
- def existing_test_functions
68
- @@existing_test_functions ||= {}
69
- end
70
-
71
- def record_test_function(name)
72
- existing_test_functions[name] ||= []
73
- existing_test_functions[name] << filename
74
- end
75
- end
76
- end
77
- end
78
- end
79
- end
@@ -1,46 +0,0 @@
1
- module Origen
2
- module Tester
3
- class V93K
4
- module Generator
5
- class TestMethod
6
- ATTRS =
7
- %w(name klass method_name parameters limits
8
- )
9
-
10
- ALIASES = {
11
- }
12
-
13
- DEFAULTS = {
14
- }
15
-
16
- # Generate accessors for all attributes and their aliases
17
- ATTRS.each do |attr|
18
- attr_accessor attr.to_sym
19
- end
20
-
21
- # Define the aliases
22
- ALIASES.each do |_alias, val|
23
- define_method("#{_alias}=") do |v|
24
- send("#{val}=", v)
25
- end
26
- define_method("#{_alias}") do
27
- send(val)
28
- end
29
- end
30
-
31
- def initialize(name, attrs = {})
32
- self.name = name
33
- # Set the defaults
34
- DEFAULTS.each do |k, v|
35
- send("#{k}=", v)
36
- end
37
- # Then the values that have been supplied
38
- attrs.each do |k, v|
39
- send("#{k}=", v)
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,75 +0,0 @@
1
- module Origen
2
- module Tester
3
- class V93K
4
- module Generator
5
- class TestMethods
6
- # Origen::Tester::Generator not included since test methods do not have their
7
- # own top-level sheet, they will be incorporated within the flow sheet
8
-
9
- attr_accessor :flow, :collection
10
-
11
- def initialize(flow)
12
- @flow = flow
13
- @collection = {}
14
- @ix = 0
15
- end
16
-
17
- def filename
18
- flow.filename
19
- end
20
-
21
- def add(name, _type, options = {})
22
- check_for_duplicates(name)
23
- record_test_method(name)
24
- func = TestMethod.new(next_name, options)
25
- @collection[name] = func
26
- # c = Origen.interface.consume_comments
27
- # Origen.interface.descriptions.add_for_test_definition(name, c)
28
- func
29
- end
30
-
31
- def [](name)
32
- @collection[name]
33
- end
34
-
35
- # Returns true if the given test method name has already been added to the current flow.
36
- #
37
- # Pass in :global => true for all test flows to be considered.
38
- def duplicate?(name, options = {})
39
- files = existing_test_methods[name]
40
- if files && !files.empty?
41
- options[:global] || files.include?(filename)
42
- else
43
- false
44
- end
45
- end
46
-
47
- private
48
-
49
- def next_name
50
- @ix += 1
51
- "tm_#{@ix}"
52
- end
53
-
54
- def check_for_duplicates(name)
55
- if duplicate?(name)
56
- error "Duplicate test method #{name} generated in #{filename}"
57
- exit 1
58
- elsif duplicate?(name, global: true)
59
- warning "Test method #{name} is duplicated in: #{existing_test_methods[name].join(', ')}"
60
- end
61
- end
62
-
63
- def existing_test_methods
64
- @@existing_test_methods ||= {}
65
- end
66
-
67
- def record_test_method(name)
68
- existing_test_methods[name] ||= []
69
- existing_test_methods[name] << filename
70
- end
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,54 +0,0 @@
1
- module Origen
2
- module Tester
3
- class V93K
4
- module Generator
5
- class TestSuite
6
- ATTRS =
7
- %w(name tim_equ_set lev_equ_set tim_spec_set lev_spec_set timset levset
8
- seqlbl testf test_number
9
- )
10
-
11
- ALIASES = {
12
- pattern: :seqlbl,
13
- sequence_label: :seqlbl,
14
- test_num: :test_number,
15
- test_function: :testf,
16
- levels: :levset,
17
- timeset: :timset,
18
- time_set: :timset
19
- }
20
-
21
- DEFAULTS = {
22
- }
23
-
24
- # Generate accessors for all attributes and their aliases
25
- ATTRS.each do |attr|
26
- attr_accessor attr.to_sym
27
- end
28
-
29
- # Define the aliases
30
- ALIASES.each do |_alias, val|
31
- define_method("#{_alias}=") do |v|
32
- send("#{val}=", v)
33
- end
34
- define_method("#{_alias}") do
35
- send(val)
36
- end
37
- end
38
-
39
- def initialize(name, attrs = {})
40
- self.name = name
41
- # Set the defaults
42
- DEFAULTS.each do |k, v|
43
- send("#{k}=", v)
44
- end
45
- # Then the values that have been supplied
46
- attrs.each do |k, v|
47
- send("#{k}=", v)
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,65 +0,0 @@
1
- module Origen
2
- module Tester
3
- class V93K
4
- module Generator
5
- class TestSuites
6
- # Origen::Tester::Generator not included since test suites do not have their
7
- # own top-level sheet, they will be incorporated within the flow sheet
8
-
9
- attr_accessor :flow, :collection
10
-
11
- def initialize(flow)
12
- @flow = flow
13
- @collection = []
14
- end
15
-
16
- def filename
17
- flow.filename
18
- end
19
-
20
- def add(name, options = {})
21
- check_for_duplicates(name)
22
- record_test_suite(name)
23
- suite = TestSuite.new(name, options)
24
- @collection << suite
25
- # c = Origen.interface.consume_comments
26
- # Origen.interface.descriptions.add_for_test_definition(name, c)
27
- suite
28
- end
29
-
30
- # Returns true if the given test suite name has already been added to the current flow.
31
- #
32
- # Pass in :global => true for all test flows to be considered.
33
- def duplicate?(name, options = {})
34
- files = existing_test_suites[name]
35
- if files && !files.empty?
36
- options[:global] || files.include?(filename)
37
- else
38
- false
39
- end
40
- end
41
-
42
- private
43
-
44
- def check_for_duplicates(name)
45
- if duplicate?(name)
46
- error "Duplicate test suite #{name} generated in #{filename}"
47
- exit 1
48
- elsif duplicate?(name, global: true)
49
- warning "Test suite #{name} is duplicated in: #{existing_test_suites[name].join(', ')}"
50
- end
51
- end
52
-
53
- def existing_test_suites
54
- @@existing_test_suites ||= {}
55
- end
56
-
57
- def record_test_suite(name)
58
- existing_test_suites[name] ||= []
59
- existing_test_suites[name] << filename
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,420 +0,0 @@
1
- Origen.deprecate <<-END
2
- The V93K Tester in Origen core is being moved to a dedicated plugin,
3
- use Testers::V93K from this plugin instead of Origen::Tester::V93K -
4
- http://origen.freescale.net/testers
5
- END
6
- module Origen
7
- module Tester
8
- # Tester model to generate .avc patterns for the Verigy 930000
9
- #
10
- # == Basic Usage
11
- # $tester = Origen::Tester::V93K.new
12
- # $tester.cycle # Generate a vector
13
- #
14
- # Many more methods exist to generate V93K specific micro-code, see below for
15
- # details.
16
- #
17
- # Also note that this class includes the base Tester module and so all methods
18
- # described there are also available.
19
- class V93K
20
- include Tester
21
-
22
- autoload :Generator, 'origen/tester/v93k/generator'
23
-
24
- # Returns a new J750 instance, normally there would only ever be one of these
25
- # assigned to the global variable such as $tester by your target:
26
- # $tester = J750.new
27
- def initialize
28
- @max_repeat_loop = 65_535
29
- @pat_extension = 'avc'
30
- @compress = true
31
- # @support_repeat_previous = true
32
- @match_entries = 10
33
- @name = 'v93k'
34
- @comment_char = '#'
35
- end
36
-
37
- # Capture the pin data from a vector to the tester.
38
- #
39
- # This method uses the Digital Capture feature (Selective mode) of the V93000 to capture
40
- # the data from the given pins on the previous vector.
41
- # Note that is does not actually generate a new vector.
42
- #
43
- # Note also that any drive cycles on the target pins can also be captured, to avoid this
44
- # the wavetable should be set up like this to infer a 'D' (Don't Capture) on vectors where
45
- # the target pin is being used to drive data:
46
- #
47
- # PINS nvm_fail
48
- # 0 d1:0 r1:D 0
49
- # 1 d1:1 r1:D 1
50
- # 2 r1:C Capt
51
- # 3 r1:D NoCapt
52
- #
53
- # Sometimes when generating vectors within a loop you may want to apply a capture
54
- # retrospectively to a previous vector, passing in an offset option will allow you
55
- # to do this.
56
- #
57
- # ==== Examples
58
- # $tester.cycle # This is the vector you want to capture
59
- # $tester.store :pin => pin(:fail) # This applys the required opcode to the given pins
60
- #
61
- # $tester.cycle # This one gets captured
62
- # $tester.cycle
63
- # $tester.cycle
64
- # $tester.store(:pin => pin(:fail), :offset => -2) # Just realized I need to capture that earlier vector
65
- #
66
- # # Capturing multiple pins:
67
- # $tester.cycle
68
- # $tester.store :pins => [pin(:fail), pin(:done)]
69
- #
70
- # Since the V93K store operates on a pin level (rather than vector level as on the J750)
71
- # equivalent functionality can also be achieved by setting the store attribute of the pin
72
- # itself prior to calling $tester.cycle.
73
- # However it is recommended to use the tester API to do the store if cross-compatiblity with
74
- # other platforms, such as the J750, is required.
75
- def store(*pins)
76
- options = pins.last.is_a?(Hash) ? pins.pop : {}
77
- options = { offset: 0
78
- }.merge(options)
79
- pins = pins.flatten.compact
80
- if pins.empty?
81
- fail 'For the V93K you must supply the pins to store/capture'
82
- end
83
- pins.each do |pin|
84
- pin.restore_state do
85
- pin.capture
86
- update_vector_pin_val pin, offset: options[:offset]
87
- last_vector(options[:offset]).dont_compress = true
88
- end
89
- end
90
- end
91
- alias_method :capture, :store
92
-
93
- # Capture the next vector generated to HRAM
94
- #
95
- # This method applys a store vector (stv) opcode to the next vector to be generated,
96
- # note that is does not actually generate a new vector.
97
- #
98
- # On J750 the pins argument is ignored since the tester only supports whole vector capture.
99
- #
100
- # @example
101
- # $tester.store_next_cycle
102
- # $tester.cycle # This is the vector that will be captured
103
- def store_next_cycle(*pins)
104
- options = pins.last.is_a?(Hash) ? pins.pop : {}
105
- options = {
106
- }.merge(options)
107
- pins = pins.flatten.compact
108
- if pins.empty?
109
- fail 'For the V93K you must supply the pins to store/capture'
110
- end
111
- pins.each { |pin| pin.save; pin.capture }
112
- # Register this clean up function to be run after the next vector
113
- # is generated, cool or what!
114
- preset_next_vector do
115
- pins.each(&:restore)
116
- end
117
- end
118
-
119
- # Start a subroutine.
120
- #
121
- # Generates a global subroutine label. Global is used to adhere to the best practice of
122
- # containing all subroutines in dedicated patterns, e.g. global_subs.atp
123
- #
124
- # ==== Examples
125
- # $tester.start_subroutine("wait_for_done")
126
- # < generate your subroutine vectors here >
127
- # $tester.end_subroutine
128
- def start_subroutine(name)
129
- local_subroutines << name.to_s.chomp unless local_subroutines.include?(name.to_s.chomp) || @inhibit_vectors
130
- # name += "_subr" unless name =~ /sub/
131
- Pattern.open name: name, call_startup_callbacks: false
132
- end
133
-
134
- # Ends the current subroutine that was started with a previous call to start_subroutine
135
- def end_subroutine(_cond = false)
136
- Pattern.close call_shutdown_callbacks: false
137
- end
138
-
139
- # Call a subroutine.
140
- #
141
- # This calls a subroutine immediately following previous vector, it does not
142
- # generate a new vector.
143
- #
144
- # Subroutines should always be called through this method as it ensures a running
145
- # log of called subroutines is maintained and which then gets output in the pattern
146
- # header to import the right dependencies.
147
- #
148
- # An offset option is available to make the call on earlier vectors.
149
- #
150
- # Repeated calls to the same subroutine will automatically be compressed unless
151
- # option :suppress_repeated_calls is supplied and set to false. This means that for
152
- # the common use case of calling a subroutine to implement an overlay the subroutine
153
- # can be called for every bit that has the overlay and the pattern will automatically
154
- # generate correctly.
155
- #
156
- # ==== Examples
157
- # $tester.call_subroutine("mysub")
158
- # $tester.call_subroutine("my_other_sub", :offset => -1)
159
- def call_subroutine(name, options = {})
160
- options = {
161
- offset: 0,
162
- suppress_repeated_calls: true
163
- }.merge(options)
164
- called_subroutines << name.to_s.chomp unless called_subroutines.include?(name.to_s.chomp) || @inhibit_vectors
165
-
166
- code = "SQPG JSUB #{name};"
167
- if !options[:suppress_repeated_calls] ||
168
- last_object != code
169
- microcode code, offset: (options[:offset] * -1)
170
- end
171
- end
172
-
173
- # Handshake with the tester.
174
- #
175
- # ==== Examples
176
- # $tester.handshake # Pass control to the tester for a measurement
177
- def handshake(options = {})
178
- options = {
179
- }.merge(options)
180
- Pattern.split(options)
181
- end
182
-
183
- # Do a frequency measure.
184
- #
185
- # ==== Examples
186
- # $tester.freq_count($top.pin(:d_out)) # Freq measure on pin "d_out"
187
- def freq_count(_pin, options = {})
188
- options = {
189
- }.merge(options)
190
- Pattern.split(options)
191
- end
192
-
193
- # Generates a match loop on up to two pins.
194
- #
195
- # This method is not really intended to be called directly, rather you should call
196
- # via Tester#wait e.g. $tester.wait(:match => true).
197
- #
198
- # The timeout should be provided in cycles, however when called via the wait method the
199
- # time-based helpers (time_in_us, etc) will be converted to cycles for you.
200
- # The following options are available to tailor the match loop behavior, defaults in
201
- # parenthesis:
202
- #
203
- # * :pin - The pin object to match on (*required*)
204
- # * :state - The pin state to match on, :low or :high (*required*)
205
- # * :check_for_fails (false) - Flushes the pipeline and checks for fails prior to the match (to allow binout of fails encountered before the match)
206
- # * :pin2 (nil) - Optionally supply a second pin to match on
207
- # * :state2 (nil) - State for the second pin (required if :pin2 is supplied)
208
- # * :force_fail_on_timeout (true) - Force a vector mis-compare if the match loop times out
209
- #
210
- # ==== Examples
211
- # $tester.wait(:match => true, :time_in_us => 5000, :pin => $top.pin(:done), :state => :high)
212
- def match(pin, state, timeout, options = {})
213
- options = {
214
- check_for_fails: false,
215
- pin2: false,
216
- state2: false,
217
- force_fail_on_timeout: true,
218
- global_loops: false,
219
- generate_subroutine: false,
220
- force_fail_on_timeout: true
221
- }.merge(options)
222
-
223
- # Ensure the match pins are don't care by default
224
- pin.dont_care
225
- options[:pin2].dont_care if options[:pin2]
226
-
227
- # Single condition loops are simple
228
- if !options[:pin2]
229
- # Use the counted match loop (rather than timed) which is recommended in the V93K docs for new applications
230
- # No pre-match failure handling is required here because the system will cleanly record failure info
231
- # for this kind of match loop
232
-
233
- cc "for the #{pin.name.upcase} pin to go #{state.to_s.upcase}"
234
- number_of_loops = (timeout.to_f / 8).ceil
235
- microcode "SQPG MACT #{number_of_loops};"
236
- # Strobe the pin for the required state
237
- state == :low ? pin.expect_lo! : pin.expect_hi!
238
- pin.dont_care
239
- # Wait for 7 vectors before re-checking, this keeps the loop to 8 vectors which allows the test results
240
- # to be reconstructed cleanly if multiple loops are called in a pattern
241
- microcode 'SQPG MRPT 7;'
242
- # Not sure if no compression is really required here...
243
- 7.times do
244
- cycle(dont_compress: true)
245
- end
246
- microcode 'SQPG PADDING;'
247
-
248
- else
249
-
250
- # For two pins do something more like the J750 approach where branching based on miscompares is used
251
- # to keep the loop going
252
- cc "for the #{pin.name.upcase} pin to go #{state.to_s.upcase}"
253
- cc "or the #{options[:pin2].name.upcase} pin to go #{options[:state2].to_s.upcase}"
254
-
255
- if options[:check_for_fails]
256
- cc 'Return preserving existing errors if the pattern has already failed before arriving here'
257
- cycle(repeat: propagation_delay)
258
- microcode 'SQPG RETC 1 1;'
259
- end
260
- number_of_loops = (timeout.to_f / ((propagation_delay * 2) + 2)).ceil
261
-
262
- loop_vectors number_of_loops do
263
- # Check pin 1
264
- cc "Check if #{pin.name.upcase} is #{state.to_s.upcase} yet"
265
- state == :low ? pin.expect_lo! : pin.expect_hi!
266
- pin.dont_care
267
- cc 'Wait for failure to propagate'
268
- cycle(repeat: propagation_delay)
269
- cc 'Exit match loop if pin has matched (no error), otherwise clear error and remain in loop'
270
- microcode 'SQPG RETC 0 0;'
271
-
272
- # Check pin 2
273
- cc "Check if #{options[:pin2].name.upcase} is #{options[:state2].to_s.upcase} yet"
274
- options[:state2] == :low ? options[:pin2].expect_lo! : options[:pin2].expect_hi!
275
- options[:pin2].dont_care
276
- cc 'Wait for failure to propagate'
277
- cycle(repeat: propagation_delay)
278
- cc 'Exit match loop if pin has matched (no error), otherwise clear error and remain in loop'
279
- microcode 'SQPG RETC 0 0;'
280
- end
281
-
282
- if options[:force_fail_on_timeout]
283
- cc 'To get here something has gone wrong, strobe again to force a pattern failure'
284
- state == :low ? pin.expect_lo : pin.expect_hi
285
- options[:state2] == :low ? options[:pin2].expect_lo : options[:pin2].expect_hi if options[:pin2]
286
- cycle
287
- pin.dont_care
288
- options[:pin2].dont_care if options[:pin2]
289
- end
290
- microcode 'SQPG RSUB;'
291
-
292
- end
293
- end
294
-
295
- # Returns the number of cycles to wait for any fails to propagate through the pipeline based on
296
- # the current timeset
297
- def propagation_delay
298
- # From 'Calculating the buffer cycles for JMPE and RETC (and match loops)' in SmarTest docs
299
- data_queue_buffer = (([105, 64 + ((125 + current_period_in_ns - 1) / current_period_in_ns).ceil].min + 3) * 8) + 72
300
- # Don't know how to calculate at runtime, hardcoding these to some default values for now
301
- number_of_sites = 128
302
- sclk_period = 40
303
- prop_delay_buffer = 195 + ((2 * number_of_sites + 3) * (sclk_period / 2))
304
- data_queue_buffer + prop_delay_buffer
305
- end
306
-
307
- # Add a loop to the pattern.
308
- #
309
- # Pass in the number of times to execute it, all vectors
310
- # generated by the given block will be captured in the loop.
311
- #
312
- # ==== Examples
313
- # $tester.loop_vectors 3 do # Do this 3 times...
314
- # $tester.cycle
315
- # some_other_method_to_generate_vectors
316
- # end
317
- #
318
- # For compatibility with the J750 you can supply a name as the first argument
319
- # and that will simply be ignored when generated for the V93K tester...
320
- #
321
- # $tester.loop_vectors "my_loop", 3 do # Do this 3 times...
322
- # $tester.cycle
323
- # some_other_method_to_generate_vectors
324
- # end
325
- def loop_vectors(name = nil, number_of_loops = 1, _global = false)
326
- # The name argument is present to maych J750 API, sort out the
327
- unless name.is_a?(String)
328
- name, number_of_loops, global = nil, name, number_of_loops
329
- end
330
- if number_of_loops > 1
331
- microcode "SQPG LBGN #{number_of_loops};"
332
- yield
333
- microcode 'SQPG LEND;'
334
- else
335
- yield
336
- end
337
- end
338
- alias_method :loop_vector, :loop_vectors
339
-
340
- # An internal method called by Origen to create the pattern header
341
- def pattern_header(options = {})
342
- options = {
343
- }.merge(options)
344
- pin_list = ordered_pins.map do |p|
345
- if Origen.app.pin_pattern_order.include?(p.id)
346
- p.id # specified name overrides pin name
347
- else
348
- p.name
349
- end
350
- end.join(' ')
351
- microcode "FORMAT #{pin_list};"
352
- max_pin_name_length = ordered_pins.map(&:name).max { |a, b| a.length <=> b.length }.length
353
- pin_widths = ordered_pins.map { |p| p.size - 1 }
354
-
355
- max_pin_name_length.times do |i|
356
- cc((' ' * 50) + ordered_pins.map.with_index { |p, x| ((p.name[i] || ' ') + ' ' * pin_widths[x]).gsub('_', '-') }.join(' '))
357
- end
358
- end
359
-
360
- # An internal method called by Origen to generate the pattern footer
361
- def pattern_footer(_options = {})
362
- microcode 'SQPG STOP;'
363
- end
364
-
365
- # Returns an array of subroutines called while generating the current pattern
366
- def called_subroutines
367
- @called_subroutines ||= []
368
- end
369
-
370
- # Returns an array of subroutines created by the current pattern
371
- def local_subroutines # :nodoc:
372
- @local_subroutines ||= []
373
- end
374
-
375
- # This is an internal method use by Origen which returns a fully formatted vector
376
- # You can override this if you wish to change the output formatting at vector level
377
- def format_vector(vec)
378
- timeset = vec.timeset ? "#{vec.timeset.name}" : ''
379
- pin_vals = vec.pin_vals ? "#{vec.pin_vals} ;" : ''
380
- if vec.repeat # > 1
381
- microcode = "R#{vec.repeat}"
382
- else
383
- microcode = vec.microcode ? vec.microcode : ''
384
- end
385
- # if vec.pin_vals && vec.number && vec.cycle_number
386
- # comment = " // Vector #{@pattern_vectors}, Cycle #{@pattern_cycles}"
387
- # else
388
- comment = ''
389
- # end
390
- "#{microcode.ljust(25)} #{timeset.ljust(25)} #{pin_vals} #{comment}"
391
- end
392
-
393
- # All vectors generated with the supplied block will have all pins set
394
- # to the repeat previous state. Any pins that are changed state within
395
- # the block will still update to the supplied value.
396
- # ==== Example
397
- # # All pins except invoke will be assigned the repeat previous code
398
- # # in the generated vector. On completion of the block they will
399
- # # return to their previous state, except for invoke which will
400
- # # retain the value assigned within the block.
401
- # $tester.repeat_previous do
402
- # $top.pin(:invoke).drive(1)
403
- # $tester.cycle
404
- # end
405
- def repeat_previous
406
- Origen.app.pin_map.each { |_id, pin| pin.repeat_previous = true }
407
- yield
408
- Origen.app.pin_map.each { |_id, pin| pin.repeat_previous = false }
409
- end
410
-
411
- def before_timeset_change(options = {})
412
- microcode "SQPG CTIM #{options[:new].name};"
413
- end
414
-
415
- def v93k?
416
- true
417
- end
418
- end
419
- end
420
- end