origen_testers 0.9.9 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. checksums.yaml +4 -4
  2. data/config/application.rb +151 -151
  3. data/config/boot.rb +13 -12
  4. data/config/commands.rb +86 -86
  5. data/config/users.rb +18 -18
  6. data/config/version.rb +8 -8
  7. data/lib/commands/build.rb +69 -69
  8. data/lib/commands/run.rb +48 -48
  9. data/lib/origen_testers.rb +47 -46
  10. data/lib/origen_testers/api.rb +381 -292
  11. data/lib/origen_testers/basic_test_setups.rb +105 -105
  12. data/lib/origen_testers/callback_handlers.rb +59 -59
  13. data/lib/origen_testers/command_based_tester.rb +45 -45
  14. data/lib/origen_testers/flow.rb +382 -382
  15. data/lib/origen_testers/generator.rb +283 -283
  16. data/lib/origen_testers/generator/identity_map.rb +23 -23
  17. data/lib/origen_testers/generator/placeholder.rb +11 -11
  18. data/lib/origen_testers/generator/test_numberer.rb +23 -23
  19. data/lib/origen_testers/igxl_based_tester.rb +12 -12
  20. data/lib/origen_testers/igxl_based_tester/base.rb +1095 -929
  21. data/lib/origen_testers/igxl_based_tester/base/ac_specsets.rb +79 -79
  22. data/lib/origen_testers/igxl_based_tester/base/custom_test_instance.rb +169 -169
  23. data/lib/origen_testers/igxl_based_tester/base/dc_specsets.rb +98 -98
  24. data/lib/origen_testers/igxl_based_tester/base/edge.rb +60 -60
  25. data/lib/origen_testers/igxl_based_tester/base/edges.rb +24 -24
  26. data/lib/origen_testers/igxl_based_tester/base/edgeset.rb +39 -39
  27. data/lib/origen_testers/igxl_based_tester/base/edgesets.rb +130 -130
  28. data/lib/origen_testers/igxl_based_tester/base/flow.rb +446 -446
  29. data/lib/origen_testers/igxl_based_tester/base/flow_line.rb +276 -276
  30. data/lib/origen_testers/igxl_based_tester/base/generator.rb +607 -607
  31. data/lib/origen_testers/igxl_based_tester/base/global_specs.rb +83 -83
  32. data/lib/origen_testers/igxl_based_tester/base/job.rb +75 -75
  33. data/lib/origen_testers/igxl_based_tester/base/jobs.rb +44 -44
  34. data/lib/origen_testers/igxl_based_tester/base/level_io_se.rb +59 -59
  35. data/lib/origen_testers/igxl_based_tester/base/level_supply.rb +39 -39
  36. data/lib/origen_testers/igxl_based_tester/base/levels.rb +31 -31
  37. data/lib/origen_testers/igxl_based_tester/base/levelset.rb +110 -110
  38. data/lib/origen_testers/igxl_based_tester/base/patgroup.rb +109 -109
  39. data/lib/origen_testers/igxl_based_tester/base/patgroups.rb +38 -38
  40. data/lib/origen_testers/igxl_based_tester/base/patset.rb +68 -68
  41. data/lib/origen_testers/igxl_based_tester/base/patset_pattern.rb +56 -56
  42. data/lib/origen_testers/igxl_based_tester/base/patsets.rb +38 -38
  43. data/lib/origen_testers/igxl_based_tester/base/patsubr.rb +68 -68
  44. data/lib/origen_testers/igxl_based_tester/base/patsubr_pattern.rb +56 -56
  45. data/lib/origen_testers/igxl_based_tester/base/patsubrs.rb +38 -38
  46. data/lib/origen_testers/igxl_based_tester/base/pinmap.rb +93 -93
  47. data/lib/origen_testers/igxl_based_tester/base/references.rb +25 -25
  48. data/lib/origen_testers/igxl_based_tester/base/test_instance.rb +322 -322
  49. data/lib/origen_testers/igxl_based_tester/base/test_instance_group.rb +66 -66
  50. data/lib/origen_testers/igxl_based_tester/base/test_instances.rb +212 -212
  51. data/lib/origen_testers/igxl_based_tester/base/test_instances/custom_til.rb +37 -37
  52. data/lib/origen_testers/igxl_based_tester/base/timeset.rb +37 -37
  53. data/lib/origen_testers/igxl_based_tester/base/timesets.rb +49 -49
  54. data/lib/origen_testers/igxl_based_tester/base/timesets_basic.rb +49 -49
  55. data/lib/origen_testers/igxl_based_tester/files.rb +43 -43
  56. data/lib/origen_testers/igxl_based_tester/j750.rb +269 -269
  57. data/lib/origen_testers/igxl_based_tester/j750/custom_test_instance.rb +32 -32
  58. data/lib/origen_testers/igxl_based_tester/j750/flow.rb +10 -10
  59. data/lib/origen_testers/igxl_based_tester/j750/flow_line.rb +19 -19
  60. data/lib/origen_testers/igxl_based_tester/j750/generator.rb +19 -19
  61. data/lib/origen_testers/igxl_based_tester/j750/patgroup.rb +9 -9
  62. data/lib/origen_testers/igxl_based_tester/j750/patgroups.rb +10 -10
  63. data/lib/origen_testers/igxl_based_tester/j750/patset.rb +9 -9
  64. data/lib/origen_testers/igxl_based_tester/j750/patset_pattern.rb +18 -18
  65. data/lib/origen_testers/igxl_based_tester/j750/patsets.rb +10 -10
  66. data/lib/origen_testers/igxl_based_tester/j750/patsubr.rb +9 -9
  67. data/lib/origen_testers/igxl_based_tester/j750/patsubr_pattern.rb +18 -18
  68. data/lib/origen_testers/igxl_based_tester/j750/patsubrs.rb +10 -10
  69. data/lib/origen_testers/igxl_based_tester/j750/test_instance.rb +746 -746
  70. data/lib/origen_testers/igxl_based_tester/j750/test_instance_group.rb +9 -9
  71. data/lib/origen_testers/igxl_based_tester/j750/test_instances.rb +10 -10
  72. data/lib/origen_testers/igxl_based_tester/j750_hpt.rb +34 -34
  73. data/lib/origen_testers/igxl_based_tester/j750_hpt/custom_test_instance.rb +32 -32
  74. data/lib/origen_testers/igxl_based_tester/j750_hpt/flow.rb +9 -9
  75. data/lib/origen_testers/igxl_based_tester/j750_hpt/flow_line.rb +9 -9
  76. data/lib/origen_testers/igxl_based_tester/j750_hpt/generator.rb +19 -19
  77. data/lib/origen_testers/igxl_based_tester/j750_hpt/patgroup.rb +9 -9
  78. data/lib/origen_testers/igxl_based_tester/j750_hpt/patgroups.rb +9 -9
  79. data/lib/origen_testers/igxl_based_tester/j750_hpt/patset.rb +9 -9
  80. data/lib/origen_testers/igxl_based_tester/j750_hpt/patset_pattern.rb +9 -9
  81. data/lib/origen_testers/igxl_based_tester/j750_hpt/patsets.rb +9 -9
  82. data/lib/origen_testers/igxl_based_tester/j750_hpt/patsubr.rb +9 -9
  83. data/lib/origen_testers/igxl_based_tester/j750_hpt/patsubr_pattern.rb +9 -9
  84. data/lib/origen_testers/igxl_based_tester/j750_hpt/patsubrs.rb +9 -9
  85. data/lib/origen_testers/igxl_based_tester/j750_hpt/test_instance.rb +599 -599
  86. data/lib/origen_testers/igxl_based_tester/j750_hpt/test_instance_group.rb +9 -9
  87. data/lib/origen_testers/igxl_based_tester/j750_hpt/test_instances.rb +9 -9
  88. data/lib/origen_testers/igxl_based_tester/parser.rb +102 -102
  89. data/lib/origen_testers/igxl_based_tester/parser/ac_spec.rb +9 -9
  90. data/lib/origen_testers/igxl_based_tester/parser/dc_spec.rb +33 -33
  91. data/lib/origen_testers/igxl_based_tester/parser/dc_specs.rb +48 -48
  92. data/lib/origen_testers/igxl_based_tester/parser/descriptions.rb +339 -339
  93. data/lib/origen_testers/igxl_based_tester/parser/flow.rb +109 -109
  94. data/lib/origen_testers/igxl_based_tester/parser/flow_line.rb +203 -203
  95. data/lib/origen_testers/igxl_based_tester/parser/flows.rb +21 -21
  96. data/lib/origen_testers/igxl_based_tester/parser/pattern_set.rb +92 -92
  97. data/lib/origen_testers/igxl_based_tester/parser/pattern_sets.rb +31 -31
  98. data/lib/origen_testers/igxl_based_tester/parser/test_instance.rb +420 -420
  99. data/lib/origen_testers/igxl_based_tester/parser/test_instances.rb +24 -24
  100. data/lib/origen_testers/igxl_based_tester/parser/timeset.rb +13 -13
  101. data/lib/origen_testers/igxl_based_tester/ultraflex.rb +798 -691
  102. data/lib/origen_testers/igxl_based_tester/ultraflex/ac_specsets.rb +10 -10
  103. data/lib/origen_testers/igxl_based_tester/ultraflex/ate_hardware.rb +949 -949
  104. data/lib/origen_testers/igxl_based_tester/ultraflex/custom_test_instance.rb +36 -36
  105. data/lib/origen_testers/igxl_based_tester/ultraflex/dc_specsets.rb +10 -10
  106. data/lib/origen_testers/igxl_based_tester/ultraflex/edge.rb +9 -9
  107. data/lib/origen_testers/igxl_based_tester/ultraflex/edges.rb +9 -9
  108. data/lib/origen_testers/igxl_based_tester/ultraflex/edgeset.rb +9 -9
  109. data/lib/origen_testers/igxl_based_tester/ultraflex/edgesets.rb +10 -10
  110. data/lib/origen_testers/igxl_based_tester/ultraflex/flow.rb +158 -158
  111. data/lib/origen_testers/igxl_based_tester/ultraflex/flow_line.rb +19 -19
  112. data/lib/origen_testers/igxl_based_tester/ultraflex/generator.rb +19 -19
  113. data/lib/origen_testers/igxl_based_tester/ultraflex/global_specs.rb +10 -10
  114. data/lib/origen_testers/igxl_based_tester/ultraflex/job.rb +9 -9
  115. data/lib/origen_testers/igxl_based_tester/ultraflex/jobs.rb +10 -10
  116. data/lib/origen_testers/igxl_based_tester/ultraflex/level_io_se.rb +9 -9
  117. data/lib/origen_testers/igxl_based_tester/ultraflex/level_supply.rb +9 -9
  118. data/lib/origen_testers/igxl_based_tester/ultraflex/levels.rb +9 -9
  119. data/lib/origen_testers/igxl_based_tester/ultraflex/levelset.rb +10 -10
  120. data/lib/origen_testers/igxl_based_tester/ultraflex/patgroup.rb +9 -9
  121. data/lib/origen_testers/igxl_based_tester/ultraflex/patgroups.rb +10 -10
  122. data/lib/origen_testers/igxl_based_tester/ultraflex/patset.rb +9 -9
  123. data/lib/origen_testers/igxl_based_tester/ultraflex/patset_pattern.rb +18 -18
  124. data/lib/origen_testers/igxl_based_tester/ultraflex/patsets.rb +10 -10
  125. data/lib/origen_testers/igxl_based_tester/ultraflex/patsubr.rb +9 -9
  126. data/lib/origen_testers/igxl_based_tester/ultraflex/patsubr_pattern.rb +18 -18
  127. data/lib/origen_testers/igxl_based_tester/ultraflex/patsubrs.rb +10 -10
  128. data/lib/origen_testers/igxl_based_tester/ultraflex/pinmap.rb +10 -10
  129. data/lib/origen_testers/igxl_based_tester/ultraflex/references.rb +10 -10
  130. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/ac_specsets.txt.erb +0 -0
  131. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/dc_specsets.txt.erb +0 -0
  132. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/edgesets.txt.erb +0 -0
  133. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/global_specs.txt.erb +0 -0
  134. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/jobs.txt.erb +0 -0
  135. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/levelset.txt.erb +0 -0
  136. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/pinmap.txt.erb +0 -0
  137. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/references.txt.erb +0 -0
  138. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/timesets.txt.erb +0 -0
  139. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/timesets_basic.txt.erb +0 -0
  140. data/lib/origen_testers/igxl_based_tester/ultraflex/test_instance.rb +315 -315
  141. data/lib/origen_testers/igxl_based_tester/ultraflex/test_instance_group.rb +9 -9
  142. data/lib/origen_testers/igxl_based_tester/ultraflex/test_instances.rb +10 -10
  143. data/lib/origen_testers/igxl_based_tester/ultraflex/timeset.rb +9 -9
  144. data/lib/origen_testers/igxl_based_tester/ultraflex/timesets.rb +10 -10
  145. data/lib/origen_testers/igxl_based_tester/ultraflex/timesets_basic.rb +10 -10
  146. data/lib/origen_testers/interface.rb +328 -328
  147. data/lib/origen_testers/memory_style.rb +77 -0
  148. data/lib/origen_testers/no_interface.rb +7 -7
  149. data/lib/origen_testers/origen_ext/application/runner.rb +25 -25
  150. data/lib/origen_testers/origen_ext/generator.rb +54 -54
  151. data/lib/origen_testers/origen_ext/generator/flow.rb +77 -77
  152. data/lib/origen_testers/origen_ext/generator/resources.rb +21 -21
  153. data/lib/origen_testers/origen_ext/pins/pin.rb +78 -78
  154. data/lib/origen_testers/origen_ext/pins/pin_collection.rb +84 -84
  155. data/lib/origen_testers/parser.rb +22 -22
  156. data/lib/origen_testers/parser/description_lookup.rb +62 -62
  157. data/lib/origen_testers/parser/searchable_array.rb +30 -30
  158. data/lib/origen_testers/parser/searchable_hash.rb +30 -30
  159. data/lib/origen_testers/pattern_compilers.rb +116 -116
  160. data/lib/origen_testers/pattern_compilers/assembler.rb +88 -88
  161. data/lib/origen_testers/pattern_compilers/job.rb +96 -96
  162. data/lib/origen_testers/pattern_compilers/ultraflex_pattern_compiler.rb +599 -599
  163. data/lib/origen_testers/program_generators.rb +62 -62
  164. data/lib/origen_testers/smartest_based_tester.rb +8 -8
  165. data/lib/origen_testers/smartest_based_tester/base.rb +562 -492
  166. data/lib/origen_testers/smartest_based_tester/base/flow.rb +279 -279
  167. data/lib/origen_testers/smartest_based_tester/base/generator.rb +193 -193
  168. data/lib/origen_testers/smartest_based_tester/base/pattern_compiler.rb +32 -32
  169. data/lib/origen_testers/smartest_based_tester/base/pattern_master.rb +69 -69
  170. data/lib/origen_testers/smartest_based_tester/base/processors.rb +13 -13
  171. data/lib/origen_testers/smartest_based_tester/base/processors/empty_branch_cleaner.rb +49 -49
  172. data/lib/origen_testers/smartest_based_tester/base/processors/extract_set_variables.rb +22 -22
  173. data/lib/origen_testers/smartest_based_tester/base/processors/flag_optimizer.rb +143 -143
  174. data/lib/origen_testers/smartest_based_tester/base/processors/if_ran_cleaner.rb +34 -34
  175. data/lib/origen_testers/smartest_based_tester/base/test_method.rb +164 -164
  176. data/lib/origen_testers/smartest_based_tester/base/test_methods.rb +73 -73
  177. data/lib/origen_testers/smartest_based_tester/base/test_methods/ac_tml.rb +33 -33
  178. data/lib/origen_testers/smartest_based_tester/base/test_methods/base_tml.rb +38 -38
  179. data/lib/origen_testers/smartest_based_tester/base/test_methods/custom_tml.rb +19 -19
  180. data/lib/origen_testers/smartest_based_tester/base/test_methods/dc_tml.rb +147 -147
  181. data/lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb +65 -65
  182. data/lib/origen_testers/smartest_based_tester/base/test_suite.rb +193 -193
  183. data/lib/origen_testers/smartest_based_tester/base/test_suites.rb +54 -54
  184. data/lib/origen_testers/smartest_based_tester/base/variables_file.rb +38 -38
  185. data/lib/origen_testers/smartest_based_tester/v93k.rb +8 -8
  186. data/lib/origen_testers/smartest_based_tester/v93k/builder.rb +89 -89
  187. data/lib/origen_testers/smartest_based_tester/v93k/builder/flow.rb +181 -181
  188. data/lib/origen_testers/smartest_based_tester/v93k/builder/pattern_master.rb +54 -54
  189. data/lib/origen_testers/smartest_based_tester/v93k/flow.rb +10 -10
  190. data/lib/origen_testers/smartest_based_tester/v93k/generator.rb +19 -19
  191. data/lib/origen_testers/smartest_based_tester/v93k/pattern_compiler.rb +10 -10
  192. data/lib/origen_testers/smartest_based_tester/v93k/pattern_master.rb +10 -10
  193. data/lib/origen_testers/smartest_based_tester/v93k/templates/template.aiv.erb +17 -17
  194. data/lib/origen_testers/smartest_based_tester/v93k/templates/template.pmfl.erb +13 -13
  195. data/lib/origen_testers/smartest_based_tester/v93k/templates/template.tf.erb +214 -214
  196. data/lib/origen_testers/smartest_based_tester/v93k/templates/vars.tf.erb +48 -48
  197. data/lib/origen_testers/smartest_based_tester/v93k/test_method.rb +9 -9
  198. data/lib/origen_testers/smartest_based_tester/v93k/test_methods.rb +9 -9
  199. data/lib/origen_testers/smartest_based_tester/v93k/test_suite.rb +9 -9
  200. data/lib/origen_testers/smartest_based_tester/v93k/test_suites.rb +9 -9
  201. data/lib/origen_testers/smartest_based_tester/v93k/variables_file.rb +10 -10
  202. data/lib/origen_testers/test/basic_interface.rb +17 -17
  203. data/lib/origen_testers/test/block.rb +21 -21
  204. data/lib/origen_testers/test/custom_test_interface.rb +111 -111
  205. data/lib/origen_testers/test/dut.rb +295 -295
  206. data/lib/origen_testers/test/dut2.rb +76 -76
  207. data/lib/origen_testers/test/dut3.rb +244 -0
  208. data/lib/origen_testers/test/interface.rb +503 -503
  209. data/lib/origen_testers/test/nvm.rb +94 -94
  210. data/lib/origen_testers/timing.rb +362 -362
  211. data/lib/origen_testers/vector.rb +207 -207
  212. data/lib/origen_testers/vector_based_tester.rb +41 -41
  213. data/lib/origen_testers/vector_generator.rb +655 -655
  214. data/lib/origen_testers/vector_pipeline.rb +302 -302
  215. data/pattern/bitmap.rb +7 -7
  216. data/pattern/dc_instr.rb +7 -7
  217. data/pattern/delay.rb +7 -7
  218. data/pattern/freq_counter.rb +6 -6
  219. data/pattern/mem_test.rb +8 -8
  220. data/pattern/multi_vector.rb +122 -122
  221. data/pattern/multi_vector_plus1.rb +125 -125
  222. data/pattern/nvm/j750/add_late_pins.rb +3 -3
  223. data/pattern/nvm/j750/iterator_postfix_test_x_bx.rb +8 -8
  224. data/pattern/nvm/j750/iterator_test_x_bx.rb +8 -8
  225. data/pattern/nvm/j750/j750_halt.rb +159 -159
  226. data/pattern/nvm/j750/j750_workout.rb +209 -209
  227. data/pattern/nvm/j750/timing.rb +73 -73
  228. data/pattern/read_write_reg.rb +61 -61
  229. data/pattern/reset.rb +4 -4
  230. data/pattern/subroutines.rb +69 -69
  231. data/pattern/tester_overlay.rb +53 -0
  232. data/pattern/tester_store.rb +29 -0
  233. data/program/_additional_erase.rb +7 -7
  234. data/program/_efa_resources.rb +7 -7
  235. data/program/_erase.rb +25 -25
  236. data/program/_erase_vfy.rb +5 -5
  237. data/program/_iv_resources.rb +10 -10
  238. data/program/basic_interface.rb +5 -5
  239. data/program/components/_temp.rb +6 -6
  240. data/program/custom_tests.rb +10 -10
  241. data/program/flow_control.rb +321 -321
  242. data/program/prb1.rb +219 -219
  243. data/program/prb1_resources.rb +28 -28
  244. data/program/prb2.rb +27 -27
  245. data/program/test.rb +29 -29
  246. data/program/uflex_resources.rb +199 -199
  247. data/templates/example.txt.erb +53 -53
  248. data/templates/j750/program_sheet.txt.erb +9 -9
  249. data/templates/manifest/v93k.yaml.erb +22 -22
  250. data/templates/web/index.md.erb +51 -51
  251. data/templates/web/layouts/_basic.html.erb +15 -15
  252. data/templates/web/partials/_navbar.html.erb +22 -22
  253. data/templates/web/release_notes.md.erb +5 -5
  254. metadata +7 -3
@@ -1,279 +1,279 @@
1
- require 'origen_testers/smartest_based_tester/base/processors'
2
- module OrigenTesters
3
- module SmartestBasedTester
4
- class Base
5
- class Flow < ATP::Formatter
6
- include OrigenTesters::Flow
7
-
8
- attr_accessor :test_suites, :test_methods, :lines, :stack, :var_filename
9
- # Returns an array containing all runtime variables which get set by the flow
10
- attr_reader :set_runtime_variables
11
-
12
- attr_accessor :add_flow_enable
13
-
14
- def var_filename
15
- @var_filename || 'global'
16
- end
17
-
18
- def subdirectory
19
- 'testflow/mfh.testflow.group'
20
- end
21
-
22
- def filename
23
- super.gsub('_flow', '')
24
- end
25
-
26
- def hardware_bin_descriptions
27
- @hardware_bin_descriptions ||= {}
28
- end
29
-
30
- def flow_control_variables
31
- Origen.interface.variables_file(self).flow_control_variables
32
- end
33
-
34
- def runtime_control_variables
35
- Origen.interface.variables_file(self).runtime_control_variables
36
- end
37
-
38
- def at_flow_start
39
- end
40
-
41
- def at_flow_end
42
- end
43
-
44
- def flow_header
45
- h = ['{']
46
- if add_flow_enable
47
- var = filename.sub(/\..*/, '').upcase
48
- var = "#{var}_ENABLE"
49
- if add_flow_enable == :enabled
50
- flow_control_variables << [var, 1]
51
- else
52
- flow_control_variables << [var, 0]
53
- end
54
- h << " if @#{var} == 1 then"
55
- h << ' {'
56
- i = ' '
57
- else
58
- i = ''
59
- end
60
-
61
- h << i + ' {'
62
- set_runtime_variables.each do |var|
63
- h << i + " @#{var.to_s.upcase} = -1;"
64
- end
65
- h << i + ' }, open,"Init Flow Control Vars", ""'
66
- h
67
- end
68
-
69
- def flow_footer
70
- f = []
71
- if add_flow_enable
72
- f << ' }'
73
- f << ' else'
74
- f << ' {'
75
- f << ' }'
76
- end
77
- f << "}, open,\"#{filename.sub(/\..*/, '').upcase}\", \"\""
78
- f
79
- end
80
-
81
- def finalize(options = {})
82
- super
83
- test_suites.finalize
84
- test_methods.finalize
85
- @indent = add_flow_enable ? 2 : 1
86
- @lines = []
87
- @stack = { on_fail: [], on_pass: [] }
88
- m = Processors::IfRanCleaner.new.process(model.ast)
89
- m = Processors::EmptyBranchCleaner.new.process(m)
90
- m = Processors::FlagOptimizer.new.process(m)
91
- @set_runtime_variables = Processors::ExtractSetVariables.new.run(m)
92
- process(m)
93
- end
94
-
95
- def line(str)
96
- @lines << (' ' * @indent) + str
97
- end
98
-
99
- # def on_flow(node)
100
- # line '{'
101
- # @indent += 1
102
- # process_all(node.children)
103
- # @indent -= 1
104
- # line "}, open,\"#{unique_group_name(node.find(:name).value)}\", \"\""
105
- # end
106
-
107
- def on_test(node)
108
- name = node.find(:object).to_a[0]
109
- name = name.name unless name.is_a?(String)
110
- if node.children.any? { |n| t = n.try(:type); t == :on_fail || t == :on_pass } ||
111
- !stack[:on_pass].empty? || !stack[:on_fail].empty?
112
- line "run_and_branch(#{name})"
113
- process_all(node.to_a.reject { |n| t = n.try(:type); t == :on_fail || t == :on_pass })
114
- line 'then'
115
- line '{'
116
- @indent += 1
117
- on_pass = node.children.find { |n| n.try(:type) == :on_pass }
118
- process_all(on_pass) if on_pass
119
- stack[:on_pass].each { |n| process_all(n) }
120
- @indent -= 1
121
- line '}'
122
- line 'else'
123
- line '{'
124
- @indent += 1
125
- on_fail = node.children.find { |n| n.try(:type) == :on_fail }
126
- with_continue(on_fail ? on_fail.children.any? { |n| n.try(:type) == :continue } : false) do
127
- process_all(on_fail) if on_fail
128
- stack[:on_fail].each { |n| process_all(n) }
129
- end
130
- @indent -= 1
131
- line '}'
132
- else
133
- line "run(#{name});"
134
- end
135
- end
136
-
137
- def on_render(node)
138
- node.to_a[0].split("\n").each do |l|
139
- line(l)
140
- end
141
- end
142
-
143
- def on_job(node)
144
- jobs, state, *nodes = *node
145
- jobs = clean_job(jobs)
146
- runtime_control_variables << ['JOB', '']
147
- condition = jobs.join(' or ')
148
- line "if #{condition} then"
149
- line '{'
150
- @indent += 1
151
- process_all(node) if state
152
- @indent -= 1
153
- line '}'
154
- line 'else'
155
- line '{'
156
- @indent += 1
157
- process_all(node) unless state
158
- @indent -= 1
159
- line '}'
160
- end
161
-
162
- def on_condition_flag(node)
163
- flag, state, *nodes = *node
164
- if flag.is_a?(Array)
165
- condition = flag.map { |f| "@#{f.upcase} == 1" }.join(' or ')
166
- else
167
- condition = "@#{flag.upcase} == 1"
168
- end
169
- line "if #{condition} then"
170
- line '{'
171
- @indent += 1
172
- process_all(nodes) if state
173
- @indent -= 1
174
- line '}'
175
- line 'else'
176
- line '{'
177
- @indent += 1
178
- process_all(nodes) unless state
179
- @indent -= 1
180
- line '}'
181
- end
182
-
183
- def on_flow_flag(node)
184
- flag, state, *nodes = *node
185
- [flag].flatten.each do |f|
186
- flow_control_variables << f.upcase
187
- end
188
- on_condition_flag(node)
189
- end
190
-
191
- def on_run_flag(node)
192
- flag, state, *nodes = *node
193
- [flag].flatten.each do |f|
194
- runtime_control_variables << f.upcase
195
- end
196
- on_condition_flag(node)
197
- end
198
-
199
- def on_enable_flow_flag(node)
200
- flag = node.value.upcase
201
- flow_control_variables << flag
202
- line "@#{flag} = 1;"
203
- end
204
-
205
- def on_disable_flow_flag(node)
206
- flag = node.value.upcase
207
- flow_control_variables << flag
208
- line "@#{flag} = 0;"
209
- end
210
-
211
- def on_set_run_flag(node)
212
- flag = node.value.upcase
213
- runtime_control_variables << flag
214
- line "@#{flag} = 1;"
215
- end
216
-
217
- def on_group(node)
218
- on_fail = node.children.find { |n| n.try(:type) == :on_fail }
219
- on_pass = node.children.find { |n| n.try(:type) == :on_pass }
220
- with_continue(on_fail && on_fail.children.any? { |n| n.try(:type) == :continue }) do
221
- line '{'
222
- @indent += 1
223
- stack[:on_fail] << on_fail if on_fail
224
- stack[:on_pass] << on_pass if on_pass
225
- process_all(node.children - [on_fail, on_pass])
226
- stack[:on_fail].pop if on_fail
227
- stack[:on_pass].pop if on_pass
228
- @indent -= 1
229
- line "}, open,\"#{unique_group_name(node.find(:name).value)}\", \"\""
230
- end
231
- end
232
-
233
- def on_set_result(node)
234
- unless @continue
235
- bin = node.find(:bin).try(:value)
236
- desc = node.find(:bin).to_a[1]
237
- sbin = node.find(:softbin).try(:value)
238
- sdesc = node.find(:softbin).to_a[1] || 'fail'
239
- if bin && desc
240
- hardware_bin_descriptions[bin] ||= desc
241
- end
242
-
243
- if node.to_a[0] == 'pass'
244
- line "stop_bin \"#{sbin}\", \"\", , good, noreprobe, green, #{bin}, over_on;"
245
- else
246
- line "stop_bin \"#{sbin}\", \"#{sdesc}\", , bad, noreprobe, red, #{bin}, over_on;"
247
- end
248
- end
249
- end
250
-
251
- def on_log(node)
252
- line "print_dl(\"#{node.to_a[0]}\");"
253
- end
254
-
255
- def unique_group_name(name)
256
- @group_names ||= {}
257
- if @group_names[name]
258
- @group_names[name] += 1
259
- "#{name}_#{@group_names[name]}"
260
- else
261
- @group_names[name] = 1
262
- name
263
- end
264
- end
265
-
266
- def clean_job(job)
267
- [job].flatten.map { |j| "@JOB == \"#{j.to_s.upcase}\"" }
268
- end
269
-
270
- def with_continue(value)
271
- orig = @continue
272
- @continue = true if value
273
- yield
274
- @continue = orig
275
- end
276
- end
277
- end
278
- end
279
- end
1
+ require 'origen_testers/smartest_based_tester/base/processors'
2
+ module OrigenTesters
3
+ module SmartestBasedTester
4
+ class Base
5
+ class Flow < ATP::Formatter
6
+ include OrigenTesters::Flow
7
+
8
+ attr_accessor :test_suites, :test_methods, :lines, :stack, :var_filename
9
+ # Returns an array containing all runtime variables which get set by the flow
10
+ attr_reader :set_runtime_variables
11
+
12
+ attr_accessor :add_flow_enable
13
+
14
+ def var_filename
15
+ @var_filename || 'global'
16
+ end
17
+
18
+ def subdirectory
19
+ 'testflow/mfh.testflow.group'
20
+ end
21
+
22
+ def filename
23
+ super.gsub('_flow', '')
24
+ end
25
+
26
+ def hardware_bin_descriptions
27
+ @hardware_bin_descriptions ||= {}
28
+ end
29
+
30
+ def flow_control_variables
31
+ Origen.interface.variables_file(self).flow_control_variables
32
+ end
33
+
34
+ def runtime_control_variables
35
+ Origen.interface.variables_file(self).runtime_control_variables
36
+ end
37
+
38
+ def at_flow_start
39
+ end
40
+
41
+ def at_flow_end
42
+ end
43
+
44
+ def flow_header
45
+ h = ['{']
46
+ if add_flow_enable
47
+ var = filename.sub(/\..*/, '').upcase
48
+ var = "#{var}_ENABLE"
49
+ if add_flow_enable == :enabled
50
+ flow_control_variables << [var, 1]
51
+ else
52
+ flow_control_variables << [var, 0]
53
+ end
54
+ h << " if @#{var} == 1 then"
55
+ h << ' {'
56
+ i = ' '
57
+ else
58
+ i = ''
59
+ end
60
+
61
+ h << i + ' {'
62
+ set_runtime_variables.each do |var|
63
+ h << i + " @#{var.to_s.upcase} = -1;"
64
+ end
65
+ h << i + ' }, open,"Init Flow Control Vars", ""'
66
+ h
67
+ end
68
+
69
+ def flow_footer
70
+ f = []
71
+ if add_flow_enable
72
+ f << ' }'
73
+ f << ' else'
74
+ f << ' {'
75
+ f << ' }'
76
+ end
77
+ f << "}, open,\"#{filename.sub(/\..*/, '').upcase}\", \"\""
78
+ f
79
+ end
80
+
81
+ def finalize(options = {})
82
+ super
83
+ test_suites.finalize
84
+ test_methods.finalize
85
+ @indent = add_flow_enable ? 2 : 1
86
+ @lines = []
87
+ @stack = { on_fail: [], on_pass: [] }
88
+ m = Processors::IfRanCleaner.new.process(model.ast)
89
+ m = Processors::EmptyBranchCleaner.new.process(m)
90
+ m = Processors::FlagOptimizer.new.process(m)
91
+ @set_runtime_variables = Processors::ExtractSetVariables.new.run(m)
92
+ process(m)
93
+ end
94
+
95
+ def line(str)
96
+ @lines << (' ' * @indent) + str
97
+ end
98
+
99
+ # def on_flow(node)
100
+ # line '{'
101
+ # @indent += 1
102
+ # process_all(node.children)
103
+ # @indent -= 1
104
+ # line "}, open,\"#{unique_group_name(node.find(:name).value)}\", \"\""
105
+ # end
106
+
107
+ def on_test(node)
108
+ name = node.find(:object).to_a[0]
109
+ name = name.name unless name.is_a?(String)
110
+ if node.children.any? { |n| t = n.try(:type); t == :on_fail || t == :on_pass } ||
111
+ !stack[:on_pass].empty? || !stack[:on_fail].empty?
112
+ line "run_and_branch(#{name})"
113
+ process_all(node.to_a.reject { |n| t = n.try(:type); t == :on_fail || t == :on_pass })
114
+ line 'then'
115
+ line '{'
116
+ @indent += 1
117
+ on_pass = node.children.find { |n| n.try(:type) == :on_pass }
118
+ process_all(on_pass) if on_pass
119
+ stack[:on_pass].each { |n| process_all(n) }
120
+ @indent -= 1
121
+ line '}'
122
+ line 'else'
123
+ line '{'
124
+ @indent += 1
125
+ on_fail = node.children.find { |n| n.try(:type) == :on_fail }
126
+ with_continue(on_fail ? on_fail.children.any? { |n| n.try(:type) == :continue } : false) do
127
+ process_all(on_fail) if on_fail
128
+ stack[:on_fail].each { |n| process_all(n) }
129
+ end
130
+ @indent -= 1
131
+ line '}'
132
+ else
133
+ line "run(#{name});"
134
+ end
135
+ end
136
+
137
+ def on_render(node)
138
+ node.to_a[0].split("\n").each do |l|
139
+ line(l)
140
+ end
141
+ end
142
+
143
+ def on_job(node)
144
+ jobs, state, *nodes = *node
145
+ jobs = clean_job(jobs)
146
+ runtime_control_variables << ['JOB', '']
147
+ condition = jobs.join(' or ')
148
+ line "if #{condition} then"
149
+ line '{'
150
+ @indent += 1
151
+ process_all(node) if state
152
+ @indent -= 1
153
+ line '}'
154
+ line 'else'
155
+ line '{'
156
+ @indent += 1
157
+ process_all(node) unless state
158
+ @indent -= 1
159
+ line '}'
160
+ end
161
+
162
+ def on_condition_flag(node)
163
+ flag, state, *nodes = *node
164
+ if flag.is_a?(Array)
165
+ condition = flag.map { |f| "@#{f.upcase} == 1" }.join(' or ')
166
+ else
167
+ condition = "@#{flag.upcase} == 1"
168
+ end
169
+ line "if #{condition} then"
170
+ line '{'
171
+ @indent += 1
172
+ process_all(nodes) if state
173
+ @indent -= 1
174
+ line '}'
175
+ line 'else'
176
+ line '{'
177
+ @indent += 1
178
+ process_all(nodes) unless state
179
+ @indent -= 1
180
+ line '}'
181
+ end
182
+
183
+ def on_flow_flag(node)
184
+ flag, state, *nodes = *node
185
+ [flag].flatten.each do |f|
186
+ flow_control_variables << f.upcase
187
+ end
188
+ on_condition_flag(node)
189
+ end
190
+
191
+ def on_run_flag(node)
192
+ flag, state, *nodes = *node
193
+ [flag].flatten.each do |f|
194
+ runtime_control_variables << f.upcase
195
+ end
196
+ on_condition_flag(node)
197
+ end
198
+
199
+ def on_enable_flow_flag(node)
200
+ flag = node.value.upcase
201
+ flow_control_variables << flag
202
+ line "@#{flag} = 1;"
203
+ end
204
+
205
+ def on_disable_flow_flag(node)
206
+ flag = node.value.upcase
207
+ flow_control_variables << flag
208
+ line "@#{flag} = 0;"
209
+ end
210
+
211
+ def on_set_run_flag(node)
212
+ flag = node.value.upcase
213
+ runtime_control_variables << flag
214
+ line "@#{flag} = 1;"
215
+ end
216
+
217
+ def on_group(node)
218
+ on_fail = node.children.find { |n| n.try(:type) == :on_fail }
219
+ on_pass = node.children.find { |n| n.try(:type) == :on_pass }
220
+ with_continue(on_fail && on_fail.children.any? { |n| n.try(:type) == :continue }) do
221
+ line '{'
222
+ @indent += 1
223
+ stack[:on_fail] << on_fail if on_fail
224
+ stack[:on_pass] << on_pass if on_pass
225
+ process_all(node.children - [on_fail, on_pass])
226
+ stack[:on_fail].pop if on_fail
227
+ stack[:on_pass].pop if on_pass
228
+ @indent -= 1
229
+ line "}, open,\"#{unique_group_name(node.find(:name).value)}\", \"\""
230
+ end
231
+ end
232
+
233
+ def on_set_result(node)
234
+ unless @continue
235
+ bin = node.find(:bin).try(:value)
236
+ desc = node.find(:bin).to_a[1]
237
+ sbin = node.find(:softbin).try(:value)
238
+ sdesc = node.find(:softbin).to_a[1] || 'fail'
239
+ if bin && desc
240
+ hardware_bin_descriptions[bin] ||= desc
241
+ end
242
+
243
+ if node.to_a[0] == 'pass'
244
+ line "stop_bin \"#{sbin}\", \"\", , good, noreprobe, green, #{bin}, over_on;"
245
+ else
246
+ line "stop_bin \"#{sbin}\", \"#{sdesc}\", , bad, noreprobe, red, #{bin}, over_on;"
247
+ end
248
+ end
249
+ end
250
+
251
+ def on_log(node)
252
+ line "print_dl(\"#{node.to_a[0]}\");"
253
+ end
254
+
255
+ def unique_group_name(name)
256
+ @group_names ||= {}
257
+ if @group_names[name]
258
+ @group_names[name] += 1
259
+ "#{name}_#{@group_names[name]}"
260
+ else
261
+ @group_names[name] = 1
262
+ name
263
+ end
264
+ end
265
+
266
+ def clean_job(job)
267
+ [job].flatten.map { |j| "@JOB == \"#{j.to_s.upcase}\"" }
268
+ end
269
+
270
+ def with_continue(value)
271
+ orig = @continue
272
+ @continue = true if value
273
+ yield
274
+ @continue = orig
275
+ end
276
+ end
277
+ end
278
+ end
279
+ end