origen 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (336) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ctags +0 -0
  3. data/bin/origen +165 -1
  4. data/bin/rgen +2 -0
  5. data/config/application.rb +141 -0
  6. data/config/commands.rb +72 -0
  7. data/config/development.rb +7 -0
  8. data/config/environment.rb +0 -0
  9. data/config/rgen.policy +7 -0
  10. data/config/rubocop/easy.yml +620 -0
  11. data/config/rubocop/easy_disabled.yml +271 -0
  12. data/config/rubocop/easy_enabled.yml +731 -0
  13. data/config/rubocop/strict.yml +620 -0
  14. data/config/rubocop/strict_disabled.yml +247 -0
  15. data/config/rubocop/strict_enabled.yml +755 -0
  16. data/config/users.rb +20 -0
  17. data/config/version.rb +1 -1
  18. data/helpers/url.rb +68 -0
  19. data/lib/c99/doc_interface.rb +56 -0
  20. data/lib/c99/j750_interface.rb +85 -0
  21. data/lib/c99/nvm.rb +89 -0
  22. data/lib/c99/target/mock2.rb +1 -0
  23. data/lib/c99/target/subdir/mock3.rb +1 -0
  24. data/lib/option_parser/optparse.rb +12 -0
  25. data/lib/origen/acronyms.rb +60 -0
  26. data/lib/origen/application/command_dispatcher.rb +12 -0
  27. data/lib/origen/application/configuration.rb +206 -0
  28. data/lib/origen/application/configuration_manager.rb +78 -0
  29. data/lib/origen/application/deployer.rb +367 -0
  30. data/lib/origen/application/environment.rb +186 -0
  31. data/lib/origen/application/lsf.rb +145 -0
  32. data/lib/origen/application/lsf_manager.rb +657 -0
  33. data/lib/origen/application/plugins_manager.rb +280 -0
  34. data/lib/origen/application/release.rb +359 -0
  35. data/lib/origen/application/runner.rb +246 -0
  36. data/lib/origen/application/statistics.rb +191 -0
  37. data/lib/origen/application/target.rb +374 -0
  38. data/lib/origen/application/version_tracker.rb +59 -0
  39. data/lib/origen/application/workspace_manager.rb +151 -0
  40. data/lib/origen/application.rb +746 -0
  41. data/lib/origen/bugs/bug.rb +36 -0
  42. data/lib/origen/bugs.rb +45 -0
  43. data/lib/origen/callbacks.rb +35 -0
  44. data/lib/origen/chip_mode.rb +118 -0
  45. data/lib/origen/chip_package.rb +461 -0
  46. data/lib/origen/client.rb +87 -0
  47. data/lib/origen/code_generators/actions.rb +258 -0
  48. data/lib/origen/code_generators/base.rb +57 -0
  49. data/lib/origen/code_generators/bundler.rb +17 -0
  50. data/lib/origen/code_generators/gem_setup.rb +49 -0
  51. data/lib/origen/code_generators/rake.rb +13 -0
  52. data/lib/origen/code_generators/rspec.rb +12 -0
  53. data/lib/origen/code_generators/semver.rb +39 -0
  54. data/lib/origen/code_generators/timever.rb +37 -0
  55. data/lib/origen/code_generators.rb +111 -0
  56. data/lib/origen/commands/add.rb +12 -0
  57. data/lib/origen/commands/compile.rb +62 -0
  58. data/lib/origen/commands/ctags.rb +9 -0
  59. data/lib/origen/commands/dispatch.rb +22 -0
  60. data/lib/origen/commands/environment.rb +11 -0
  61. data/lib/origen/commands/fetch.rb +63 -0
  62. data/lib/origen/commands/generate.rb +130 -0
  63. data/lib/origen/commands/interactive.rb +73 -0
  64. data/lib/origen/commands/lint.rb +82 -0
  65. data/lib/origen/commands/lsf.rb +93 -0
  66. data/lib/origen/commands/merge.rb +55 -0
  67. data/lib/origen/commands/modifications.rb +12 -0
  68. data/lib/origen/commands/new.rb +113 -0
  69. data/lib/origen/commands/plugin.rb +105 -0
  70. data/lib/origen/commands/program.rb +70 -0
  71. data/lib/origen/commands/rc.rb +442 -0
  72. data/lib/origen/commands/save.rb +56 -0
  73. data/lib/origen/commands/target.rb +27 -0
  74. data/lib/origen/commands/time.rb +127 -0
  75. data/lib/origen/commands/version.rb +17 -0
  76. data/lib/origen/commands/web.rb +221 -0
  77. data/lib/origen/commands.rb +272 -0
  78. data/lib/origen/commands_global.rb +76 -0
  79. data/lib/origen/controller.rb +94 -0
  80. data/lib/origen/core_ext/array.rb +23 -0
  81. data/lib/origen/core_ext/bignum.rb +36 -0
  82. data/lib/origen/core_ext/enumerable.rb +76 -0
  83. data/lib/origen/core_ext/fixnum.rb +46 -0
  84. data/lib/origen/core_ext/hash.rb +52 -0
  85. data/lib/origen/core_ext/module.rb +14 -0
  86. data/lib/origen/core_ext/numeric.rb +126 -0
  87. data/lib/origen/core_ext/object.rb +13 -0
  88. data/lib/origen/core_ext/range.rb +7 -0
  89. data/lib/origen/core_ext/string.rb +124 -0
  90. data/lib/origen/core_ext.rb +10 -0
  91. data/lib/origen/database/key_value_store.rb +111 -0
  92. data/lib/origen/database/key_value_stores.rb +108 -0
  93. data/lib/origen/database.rb +6 -0
  94. data/lib/origen/encodings.rb +102 -0
  95. data/lib/origen/features/feature.rb +22 -0
  96. data/lib/origen/features.rb +104 -0
  97. data/lib/origen/file_handler.rb +429 -0
  98. data/lib/origen/generator/comparator.rb +56 -0
  99. data/lib/origen/generator/compiler.rb +277 -0
  100. data/lib/origen/generator/flow.rb +49 -0
  101. data/lib/origen/generator/job.rb +131 -0
  102. data/lib/origen/generator/pattern.rb +356 -0
  103. data/lib/origen/generator/pattern_finder.rb +155 -0
  104. data/lib/origen/generator/pattern_iterator.rb +55 -0
  105. data/lib/origen/generator/renderer.rb +113 -0
  106. data/lib/origen/generator/resources.rb +40 -0
  107. data/lib/origen/generator/stage.rb +89 -0
  108. data/lib/origen/generator.rb +85 -0
  109. data/lib/origen/global_methods.rb +205 -0
  110. data/lib/origen/import_manager.rb +596 -0
  111. data/lib/origen/location/base.rb +116 -0
  112. data/lib/origen/location/map.rb +83 -0
  113. data/lib/origen/location.rb +6 -0
  114. data/lib/origen/log.rb +217 -0
  115. data/lib/origen/logger_methods.rb +56 -0
  116. data/lib/origen/mode.rb +61 -0
  117. data/lib/origen/model.rb +267 -0
  118. data/lib/origen/model_initializer.rb +45 -0
  119. data/lib/origen/nvm/block_array.rb +72 -0
  120. data/lib/origen/nvm.rb +6 -0
  121. data/lib/origen/parameters/live.rb +22 -0
  122. data/lib/origen/parameters/missing.rb +28 -0
  123. data/lib/origen/parameters/set.rb +144 -0
  124. data/lib/origen/parameters.rb +107 -0
  125. data/lib/origen/pdm.rb +218 -0
  126. data/lib/origen/pins/function_proxy.rb +36 -0
  127. data/lib/origen/pins/ground_pin.rb +6 -0
  128. data/lib/origen/pins/pin.rb +860 -0
  129. data/lib/origen/pins/pin_bank.rb +349 -0
  130. data/lib/origen/pins/pin_clock.rb +124 -0
  131. data/lib/origen/pins/pin_collection.rb +492 -0
  132. data/lib/origen/pins/pin_common.rb +206 -0
  133. data/lib/origen/pins/port.rb +268 -0
  134. data/lib/origen/pins/power_pin.rb +30 -0
  135. data/lib/origen/pins.rb +696 -0
  136. data/lib/origen/registers/bit.rb +562 -0
  137. data/lib/origen/registers/bit_collection.rb +787 -0
  138. data/lib/origen/registers/container.rb +288 -0
  139. data/lib/origen/registers/domain.rb +16 -0
  140. data/lib/origen/registers/reg.rb +1406 -0
  141. data/lib/origen/registers/reg_collection.rb +24 -0
  142. data/lib/origen/registers.rb +652 -0
  143. data/lib/origen/regression_manager.rb +251 -0
  144. data/lib/origen/remote_manager.rb +340 -0
  145. data/lib/origen/revision_control/base.rb +257 -0
  146. data/lib/origen/revision_control/design_sync.rb +276 -0
  147. data/lib/origen/revision_control/git.rb +243 -0
  148. data/lib/origen/revision_control/subversion.rb +6 -0
  149. data/lib/origen/revision_control.rb +44 -0
  150. data/lib/origen/ruby_version_check.rb +131 -0
  151. data/lib/origen/site_config.rb +61 -0
  152. data/lib/origen/specs/checkers.rb +103 -0
  153. data/lib/origen/specs/creation_info.rb +17 -0
  154. data/lib/origen/specs/doc_resource.rb +91 -0
  155. data/lib/origen/specs/exhibit.rb +17 -0
  156. data/lib/origen/specs/mode_select.rb +16 -0
  157. data/lib/origen/specs/note.rb +17 -0
  158. data/lib/origen/specs/override.rb +21 -0
  159. data/lib/origen/specs/power_supply.rb +13 -0
  160. data/lib/origen/specs/spec.rb +226 -0
  161. data/lib/origen/specs/version_history.rb +14 -0
  162. data/lib/origen/specs.rb +552 -0
  163. data/lib/origen/sub_blocks.rb +298 -0
  164. data/lib/origen/tester/api.rb +277 -0
  165. data/lib/origen/tester/bdm/bdm.rb +25 -0
  166. data/lib/origen/tester/command_based_tester.rb +46 -0
  167. data/lib/origen/tester/doc/doc.rb +226 -0
  168. data/lib/origen/tester/doc/generator/flow.rb +71 -0
  169. data/lib/origen/tester/doc/generator/flow_line.rb +203 -0
  170. data/lib/origen/tester/doc/generator/test.rb +68 -0
  171. data/lib/origen/tester/doc/generator/test_group.rb +66 -0
  172. data/lib/origen/tester/doc/generator/tests.rb +47 -0
  173. data/lib/origen/tester/doc/generator.rb +126 -0
  174. data/lib/origen/tester/doc/model.rb +162 -0
  175. data/lib/origen/tester/generator/flow_control_api.rb +606 -0
  176. data/lib/origen/tester/generator/identity_map.rb +25 -0
  177. data/lib/origen/tester/generator/placeholder.rb +13 -0
  178. data/lib/origen/tester/generator/test_numberer.rb +25 -0
  179. data/lib/origen/tester/generator.rb +271 -0
  180. data/lib/origen/tester/interface.rb +154 -0
  181. data/lib/origen/tester/j750/files.rb +45 -0
  182. data/lib/origen/tester/j750/generator/flow.rb +123 -0
  183. data/lib/origen/tester/j750/generator/flow_line.rb +288 -0
  184. data/lib/origen/tester/j750/generator/patgroup.rb +111 -0
  185. data/lib/origen/tester/j750/generator/patgroups.rb +41 -0
  186. data/lib/origen/tester/j750/generator/patset.rb +111 -0
  187. data/lib/origen/tester/j750/generator/patsets.rb +41 -0
  188. data/lib/origen/tester/j750/generator/templates/flow.txt.erb +9 -0
  189. data/lib/origen/tester/j750/generator/templates/instances.txt.erb +16 -0
  190. data/lib/origen/tester/j750/generator/templates/patgroups.txt.erb +8 -0
  191. data/lib/origen/tester/j750/generator/templates/patsets.txt.erb +10 -0
  192. data/lib/origen/tester/j750/generator/test_instance.rb +846 -0
  193. data/lib/origen/tester/j750/generator/test_instance_group.rb +60 -0
  194. data/lib/origen/tester/j750/generator/test_instances.rb +182 -0
  195. data/lib/origen/tester/j750/generator.rb +203 -0
  196. data/lib/origen/tester/j750/j750.rb +845 -0
  197. data/lib/origen/tester/j750/j750_hpt.rb +35 -0
  198. data/lib/origen/tester/j750/parser/ac_spec.rb +11 -0
  199. data/lib/origen/tester/j750/parser/ac_specs.rb +0 -0
  200. data/lib/origen/tester/j750/parser/dc_spec.rb +36 -0
  201. data/lib/origen/tester/j750/parser/dc_specs.rb +50 -0
  202. data/lib/origen/tester/j750/parser/descriptions.rb +340 -0
  203. data/lib/origen/tester/j750/parser/flow.rb +111 -0
  204. data/lib/origen/tester/j750/parser/flow_line.rb +207 -0
  205. data/lib/origen/tester/j750/parser/flows.rb +23 -0
  206. data/lib/origen/tester/j750/parser/pattern_set.rb +94 -0
  207. data/lib/origen/tester/j750/parser/pattern_sets.rb +33 -0
  208. data/lib/origen/tester/j750/parser/test_instance.rb +322 -0
  209. data/lib/origen/tester/j750/parser/test_instances.rb +26 -0
  210. data/lib/origen/tester/j750/parser/timeset.rb +15 -0
  211. data/lib/origen/tester/j750/parser/timesets.rb +0 -0
  212. data/lib/origen/tester/j750/parser.rb +104 -0
  213. data/lib/origen/tester/jlink/jlink.rb +33 -0
  214. data/lib/origen/tester/parser/description_lookup.rb +64 -0
  215. data/lib/origen/tester/parser/searchable_array.rb +32 -0
  216. data/lib/origen/tester/parser/searchable_hash.rb +32 -0
  217. data/lib/origen/tester/parser.rb +24 -0
  218. data/lib/origen/tester/time.rb +338 -0
  219. data/lib/origen/tester/timing.rb +253 -0
  220. data/lib/origen/tester/ultraflex/files.rb +45 -0
  221. data/lib/origen/tester/ultraflex/generator/flow.rb +119 -0
  222. data/lib/origen/tester/ultraflex/generator/flow_line.rb +269 -0
  223. data/lib/origen/tester/ultraflex/generator/patgroup.rb +111 -0
  224. data/lib/origen/tester/ultraflex/generator/patgroups.rb +41 -0
  225. data/lib/origen/tester/ultraflex/generator/patset.rb +111 -0
  226. data/lib/origen/tester/ultraflex/generator/patsets.rb +41 -0
  227. data/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb +9 -0
  228. data/lib/origen/tester/ultraflex/generator/templates/instances.txt.erb +16 -0
  229. data/lib/origen/tester/ultraflex/generator/templates/patgroups.txt.erb +8 -0
  230. data/lib/origen/tester/ultraflex/generator/templates/patsets.txt.erb +10 -0
  231. data/lib/origen/tester/ultraflex/generator/test_instance.rb +622 -0
  232. data/lib/origen/tester/ultraflex/generator/test_instance_group.rb +60 -0
  233. data/lib/origen/tester/ultraflex/generator/test_instances.rb +174 -0
  234. data/lib/origen/tester/ultraflex/generator.rb +200 -0
  235. data/lib/origen/tester/ultraflex/parser/ac_spec.rb +11 -0
  236. data/lib/origen/tester/ultraflex/parser/ac_specs.rb +0 -0
  237. data/lib/origen/tester/ultraflex/parser/dc_spec.rb +36 -0
  238. data/lib/origen/tester/ultraflex/parser/dc_specs.rb +50 -0
  239. data/lib/origen/tester/ultraflex/parser/descriptions.rb +342 -0
  240. data/lib/origen/tester/ultraflex/parser/flow.rb +111 -0
  241. data/lib/origen/tester/ultraflex/parser/flow_line.rb +207 -0
  242. data/lib/origen/tester/ultraflex/parser/flows.rb +23 -0
  243. data/lib/origen/tester/ultraflex/parser/pattern_set.rb +94 -0
  244. data/lib/origen/tester/ultraflex/parser/pattern_sets.rb +33 -0
  245. data/lib/origen/tester/ultraflex/parser/test_instance.rb +262 -0
  246. data/lib/origen/tester/ultraflex/parser/test_instances.rb +26 -0
  247. data/lib/origen/tester/ultraflex/parser/timeset.rb +15 -0
  248. data/lib/origen/tester/ultraflex/parser/timesets.rb +0 -0
  249. data/lib/origen/tester/ultraflex/parser.rb +104 -0
  250. data/lib/origen/tester/ultraflex/ultraflex.rb +759 -0
  251. data/lib/origen/tester/v93k/generator/flow.rb +63 -0
  252. data/lib/origen/tester/v93k/generator/flow_node/print.rb +10 -0
  253. data/lib/origen/tester/v93k/generator/flow_node.rb +17 -0
  254. data/lib/origen/tester/v93k/generator/pattern.rb +16 -0
  255. data/lib/origen/tester/v93k/generator/pattern_master.rb +54 -0
  256. data/lib/origen/tester/v93k/generator/templates/_test_method.txt.erb +6 -0
  257. data/lib/origen/tester/v93k/generator/templates/_test_suite.txt.erb +11 -0
  258. data/lib/origen/tester/v93k/generator/templates/template.flow.erb +121 -0
  259. data/lib/origen/tester/v93k/generator/templates/template.pmfl.erb +9 -0
  260. data/lib/origen/tester/v93k/generator/test_function.rb +103 -0
  261. data/lib/origen/tester/v93k/generator/test_functions.rb +79 -0
  262. data/lib/origen/tester/v93k/generator/test_method.rb +46 -0
  263. data/lib/origen/tester/v93k/generator/test_methods.rb +75 -0
  264. data/lib/origen/tester/v93k/generator/test_suite.rb +54 -0
  265. data/lib/origen/tester/v93k/generator/test_suites.rb +65 -0
  266. data/lib/origen/tester/v93k/generator.rb +80 -0
  267. data/lib/origen/tester/v93k/v93k.rb +420 -0
  268. data/lib/origen/tester/vector.rb +86 -0
  269. data/lib/origen/tester/vector_generator.rb +633 -0
  270. data/lib/origen/tester/vector_pipeline.rb +150 -0
  271. data/lib/origen/tester.rb +56 -0
  272. data/lib/origen/top_level.rb +134 -0
  273. data/lib/origen/users/ldap.rb +65 -0
  274. data/lib/origen/users/user.rb +149 -0
  275. data/lib/origen/users.rb +30 -0
  276. data/lib/origen/utility/block_args.rb +93 -0
  277. data/lib/origen/utility/csv_data.rb +110 -0
  278. data/lib/origen/utility/design_sync.rb +494 -0
  279. data/lib/origen/utility/diff.rb +158 -0
  280. data/lib/origen/utility/input_capture.rb +121 -0
  281. data/lib/origen/utility/mailer.rb +143 -0
  282. data/lib/origen/utility/s_record.rb +205 -0
  283. data/lib/origen/utility/time_and_date.rb +30 -0
  284. data/lib/origen/utility.rb +12 -0
  285. data/lib/origen/version_checker.rb +117 -0
  286. data/lib/origen/version_string.rb +356 -0
  287. data/lib/origen.rb +648 -0
  288. data/lib/tasks/gem.rake +27 -22
  289. data/origen_site_config.yml +36 -0
  290. data/source_setup +17 -0
  291. data/spec/format/rgen_formatter.rb +14 -0
  292. data/templates/api_doc/README.txt.erb +24 -0
  293. data/templates/code_generators/gemfile_app.rb +4 -0
  294. data/templates/code_generators/gemfile_plugin.rb +6 -0
  295. data/templates/code_generators/gemspec.rb +33 -0
  296. data/templates/code_generators/rakefile.rb +10 -0
  297. data/templates/code_generators/spec_helper.rb +49 -0
  298. data/templates/code_generators/version.rb +8 -0
  299. data/templates/code_generators/version_time.rb +3 -0
  300. data/templates/git/gitignore.erb +33 -0
  301. data/templates/j750/_vt_flow.txt.erb +8 -0
  302. data/templates/j750/_vt_instances.txt.erb +4 -0
  303. data/templates/j750/program_sheet.txt.erb +9 -0
  304. data/templates/nanoc/Rules +74 -0
  305. data/templates/nanoc/config.yaml +77 -0
  306. data/templates/nanoc/content/favicon.ico +0 -0
  307. data/templates/nanoc/layouts/bootstrap.html.erb +63 -0
  308. data/templates/nanoc/layouts/bootstrap3.html.erb +71 -0
  309. data/templates/nanoc/layouts/freescale.html.erb +79 -0
  310. data/templates/nanoc/lib/bootstrap_filter.rb +49 -0
  311. data/templates/nanoc/lib/codeblocks_filter.rb +41 -0
  312. data/templates/nanoc/lib/default.rb +2 -0
  313. data/templates/nanoc/lib/gzip_filter.rb +16 -0
  314. data/templates/nanoc/lib/haml_code_filter.rb +41 -0
  315. data/templates/nanoc/lib/helpers.rb +1 -0
  316. data/templates/nanoc/lib/search_filter.rb +62 -0
  317. data/templates/nanoc_dynamic/content/search.js.erb +92 -0
  318. data/templates/shared/web/_logo.html +10 -0
  319. data/templates/test/_inline_sub.txt.erb +2 -0
  320. data/templates/test/environment.txt.erb +1 -0
  321. data/templates/test/inline.txt.erb +11 -0
  322. data/templates/test/inspections.txt.erb +19 -0
  323. data/templates/test/set1/_sub1.txt.erb +12 -0
  324. data/templates/test/set1/_sub4.txt.erb +1 -0
  325. data/templates/test/set1/_sub5.txt.erb +1 -0
  326. data/templates/test/set1/main.txt.erb +53 -0
  327. data/templates/test/set1/sub_dir/_sub2.txt.erb +20 -0
  328. data/templates/test/set1/sub_dir/_sub3.txt.erb +12 -0
  329. data/templates/test/set1/sub_dir/main2.txt.erb +4 -0
  330. data/templates/test/set2/template_with_no_erb_1.txt +9 -0
  331. data/templates/test/set2/template_with_no_erb_2.txt +9 -0
  332. data/templates/test/set3/_layout.html.erb +4 -0
  333. data/templates/test/set3/content.html.erb +6 -0
  334. data/templates/time/filter.rb.erb +15 -0
  335. data/templates/time/rules.rb.erb +45 -0
  336. metadata +639 -5
@@ -0,0 +1,759 @@
1
+ module Origen
2
+ module Tester
3
+ # This class has been deprecated
4
+ Origen.deprecate <<-END
5
+ UltraFlex Tester in Origen core has been moved to a dedicated plugin,
6
+ use Testers::UltraFLEX from this plugin instead of Origen::Tester::Ultraflex
7
+ http://origen.freescale.net/testers
8
+ END
9
+
10
+ # Tester model to generate .atp patterns for the Teradyne Ultraflex
11
+ #
12
+ # == Basic Usage
13
+ # $tester = Origen::Tester::Ultraflex.new
14
+ # $tester.cycle # Generate a vector
15
+ #
16
+ # Many more methods exist to generate Ultraflex specific micro-code, see below for
17
+ # details.
18
+ #
19
+ # Also note that this class inherits from the base Tester class and so all methods
20
+ # described there are also available.
21
+ class Ultraflex
22
+ include Tester
23
+ include Parser
24
+ require 'origen/tester/ultraflex/files'
25
+ include Files
26
+
27
+ autoload :Parser, 'origen/tester/ultraflex/parser'
28
+ autoload :Generator, 'origen/tester/ultraflex/generator'
29
+
30
+ attr_accessor :use_hv_pin
31
+ attr_accessor :software_version
32
+
33
+ # Returns a new Ultraflex instance, normally there would only ever be one of these
34
+ # assigned to the global variable such as $tester by your target:
35
+ # $tester = Ultraflex.new
36
+ #
37
+ # NOTE: Ultraflex features not yet supported;
38
+ # - dual mode (assumes single mode)
39
+ # - multiple modules per pattern (only one per for now)
40
+ def initialize
41
+ @unique_counter = 0
42
+ @max_repeat_loop = 65_535
43
+ @min_repeat_loop = 2
44
+ @pat_extension = 'atp'
45
+ @active_loads = true
46
+ @pipeline_depth = 255 # for single mode on UP1600
47
+ @use_hv_pin = false # allows to use high voltage for a pin for all patterns
48
+ @software_version = '8.10.10'
49
+ @compress = true
50
+ @support_repeat_previous = true
51
+ @match_entries = 10
52
+ @name = 'ultraflex'
53
+ @program_comment_char = ['logprint', "'"]
54
+ @min_module_size = 64 # min number of vectors in a module for single
55
+ end
56
+
57
+ def flows
58
+ parser.flows
59
+ end
60
+
61
+ # Main accessor to all content parsed from existing test program sheets found in the
62
+ # supplied directory or in Origen.config.test_program_output_directory
63
+ def parser(prog_dir = Origen.config.test_program_output_directory)
64
+ unless prog_dir
65
+ fail 'You must supply the directory containing the test program sheets, or define it via Origen.config.test_program_output_directory'
66
+ end
67
+ @parser ||= ULTRAFLEX::Parser.new
68
+ @parsed_dir ||= false
69
+ if @parsed_dir != prog_dir
70
+ @parser.parse(prog_dir)
71
+ @parsed_dir = prog_dir
72
+ end
73
+ @parser
74
+ end
75
+
76
+ # Capture a vector to the tester HRAM.
77
+ #
78
+ # This method applys a store vector (stv) opcode to the previous vector, note that is does
79
+ # not actually generate a new vector.
80
+ #
81
+ # Sometimes when generating vectors within a loop you may want to apply a stv opcode
82
+ # retrospectively to a previous vector, passing in an offset option will allow you
83
+ # to do this.
84
+ #
85
+ # On Ultraflex the pins argument is ignored since the tester only supports whole vector capture.
86
+ #
87
+ # @example
88
+ # $tester.cycle # This is the vector you want to capture
89
+ # $tester.store # This applys the STV opcode
90
+ #
91
+ # $tester.cycle # This one gets stored
92
+ # $tester.cycle
93
+ # $tester.cycle
94
+ # $tester.store(:offset => -2) # Just realized I need to capture that earlier vector
95
+ def store(*pins)
96
+ options = pins.last.is_a?(Hash) ? pins.pop : {}
97
+ options = { offset: 0
98
+ }.merge(options)
99
+ update_vector microcode: 'stv', offset: options[:offset]
100
+ end
101
+ alias_method :to_hram, :store
102
+ alias_method :capture, :store
103
+
104
+ # Capture the next vector generated to HRAM
105
+ #
106
+ # This method applys a store vector (stv) opcode to the next vector to be generated,
107
+ # note that is does not actually generate a new vector.
108
+ #
109
+ # On Ultraflex the pins argument is ignored since the tester only supports whole vector capture.
110
+ #
111
+ # @example
112
+ # $tester.store_next_cycle
113
+ # $tester.cycle # This is the vector that will be captured
114
+ def store_next_cycle(*pins)
115
+ options = pins.last.is_a?(Hash) ? pins.pop : {}
116
+ options = {
117
+ }.merge(options)
118
+ preset_next_vector microcode: 'stv'
119
+ end
120
+
121
+ # Call a subroutine.
122
+ #
123
+ # This method applies a call subroutine opcode to the previous vector, it does not
124
+ # generate a new vector.
125
+ #
126
+ # Subroutines should always be called through this method as it ensures a running
127
+ # log of called subroutines is maintained and which then gets output in the pattern
128
+ # header to import the right dependencies.
129
+ #
130
+ # An offset option is available to make the call on earlier vectors.
131
+ #
132
+ # ==== Examples
133
+ # $tester.call_subroutine("mysub")
134
+ # $tester.call_subroutine("my_other_sub", :offset => -1)
135
+ def call_subroutine(name, options = {})
136
+ options = {
137
+ offset: 0
138
+ }.merge(options)
139
+ called_subroutines << name.to_s.chomp unless called_subroutines.include?(name.to_s.chomp) || @inhibit_vectors
140
+ update_vector microcode: "call #{name}", offset: options[:offset]
141
+ end
142
+
143
+ # Start a subroutine.
144
+ #
145
+ # Generates a global subroutine label. Global is used to adhere to the best practice of
146
+ # containing all subroutines in dedicated patterns, e.g. global_subs.atp
147
+ #
148
+ # ==== Examples
149
+ # $tester.start_subroutine("wait_for_done")
150
+ # < generate your subroutine vectors here >
151
+ # $tester.end_subroutine
152
+ def start_subroutine(name)
153
+ local_subroutines << name.to_s.chomp unless local_subroutines.include?(name.to_s.chomp) || @inhibit_vectors
154
+ microcode "global subr #{name}:"
155
+ end
156
+
157
+ # * Ultraflex Specific *
158
+ #
159
+ #
160
+ def enable_flag(options = {})
161
+ options = { flagnum: 4, # which flag to enable for later checking
162
+ }.merge(options)
163
+
164
+ case options[:flagnum]
165
+ when 1
166
+ flagname = 'cpuA_cond'
167
+ when 2
168
+ flagname = 'cpuB_cond'
169
+ when 3
170
+ flagname = 'cpuC_cond'
171
+ when 4
172
+ flagname = 'cpuD_cond'
173
+ else
174
+ abort "ERROR! Invalid flag name passed to 'enable_flag' method!\n"
175
+ end
176
+ update_vector(microcode: "branch_expr(#{flagname})")
177
+ end
178
+
179
+ # * Ultraflex Specific *
180
+ #
181
+ #
182
+ def set_flag(options = {})
183
+ options = { flagnum: 4, # which flag to set
184
+ }.merge(options)
185
+
186
+ case options[:flagnum]
187
+ when 1
188
+ flagname = 'cpuA_cond'
189
+ when 2
190
+ flagname = 'cpuB_cond'
191
+ when 3
192
+ flagname = 'cpuC_cond'
193
+ when 4
194
+ flagname = 'cpuD_cond'
195
+ else
196
+ abort "ERROR! Invalid flag name passed to 'set_flag' method!\n"
197
+ end
198
+ update_vector(microcode: "set_cpu_cond(#{flagname})")
199
+ end
200
+
201
+ # End a subroutine.
202
+ #
203
+ # Generates a return opcode on the last vector.
204
+ #
205
+ # ==== Examples
206
+ # $tester.start_subroutine("wait_for_done")
207
+ # < generate your subroutine vectors here >
208
+ # $tester.end_subroutine
209
+ # cond: whether return is conditional on a flag (to permit to mix subrs together)
210
+ def end_subroutine(cond = false)
211
+ if cond
212
+ update_vector microcode: 'if (flag) return'
213
+ else
214
+ update_vector microcode: 'return'
215
+ end
216
+ end
217
+
218
+ # Handshake with the tester.
219
+ #
220
+ # Will set a cpu flag (A) and wait for it to be cleared by the tester, optionally
221
+ # pass in a read code to pass information to the tester.
222
+ #
223
+ # ==== Examples
224
+ # $tester.handshake # Pass control to the tester for a measurement
225
+ # $tester.handshake(:readcode => 10) # Trigger a specific action by the tester
226
+ def handshake(options = {})
227
+ options = {
228
+ readcode: false,
229
+ manual_stop: false, # set a 2nd CPU flag in case 1st flag is automatically cleared
230
+ }.merge(options)
231
+ if options[:readcode]
232
+ cycle(microcode: "set_code #{options[:readcode]}")
233
+ end
234
+ if options[:manual_stop]
235
+ cycle(microcode: 'enable (cpuB)')
236
+ cycle(microcode: 'set_cpu (cpuA cpuB)')
237
+ cycle(microcode: "loop_here_#{@unique_counter}: if (flag) jump loop_here_#{@unique_counter}")
238
+ else
239
+ cycle(microcode: 'set_cpu (cpuA)')
240
+ cycle(microcode: "loop_here_#{@unique_counter}: if (cpuA) jump loop_here_#{@unique_counter}")
241
+ end
242
+ @unique_counter += 1 # Increment so a different label will be applied if another
243
+ # handshake is called in the same pattern
244
+ end
245
+
246
+ # Do a frequency measure.
247
+ #
248
+ # Write the necessary micro code to do a frequency measure on the given pin,
249
+ # optionally supply a read code to pass information to the tester.
250
+ #
251
+ # ==== Examples
252
+ # $tester.freq_count($top.pin(:d_out)) # Freq measure on pin "d_out"
253
+ # $tester.freq_count($top.pin(:d_out):readcode => 10)
254
+ def freq_count(pin, options = {})
255
+ options = { readcode: false
256
+ }.merge(options)
257
+
258
+ cycle(microcode: "set_code #{options[:readcode]}") if options[:readcode]
259
+ cycle(microcode: 'set_cpu (cpuA)')
260
+ cycle(microcode: 'set_cpu (cpuA)')
261
+ cycle(microcode: 'set_cpu (cpuB)')
262
+ cycle(microcode: 'set_cpu (cpuC)')
263
+ cycle(microcode: 'freq_loop_1:')
264
+ cycle(microcode: 'if (cpuA) jump freq_loop_1')
265
+ pin.drive_lo
266
+ delay(2000)
267
+ pin.dont_care
268
+ cycle(microcode: 'freq_loop_2: enable (cpuB)')
269
+ cycle(microcode: 'if (flag) jump freq_loop_2')
270
+ cycle(microcode: 'enable (cpuC)')
271
+ cycle(microcode: 'if (flag) jump freq_loop_1')
272
+ end
273
+
274
+ # * Ultraflex Specific *
275
+ #
276
+ # No MTO avail on Ultraflex-- need to work with DSSC
277
+ #
278
+ # def memory_test
279
+
280
+ # Generates a match loop on up to two pins.
281
+ #
282
+ # This method is not really intended to be called directly, rather you should call
283
+ # via Tester#wait e.g. $tester.wait(:match => true).
284
+ #
285
+ # The timeout should be provided in cycles, however when called via the wait method the
286
+ # time-based helpers (time_in_us, etc) will be converted to cycles for you.
287
+ # The following options are available to tailor the match loop behavior, defaults in
288
+ # parenthesis:
289
+ # * :pin - The pin object to match on (*required*)
290
+ # * :state - The pin state to match on, :low or :high (*required*)
291
+ # * :pin2 (nil) - Optionally supply a second pin to match on
292
+ # * :state2 (nil) - State for the second pin (required if :pin2 is supplied)
293
+ # * :check_for_fails (false) - Flushes the pipeline and handshakes with the tester (passing readcode 100) prior to the match (to allow binout of fails encountered before the match)
294
+ # * :force_fail_on_timeout (true) - Force a vector mis-compare if the match loop times out
295
+ # * :on_timeout_goto ("") - Optionally supply a label to branch to on timeout, by default will continue from the end of the match loop
296
+ # * :on_pin_match_goto ("") - Optionally supply a label to branch to when pin 1 matches, by default will continue from the end of the match loop
297
+ # * :on_pin2_match_goto ("") - Optionally supply a label to branch to when pin 2 matches, by default will continue from the end of the match loop
298
+ # * :multiple_entries (false) - Supply an integer to generate multiple entries into the match (each with a unique readcode), this can be useful when debugging patterns with multiple matches
299
+ # * :force_fail_on_timeout (true) - force pattern to fail if timeout occurs
300
+ # * :global_loops (false) - whether match loop loops should use global labels
301
+ # * :manual_stop (false) - whether to use extra cpuB flag to resolve IG-XL v.3.50.xx bug where VBT clears cpuA immediately
302
+ # at start of PatFlagFunc instead of at end. Use will have to manually clear cpuB to resume this pattern.
303
+ # ==== Examples
304
+ # $tester.wait(:match => true, :time_in_us => 5000, :pin => $top.pin(:done), :state => :high)
305
+ def match(pin, state, timeout, options = {})
306
+ options = {
307
+ check_for_fails: false,
308
+ on_timeout_goto: false,
309
+ pin2: false,
310
+ state2: false,
311
+ on_pin_match_goto: false,
312
+ on_pin2_match_goto: false,
313
+ multiple_entries: false,
314
+ force_fail_on_timeout: true,
315
+ global_loops: false,
316
+ manual_stop: false,
317
+ clr_fail_post_match: false
318
+ }.merge(options)
319
+
320
+ # Flush the pipeline first and then pass control to the program to bin out any failures
321
+ # prior to entering the match loop
322
+ if options[:check_for_fails]
323
+ if options[:multiple_entries]
324
+ @match_entries.times do |i|
325
+ microcode "global subr match_done_#{i}:"
326
+ cycle(microcode: "set_code #{i + 100}")
327
+ cycle(microcode: 'jump call_tester') unless i == @match_entries - 1
328
+ end
329
+ microcode 'call_tester:'
330
+ else
331
+ cycle(microcode: 'set_code 100')
332
+ end
333
+ cc 'Wait for any prior failures to propagate through the pipeline'
334
+ cycle(microcode: 'pipe_minus 1')
335
+ cc 'Now handshake with the tester to bin out and parts that have failed before they got here'
336
+ handshake(manual_stop: options[:manual_stop])
337
+ end
338
+
339
+ # Now do the main match loop
340
+ cc 'Start the match loop'
341
+
342
+ # Calculate the loop counts for the 2 loops to appropriately hit the timeout requested
343
+ inner_loop_vectors = (@pipeline_depth - 1) + 4 # num vectors in inner loop
344
+ if timeout.to_f < @max_repeat_loop * inner_loop_vectors * @min_repeat_loop
345
+ # Handle case for smaller timeouts (that would force small outer loop count)
346
+ inner_loop_count = (timeout.to_f / (inner_loop_vectors * @min_repeat_loop)).ceil
347
+ outer_loop_count = @min_repeat_loop
348
+ else
349
+ # Handle longer delays
350
+ inner_loop_count = @max_repeat_loop
351
+ outer_loop_count = (timeout.to_f / (@max_repeat_loop * inner_loop_vectors)).ceil # Will do a minimum of 1 * max_repeat_loop * (pipeline_depth-1)
352
+ end
353
+
354
+ global_opt = (options[:global_loops]) ? 'global ' : ''
355
+ microcode "#{global_opt}match_outer_loop_#{@unique_counter}:"
356
+ cycle(microcode: "loopB #{outer_loop_count}")
357
+ microcode "#{global_opt}match_inner_loop_#{@unique_counter}:"
358
+ state == :low ? pin.expect_lo : pin.expect_hi
359
+ cc "Check if #{pin.name} is #{state == :low ? 'low' : 'high'} yet"
360
+ cycle(microcode: "loopA #{inner_loop_count}")
361
+ pin.dont_care
362
+ cc ' Wait for the result to propagate through the pipeline'
363
+ cycle(microcode: 'pipe_minus 1')
364
+ cc "Branch if #{pin.name} was #{state == :low ? 'low' : 'high'}"
365
+ cycle(microcode: "if (pass) jump #{pin.name}_matched_#{@unique_counter} icc ifc")
366
+ cycle(microcode: 'clr_flag (fail) icc')
367
+ if options[:pin2]
368
+ cc "Check if #{options[:pin2].name} is #{options[:state2] == :low ? 'low' : 'high'} yet"
369
+ options[:state2] == :low ? options[:pin2].expect_lo : options[:pin2].expect_hi
370
+ state == :low ? pin.expect_hi : pin.expect_lo # Give priority to pin 1, don't match pin 2 on this cycle
371
+ # if it is really a pin 1 match
372
+ cycle # Read for pin 2 and !pin 1
373
+ options[:pin2].dont_care
374
+ pin.dont_care
375
+ cc 'Again wait for the result to propagate through the pipeline'
376
+ cycle(microcode: 'pipe_minus 1')
377
+ cc "Branch if #{options[:pin2].name} was #{options[:state2] == :low ? 'low' : 'high'}"
378
+ cycle(microcode: "if (pass) jump #{options[:pin2].name}_matched_#{@unique_counter} icc ifc")
379
+ cycle(microcode: 'clr_flag (fail) icc')
380
+ end
381
+ cc 'Loop back around if time remaining'
382
+ cycle(microcode: "end_loopA match_inner_loop_#{@unique_counter} icc")
383
+ cycle(microcode: "end_loopB match_outer_loop_#{@unique_counter} icc")
384
+ if options[:force_fail_on_timeout]
385
+ cc 'To get here something has gone wrong, strobe again to force a pattern failure'
386
+ state == :low ? pin.expect_lo : pin.expect_hi
387
+ options[:state2] == :low ? options[:pin2].expect_lo : options[:pin2].expect_hi if options[:pin2]
388
+ cycle
389
+ pin.dont_care
390
+ options[:pin2].dont_care if options[:pin2]
391
+ end
392
+ if options[:on_timeout_goto]
393
+ cycle(microcode: "jump #{options[:on_timeout_goto]} icc")
394
+ else
395
+ cycle(microcode: "jump match_loop_end_#{@unique_counter} icc")
396
+ # cycle(:microcode => 'halt')
397
+ end
398
+ microcode "#{pin.name}_matched_#{@unique_counter}:"
399
+ cycle(microcode: 'pop_loop icc')
400
+ unless options[:clr_fail_post_match]
401
+ cycle(microcode: 'clr_fail')
402
+ end
403
+ if options[:on_pin_match_goto]
404
+ cycle(microcode: "jump #{options[:on_pin_match_goto]}")
405
+ end
406
+ if options[:pin2]
407
+ microcode "#{options[:pin2].name}_matched_#{@unique_counter}:"
408
+ cycle(microcode: 'pop_loop icc')
409
+ cycle(microcode: 'clr_fail')
410
+ if options[:on_pin2_match_goto]
411
+ cycle(microcode: "jump #{options[:on_pin2_match_goto]}")
412
+ end
413
+ end
414
+ microcode "match_loop_end_#{@unique_counter}:"
415
+ if options[:clr_fail_post_match]
416
+ cycle(microcode: 'clr_fail')
417
+ end
418
+
419
+ @unique_counter += 1 # Increment so a different label will be applied if another
420
+ # handshake is called in the same pattern
421
+ end
422
+
423
+ # Generates a match loop based on vector condition passed in via block
424
+ #
425
+ # This method is not really intended to be called directly, rather you should call
426
+ # via Tester#wait:
427
+ # e.g. $tester.wait(:match => true) do
428
+ # reg(:status_reg).bit(:done).read(1)! # vector condition that you want to match
429
+ # end
430
+ #
431
+ # The timeout should be provided in cycles, however when called via the wait method the
432
+ # time-based helpers (time_in_us, etc) will be converted to cycles for you.
433
+ #
434
+ # The following options are available to tailor the match loop behavior, defaults in
435
+ # parenthesis:
436
+ # * :check_for_fails (false) - Flushes the pipeline and handshakes with the tester (passing readcode 100) prior to the match (to allow binout of fails encountered before the match)
437
+ # * :force_fail_on_timeout (true) - Force a vector mis-compare if the match loop times out
438
+ # * :on_timeout_goto ("") - Optionally supply a label to branch to on timeout, by default will continue from the end of the match loop
439
+ # * :on_block_match_goto ("") - Optionally supply a label to branch to when block condition is met, by default will continue from the end of the match loop
440
+ # * :multiple_entries (false) - Supply an integer to generate multiple entries into the match (each with a unique readcode), this can be useful when debugging patterns with multiple matches
441
+ # * :force_fail_on_timeout (true) - force pattern to fail if timeout occurs
442
+ # * :global_loops (false) - whether match loop loops should use global labels
443
+ # * :manual_stop (false) - whether to use extra cpuB flag to resolve IG-XL v.3.50.xx bug where VBT clears cpuA immediately
444
+ # at start of PatFlagFunc instead of at end. Use will have to manually clear cpuB to resume this pattern.
445
+ # ==== Examples
446
+ # $tester.wait(:match => true, :time_in_us => 5000, :pin => $top.pin(:done), :state => :high)
447
+ def match_block(timeout, options = {})
448
+ options = {
449
+ check_for_fails: false,
450
+ on_timeout_goto: false,
451
+ on_block_match_goto: false,
452
+ multiple_entries: false,
453
+ force_fail_on_timeout: true,
454
+ global_loops: false,
455
+ manual_stop: false,
456
+ clr_fail_post_match: false
457
+ }.merge(options)
458
+
459
+ unless block_given?
460
+ fail 'ERROR: block not passed to match_block!'
461
+ end
462
+
463
+ # Flush the pipeline first and then pass control to the program to bin out any failures
464
+ # prior to entering the match loop
465
+ if options[:check_for_fails]
466
+ if options[:multiple_entries]
467
+ @match_entries.times do |i|
468
+ microcode "global subr match_done_#{i}:"
469
+ cycle(microcode: "set_code #{i + 100}")
470
+ cycle(microcode: 'jump call_tester') unless i == @match_entries - 1
471
+ end
472
+ microcode 'call_tester:'
473
+ else
474
+ cycle(microcode: 'set_code 100')
475
+ end
476
+ cc 'Wait for any prior failures to propagate through the pipeline'
477
+ cycle(microcode: 'pipe_minus 1')
478
+ cc 'Now handshake with the tester to bin out and parts that have failed before they got here'
479
+ handshake(manual_stop: options[:manual_stop])
480
+ end
481
+
482
+ # Now do the main match loop
483
+ cc 'Start the match loop'
484
+
485
+ # Calculate the loop counts for the 2 loops to appropriately hit the timeout requested
486
+ inner_loop_vectors = (@pipeline_depth - 1) + 4 # num vectors in inner loop
487
+ if timeout.to_f < @max_repeat_loop * inner_loop_vectors * @min_repeat_loop
488
+ # Handle case for smaller timeouts (that would force small outer loop count)
489
+ inner_loop_count = (timeout.to_f / (inner_loop_vectors * @min_repeat_loop)).ceil
490
+ outer_loop_count = @min_repeat_loop
491
+ else
492
+ # Handle longer delays
493
+ inner_loop_count = @max_repeat_loop
494
+ outer_loop_count = (timeout.to_f / (@max_repeat_loop * inner_loop_vectors)).ceil # Will do a minimum of 1 * max_repeat_loop * (pipeline_depth-1)
495
+ end
496
+
497
+ global_opt = (options[:global_loops]) ? 'global ' : ''
498
+ microcode "#{global_opt}match_outer_loop_#{@unique_counter}:"
499
+ cycle(microcode: "loopB #{outer_loop_count}")
500
+ microcode "#{global_opt}match_inner_loop_#{@unique_counter}:"
501
+ cycle(microcode: "loopA #{inner_loop_count}")
502
+ cc 'Check if block condition met'
503
+ yield
504
+ cc ' Wait for the result to propagate through the pipeline'
505
+ cycle(microcode: 'pipe_minus 1')
506
+ cc 'Branch if block condition met'
507
+ cycle(microcode: "if (pass) jump block_matched_#{@unique_counter} icc ifc")
508
+ cycle(microcode: 'clr_flag (fail) icc')
509
+ cc 'Loop back around if time remaining'
510
+ cycle(microcode: "end_loopA match_inner_loop_#{@unique_counter} icc")
511
+ cycle(microcode: "end_loopB match_outer_loop_#{@unique_counter} icc")
512
+ if options[:force_fail_on_timeout]
513
+ cc 'To get here something has gone wrong, check block again to force a pattern failure'
514
+ yield
515
+ end
516
+ if options[:on_timeout_goto]
517
+ cycle(microcode: "jump #{options[:on_timeout_goto]} icc")
518
+ else
519
+ cycle(microcode: "jump match_loop_end_#{@unique_counter} icc")
520
+ # cycle(:microcode => 'halt')
521
+ end
522
+ microcode "block_matched_#{@unique_counter}:"
523
+ cycle(microcode: 'pop_loop icc')
524
+ unless options[:clr_fail_post_match]
525
+ cycle(microcode: 'clr_fail')
526
+ end
527
+ if options[:on_block_match_goto]
528
+ cycle(microcode: "jump #{options[:on_block_match_goto]}")
529
+ end
530
+ microcode "match_loop_end_#{@unique_counter}:"
531
+ if options[:clr_fail_post_match]
532
+ cycle(microcode: 'clr_fail')
533
+ end
534
+
535
+ @unique_counter += 1 # Increment so a different label will be applied if another
536
+ # handshake is called in the same pattern
537
+ end
538
+
539
+ # Call a match loop.
540
+ #
541
+ # Normally you would put your match loop in a global subs pattern, then you can
542
+ # call it via this method. This method automatically syncs match loop naming with
543
+ # the match generation flow, no arguments required.
544
+ #
545
+ # This is a Ultraflex specific API.
546
+ #
547
+ # ==== Examples
548
+ # $tester.cycle
549
+ # $tester.call_match # Calls the match loop, or the first entry point if you have multiple
550
+ # $tester.cycle
551
+ # $tester.call_match # Calls the match loop, or the second entry point if you have multiple
552
+ def call_match
553
+ @match_counter = @match_counter || 0
554
+ call_subroutine("match_done_#{@match_counter}")
555
+ @match_counter += 1 unless @match_counter == (@match_entries || 1) - 1
556
+ end
557
+
558
+ # Apply a label to the pattern.
559
+ #
560
+ # No additional vector is generated.
561
+ # Arguments:
562
+ # name : label name
563
+ # global : (optional) whether to apply global label, default=false
564
+ #
565
+ # ==== Examples
566
+ # $tester.label("something_significant")
567
+ # $tester.label("something_significant",true) # apply global label
568
+ def label(name, global = false)
569
+ global_opt = (global) ? 'global ' : ''
570
+ microcode global_opt + name + ':'
571
+ end
572
+
573
+ # * Ultraflex Specific *
574
+ #
575
+ # Set a readcode.
576
+ #
577
+ # Use the set an explicit readcode for communicating with the tester. This method
578
+ # will generate an additional vector.
579
+ #
580
+ # ==== Examples
581
+ # $tester.set_code(55)
582
+ def set_code(code)
583
+ cycle(microcode: "set_code #{code}")
584
+ end
585
+
586
+ # Branch execution to the given point.
587
+ #
588
+ # This generates a new vector with a jump instruction to a given label. This method
589
+ # will generate an additional vector.
590
+ #
591
+ # ==== Examples
592
+ # $tester.branch_to("something_significant")
593
+ def branch_to(label)
594
+ cycle(microcode: "jump #{label}")
595
+ end
596
+ alias_method :branch, :branch_to
597
+
598
+ # Add loop to the pattern.
599
+ #
600
+ # Pass in a name for the loop and the number of times to execute it, all vectors
601
+ # generated by the given block will be captured in the loop.
602
+ #
603
+ # Optional arguments: global - whether to apply global label (default=false)
604
+ # label_first - whether to apply loop label before loop vector or not
605
+ #
606
+ # ==== Examples
607
+ # $tester.loop_vectors("pulse_loop", 3) do # Do this 3 times...
608
+ # $tester.cycle
609
+ # some_other_method_to_generate_vectors
610
+ # end
611
+ def loop_vectors(name, number_of_loops, global = false, label_first = false)
612
+ if number_of_loops > 1
613
+ @loop_counters ||= {}
614
+ if @loop_counters[name]
615
+ @loop_counters[name] += 1
616
+ else
617
+ @loop_counters[name] = 0
618
+ end
619
+ loop_name = @loop_counters[name] == 0 ? name : "#{name}_#{@loop_counters[name]}"
620
+ if label_first
621
+ global_opt = (global) ? 'global ' : ''
622
+ microcode "#{global_opt}#{loop_name}: "
623
+ end
624
+ cycle(microcode: "loopA #{number_of_loops}")
625
+ unless label_first
626
+ global_opt = (global) ? 'global ' : ''
627
+ cycle(microcode: "#{global_opt}#{loop_name}: ")
628
+ end
629
+ yield
630
+ cycle(microcode: "end_loopA #{loop_name}")
631
+ else
632
+ yield
633
+ end
634
+ end
635
+ alias_method :loop_vector, :loop_vectors
636
+
637
+ # An internal method called by Origen to create the pattern header
638
+ def pattern_header(options = {})
639
+ options = {
640
+ subroutine_pat: false,
641
+ group: false, # If true the end pattern is intended to run within a pattern group
642
+ high_voltage: false, # Supply a pin name here to declare it as an HV instrument
643
+ freq_counter: false, # Supply a pin name here to declare it as a frequency counter
644
+ }.merge(options)
645
+
646
+ called_timesets.each do |timeset|
647
+ microcode "import tset #{timeset.name};"
648
+ end
649
+ unless options[:group] # Withhold imports for pattern groups, is this correct?
650
+ called_subroutines.each do |sub_name|
651
+ # Don't import any called subroutines that are declared in the current pattern
652
+ microcode "import svm_subr #{sub_name};" unless local_subroutines.include?(sub_name)
653
+ end
654
+ end
655
+ # Should implement this more like @instruments.each...
656
+ microcode 'opcode_mode = single;'
657
+ microcode 'digital_inst = hsdm;'
658
+ microcode 'compressed = yes;' # if $soc.gzip_patterns
659
+ options[:high_voltage] = @use_hv_pin
660
+ microcode "pin_setup = {#{options[:high_voltage]} high_voltage;}" if options[:high_voltage]
661
+ microcode "pin_setup = {#{options[:freq_counter]} freq_count;}" if options[:freq_counter]
662
+ microcode ''
663
+
664
+ pin_list = ordered_pins.map(&:name).join(', ')
665
+
666
+ microcode "#{options[:subroutine_pat] ? 'srm_vector' : 'vm_vector'}"
667
+ microcode "#{options[:pattern]} ($tset, #{pin_list})"
668
+ microcode '{'
669
+ unless options[:subroutine_pat]
670
+ microcode "start_label #{options[:pattern]}_st:"
671
+ end
672
+ end
673
+
674
+ # DDHH pad vector for single mode if pattern is less than 64 vectors??
675
+
676
+ # An internal method called by Origen to generate the pattern footer
677
+ def pattern_footer(options = {})
678
+ options = {
679
+ subroutine_pat: false,
680
+ end_in_ka: false,
681
+ end_with_halt: false
682
+ }.merge(options)
683
+ # cycle(:microcode => "#{$soc.end_of_pattern_label}:") if $soc.end_of_pattern_label
684
+ if options[:end_in_ka]
685
+ $tester.cycle microcode: 'keep_alive'
686
+ else
687
+ if options[:end_with_halt]
688
+ $tester.cycle microcode: 'halt'
689
+ else
690
+ $tester.cycle
691
+ end
692
+ end
693
+ microcode '}'
694
+ end
695
+
696
+ # Returns an array of subroutines called while generating the current pattern
697
+ def called_subroutines
698
+ @called_subroutines ||= []
699
+ end
700
+
701
+ # Returns an array of subroutines created by the current pattern
702
+ def local_subroutines # :nodoc:
703
+ @local_subroutines ||= []
704
+ end
705
+
706
+ # This is an internal method use by Origen which returns a fully formatted vector
707
+ # You can override this if you wish to change the output formatting at vector level
708
+ def format_vector(vec)
709
+ timeset = vec.timeset ? "> #{vec.timeset.name}" : ''
710
+ pin_vals = vec.pin_vals ? "#{vec.pin_vals} ;" : ''
711
+ if vec.repeat > 1
712
+ microcode = "repeat #{vec.repeat}"
713
+ else
714
+ microcode = vec.microcode ? vec.microcode : ''
715
+ end
716
+ # if vec.pin_vals && vec.number && vec.cycle_number
717
+ # comment = " // Vector #{@pattern_vectors}, Cycle #{@pattern_cycles}"
718
+ # else
719
+ comment = ''
720
+ # end
721
+ "#{microcode.ljust(65)}#{timeset.ljust(31)}#{pin_vals}#{comment}"
722
+ end
723
+
724
+ # Override this to force the formatting to match the v1 Ultraflex model (easier diffs)
725
+ def push_microcode(code) # :nodoc:
726
+ stage.store(code.ljust(65) + ''.ljust(31))
727
+ end
728
+ alias_method :microcode, :push_microcode
729
+
730
+ # All vectors generated with the supplied block will have all pins set
731
+ # to the repeat previous state. Any pins that are changed state within
732
+ # the block will still update to the supplied value.
733
+ # ==== Example
734
+ # # All pins except invoke will be assigned the repeat previous code
735
+ # # in the generated vector. On completion of the block they will
736
+ # # return to their previous state, except for invoke which will
737
+ # # retain the value assigned within the block.
738
+ # $tester.repeat_previous do
739
+ # $top.pin(:invoke).drive(1)
740
+ # $tester.cycle
741
+ # end
742
+ def repeat_previous
743
+ Origen.app.pin_map.each { |_id, pin| pin.repeat_previous = true }
744
+ yield
745
+ Origen.app.pin_map.each { |_id, pin| pin.repeat_previous = false }
746
+ end
747
+
748
+ def ignore_fails(*pins)
749
+ pins.each(&:suspend)
750
+ yield
751
+ pins.each(&:resume)
752
+ end
753
+
754
+ def ultraflex?
755
+ true
756
+ end
757
+ end
758
+ end
759
+ end