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,253 @@
1
+ module Origen
2
+ module Tester
3
+ module Timing
4
+ class Timeset
5
+ attr_accessor :name, :period_in_ns
6
+
7
+ def initialize(attrs = {})
8
+ attrs.each do |name, value|
9
+ send("#{name}=", value)
10
+ end
11
+ end
12
+ end
13
+
14
+ # Set the timeset for the next vectors, this will remain in place until the next
15
+ # time this is called.
16
+ #
17
+ # $tester.set_timeset("bist_25mhz", 40)
18
+ #
19
+ # This method also accepts a block in which case the contained vectors will generate
20
+ # with the supplied timeset and subsequent vectors will return to the previous timeset
21
+ # automatically.
22
+ #
23
+ # $tester.set_timeset("bist_25mhz", 40) do
24
+ # $tester.cycle
25
+ # end
26
+ #
27
+ # The arguments can also be supplied as a single array, or not at all. In the latter case
28
+ # the existing timeset will simply be preserved. This is useful if you have timesets that
29
+ # can be conditionally set based on the target.
30
+ #
31
+ # # Target 1
32
+ # $soc.readout_timeset = ["readout", 120]
33
+ # # Target 2
34
+ # $soc.readout_timeset = false
35
+ #
36
+ # # This code is compatible with both targets, in the first case the timeset will switch
37
+ # # over, in the second case the existing timeset will be preserved.
38
+ # $tester.set_timeset($soc.readout_timeset) do
39
+ # $tester.cycle
40
+ # end
41
+ def set_timeset(timeset, period_in_ns = nil)
42
+ if timeset.is_a?(Array)
43
+ timeset, period_in_ns = timeset[0], timeset[1]
44
+ end
45
+ timeset ||= @timeset
46
+ unless timeset.is_a?(Timeset)
47
+ fail 'You must supply a period_in_ns argument to set_timeset' unless period_in_ns
48
+ timeset = Timeset.new(name: timeset.to_s.chomp, period_in_ns: period_in_ns)
49
+ end
50
+ called_timesets << timeset unless called_timesets.map(&:name).include?(timeset.name)
51
+ if block_given?
52
+ original = @timeset
53
+ timeset_changed(timeset)
54
+ @timeset = timeset
55
+ yield
56
+ timeset_changed(original)
57
+ @timeset = original
58
+ else
59
+ timeset_changed(timeset)
60
+ @timeset = timeset
61
+ end
62
+ end
63
+
64
+ def timeset_changed(timeset)
65
+ if last_vector && last_vector.timeset != timeset
66
+ change = { old: last_vector.timeset, new: timeset }
67
+ # Suppress any duplicate calls
68
+ if !@_last_timeset_change ||
69
+ (@_last_timeset_change[:new] != change[:new] &&
70
+ @_last_timeset_change[:old] != change[:old])
71
+ before_timeset_change(change)
72
+ end
73
+ @_last_timeset_change = change
74
+ end
75
+ end
76
+
77
+ def before_timeset_change(_options = {})
78
+ end
79
+
80
+ # Cause the pattern to wait.
81
+ # The following options are available to help you specify the time to wait:
82
+ # * :cycles - delays specified in raw cycles, the test model is responsible for translating this into a sequence of valid repeat statements
83
+ # * :time_in_ns - time specified in nano-seconds
84
+ # * :time_in_us - time specified in micro-seconds
85
+ # * :time_in_ms - time specified in milli-seconds
86
+ # * :time_in_s - time specified in seconds
87
+ # If more than one option is supplied they will get added together to give a final
88
+ # delay time expressed in cycles.
89
+ # ==== Examples
90
+ # $tester.wait(:cycles => 100, :time_in_ns => 200) # Wait for 100 cycles + 200ns
91
+ # This method can also be used to trigger a match loop in which case the supplied time
92
+ # becomes the time out for the match. See the J750#match method for full details of the
93
+ # available options.
94
+ # $tester.wait(:match => true, :state => :high, :pin => $top.pin(:done), :time_in_ms => 500)
95
+ def wait(options = {})
96
+ options = {
97
+ cycles: 0,
98
+ time_in_cycles: 0,
99
+ time_in_us: 0,
100
+ time_in_ns: 0,
101
+ time_in_ms: 0,
102
+ time_in_s: 0,
103
+ match: false, # Set to true to invoke a match loop where the supplied delay
104
+ # will become the timeout duration
105
+ }.merge(options)
106
+
107
+ cycles = 0
108
+ cycles += options[:cycles] + options[:time_in_cycles]
109
+ cycles += s_to_cycles(options[:time_in_s])
110
+ cycles += ms_to_cycles(options[:time_in_ms])
111
+ cycles += us_to_cycles(options[:time_in_us])
112
+ cycles += ns_to_cycles(options[:time_in_ns])
113
+
114
+ time = cycles * current_period_in_ns # Total delay in ns
115
+ case
116
+ when time < 1000 # When less than 1us
117
+ cc "Wait for #{'a maximum of ' if options[:match]}#{time}ns"
118
+ when time < 1_000_000 # When less than 1ms
119
+ cc "Wait for #{'a maximum of ' if options[:match]}#{(time.to_f / 1000).round(1)}us" # Display delay in us
120
+ when time < 1_000_000_000 # When less than 1s
121
+ cc "Wait for #{'a maximum of ' if options[:match]}#{(time.to_f / 1_000_000).round(1)}ms"
122
+ else
123
+ cc "Wait for #{'a maximum of ' if options[:match]}%.2fs" % (time.to_f / 1_000_000_000)
124
+ end
125
+
126
+ if cycles > 0 # Allow this function to be called with 0 in which case it will just return
127
+ if options[:match]
128
+ if block_given?
129
+ match_block(cycles, options) { yield }
130
+ else
131
+ match(options[:pin], options[:state], cycles, options)
132
+ end
133
+ else
134
+ delay(cycles)
135
+ end
136
+ end
137
+ end
138
+
139
+ # @api private
140
+ # This should not be called directly, call via tester#wait
141
+ def delay(cycles, options = {})
142
+ (cycles / max_repeat_loop).times do
143
+ if block_given?
144
+ yield options.merge(repeat: max_repeat_loop)
145
+ else
146
+ cycle(options.merge(repeat: max_repeat_loop))
147
+ end
148
+ end
149
+ if block_given?
150
+ yield options.merge(repeat: (cycles % max_repeat_loop))
151
+ else
152
+ cycle(options.merge(repeat: (cycles % max_repeat_loop)))
153
+ end
154
+ end
155
+
156
+ def max_repeat_loop
157
+ @max_repeat_loop || 65_535
158
+ end
159
+
160
+ def s_to_cycles(time) # :nodoc:
161
+ ((time.to_f) * 1000 * 1000 * 1000 / current_period_in_ns).to_int
162
+ end
163
+
164
+ def ms_to_cycles(time) # :nodoc:
165
+ ((time.to_f) * 1000 * 1000 / current_period_in_ns).to_int
166
+ end
167
+
168
+ def us_to_cycles(time) # :nodoc:
169
+ ((time.to_f * 1000) / current_period_in_ns).to_int
170
+ end
171
+
172
+ def ns_to_cycles(time) # :nodoc:
173
+ (time.to_f / current_period_in_ns).to_int
174
+ end
175
+
176
+ def cycles_to_us(cycles) # :nodoc:
177
+ ((cycles.to_f * current_period_in_ns) / (1000)).ceil
178
+ end
179
+
180
+ def cycles_to_ms(cycles) # :nodoc:
181
+ ((cycles.to_f * current_period_in_ns) / (1000 * 1000)).ceil
182
+ end
183
+
184
+ # Cycles to tenths of a second
185
+ def cycles_to_ts(cycles) # :nodoc:
186
+ ((cycles.to_f * current_period_in_ns) / (1000 * 1000 * 100)).ceil
187
+ end
188
+
189
+ def called_timesets
190
+ @called_timesets ||= []
191
+ end
192
+
193
+ def current_period_in_ns
194
+ if @timeset
195
+ @timeset.period_in_ns
196
+ else
197
+ fail 'No timeset has been specified yet!'
198
+ end
199
+ end
200
+ alias_method :current_period, :current_period_in_ns
201
+ alias_method :period, :current_period_in_ns
202
+
203
+ def current_timeset
204
+ @timeset
205
+ end
206
+ alias_method :timeset, :current_timeset
207
+
208
+ # Convert the supplied number of cycles to a time, based on the SoC defined cycle period
209
+ def cycles_to_time(cycles) # :nodoc:
210
+ (cycles * current_period_in_ns).to_f / 1_000_000_000
211
+ end
212
+
213
+ # This function can be used to generate a clock or some other repeating function
214
+ # that spans accross a range of vectors.
215
+ # The period of each cycle and the duration of the sequence are supplied via the following
216
+ # options:
217
+ # * :period_in_cycles
218
+ # * :period_in_ns
219
+ # * :period_in_us
220
+ # * :period_in_ms
221
+ # * :duration_in_cycles
222
+ # * :duration_in_ns
223
+ # * :duration_in_us
224
+ # * :duration_in_ms
225
+ # If multiple definitions for either option are supplied then they will be added
226
+ # together.
227
+ # ==== Example
228
+ # # Supply a clock pulse on :pinA for 100ms
229
+ # $tester.count(:period_in_cycles => 10, :duration_in_ms => 100) do
230
+ # $top.pin(:pinA).drive!(1)
231
+ # $top.pin(:pinA).drive!(0)
232
+ # end
233
+ def count(options = {})
234
+ options = { period_in_cycles: 0, period_in_ms: 0, period_in_us: 0, period_in_ns: 0,
235
+ duration_in_cycles: 0, duration_in_ms: 0, duration_in_us: 0, duration_in_ns: 0
236
+ }.merge(options)
237
+
238
+ period_cycles = options[:period_in_cycles] + ms_to_cycles(options[:period_in_ms]) +
239
+ us_to_cycles(options[:period_in_us]) + ns_to_cycles(options[:period_in_ns])
240
+
241
+ duration_cycles = options[:duration_in_cycles] + ms_to_cycles(options[:duration_in_ms]) +
242
+ us_to_cycles(options[:duration_in_us]) + ns_to_cycles(options[:duration_in_ns])
243
+
244
+ total = 0
245
+ while total < duration_cycles
246
+ wait(time_in_cycles: period_cycles)
247
+ yield # Return control back to caller
248
+ total += period_cycles
249
+ end
250
+ end
251
+ end
252
+ end
253
+ end
@@ -0,0 +1,45 @@
1
+ module Origen
2
+ module Tester
3
+ class Ultraflex
4
+ # Methods for handling all Ultraflex file parsing, e.g. datalogs,
5
+ # test time profiles, etc.
6
+ module Files
7
+ # Reads all lines from a Ultraflex detailed execution time file, returning the lines
8
+ # as an array like this:
9
+ #
10
+ # [
11
+ # {:name => "power_cycle", :index => 1, :group => 3, :time => 0.00461},
12
+ # {:name => "power_cycle", :index => 2, :group => 3, :time => 0.00481},
13
+ # {:name => "power_cycle", :index => 3, :group => 3, :time => 0.00438},
14
+ # {:name => "nvm_mass_erase", :index => nil, :group => nil, :time => 0.19863},
15
+ # ]
16
+ def read_test_times(file, _options = {})
17
+ tests = []
18
+ File.readlines(file).each do |line|
19
+ unless line.strip.empty? || line =~ /Entire Job/
20
+ # http://rubular.com/r/vZOcqovTsf
21
+ if line =~ /(\w+) ?(\(.*?\))? \d\d\d\d (\d+\.\d+).*/
22
+ t = { name: Regexp.last_match[1], time: Regexp.last_match[3].to_f.round(6) }
23
+ # If an indexed test
24
+ if Regexp.last_match[2]
25
+ str = Regexp.last_match[2].gsub('(', '').gsub(')', '')
26
+ fields = str.split('/')
27
+ i = fields[0].to_i
28
+ g = fields[1].to_i
29
+ t[:index] = i
30
+ t[:group] = g
31
+
32
+ else
33
+ t[:index] = nil
34
+ t[:group] = nil
35
+ end
36
+ tests << t
37
+ end
38
+ end
39
+ end
40
+ tests
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,119 @@
1
+ module Origen
2
+ module Tester
3
+ class Ultraflex
4
+ module Generator
5
+ class Flow
6
+ include Origen::Tester::Generator
7
+ include Origen::Tester::Generator::FlowControlAPI
8
+
9
+ TEMPLATE = "#{Origen.top}/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb"
10
+ OUTPUT_POSTFIX = 'flow'
11
+
12
+ def add(type, options = {})
13
+ ins = false
14
+ options = save_context(options) if [:test, :cz].include?(type)
15
+ branch_unless_enabled(options) do |options|
16
+ ins = track_relationships(options) do |options|
17
+ FlowLine.new(type, options)
18
+ end
19
+ collection << ins unless Origen.interface.resources_mode?
20
+ if ins.test?
21
+ c = Origen.interface.consume_comments
22
+ unless Origen.interface.resources_mode?
23
+ Origen.interface.descriptions.add_for_test_usage(ins.parameter, Origen.interface.top_level_flow, c)
24
+ end
25
+ else
26
+ Origen.interface.discard_comments
27
+ end
28
+ end
29
+ ins
30
+ end
31
+
32
+ def logprint(message, options = {})
33
+ message.gsub!(/\s/, '_')
34
+ add(:logprint, options.merge(parameter: message))
35
+ end
36
+
37
+ def test(instance, options = {})
38
+ add(:test, options.merge(parameter: instance))
39
+ end
40
+
41
+ def cz(instance, cz_setup, options = {})
42
+ add(:cz, options.merge(parameter: instance, cz_setup: cz_setup))
43
+ end
44
+
45
+ def goto(label, options = {})
46
+ add(:goto, options.merge(parameter: label))
47
+ end
48
+
49
+ def nop(options = {})
50
+ add(:nop, options.merge(parameter: nil))
51
+ end
52
+
53
+ def set_device(options = {})
54
+ add(:set_device, options)
55
+ end
56
+
57
+ def enable_flow_word(word, options = {})
58
+ add(:enable_flow_word, options.merge(parameter: word))
59
+ end
60
+
61
+ def disable_flow_word(word, options = {})
62
+ add(:disable_flow_word, options.merge(parameter: word))
63
+ end
64
+
65
+ # All tests generated will not run unless the given enable word is asserted.
66
+ #
67
+ # This is specially implemented for Ultraflex since it does not have a native
68
+ # support for flow word not enabled.
69
+ # It will generate a goto branch around the tests contained with the block
70
+ # if the given flow word is enabled.
71
+ def unless_enable(word, options = {})
72
+ if options[:or]
73
+ yield
74
+ else
75
+ @unless_enable_block = word
76
+ options = options.merge(unless_enable: word)
77
+ branch_unless_enabled(options.merge(_force_unless_enable: true)) do
78
+ yield
79
+ end
80
+ @unless_enable_block = nil
81
+ end
82
+ end
83
+ alias_method :unless_enabled, :unless_enable
84
+
85
+ def start_flow_branch(identifier, options = {})
86
+ goto(identifier, options)
87
+ end
88
+
89
+ def skip(identifier = nil, options = {})
90
+ identifier, options = nil, identifier if identifier.is_a?(Hash)
91
+ identifier = generate_unique_label(identifier)
92
+ goto(identifier, options)
93
+ yield
94
+ nop(label: identifier)
95
+ end
96
+
97
+ private
98
+
99
+ # If the test has an unless_enable then branch around it
100
+ def branch_unless_enabled(options)
101
+ word = options.delete(:unless_enable) || options.delete(:unless_enabled)
102
+ if word && (word != @unless_enable_block || options.delete(:_force_unless_enable))
103
+ # Not sure if this is really required, but duplicating these hashes here to ensure
104
+ # that all other flow context keys are preserved and applied to the branch lines
105
+ orig_options = options.merge({})
106
+ close_options = options.merge({})
107
+ label = generate_unique_label
108
+ goto(label, options.merge(if_enable: word))
109
+ yield orig_options
110
+ nop(close_options.merge(label: label))
111
+ else
112
+ yield options
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,269 @@
1
+ module Origen
2
+ module Tester
3
+ class Ultraflex
4
+ module Generator
5
+ class FlowLine
6
+ attr_accessor :type, :id, :cz_setup # cz_setup is a virtual attrib since it is not part of the regular flow line
7
+ # cz_setup combine with instance name when characterize opcode is used
8
+
9
+ # Attributes for each flow line, these must be declared in the order they are to be output
10
+ ATTRS = %w(label enable job part env opcode parameter tname tnum bin_pass bin_fail
11
+ sort_pass sort_fail result flag_pass flag_fail state
12
+ group_specifier group_sense group_condition group_name
13
+ device_sense device_condition device_name
14
+ debug_assume debug_sites comment
15
+ )
16
+
17
+ # Map any aliases to the official names here, multiple aliases for a given attribute
18
+ # are allowed
19
+ ALIASES = {
20
+ bin: :bin_fail,
21
+ softbin: :sort_fail,
22
+ soft_bin: :sort_fail,
23
+ name: :tname,
24
+ number: :tnum,
25
+ if_enable: :enable,
26
+ if_enabled: :enable,
27
+ enabled: :enable,
28
+ # Aliases can also be used to set defaults on multiple attributes like this,
29
+ # use :value to refer to the value passed in to the given alias
30
+ flag_false: { device_condition: 'flag-false',
31
+ device_name: :value
32
+ },
33
+ flag_true: { device_condition: 'flag-true',
34
+ device_name: :value
35
+ },
36
+ flag_false_any: { group_specifier: 'any-active',
37
+ group_condition: 'flag-false',
38
+ group_name: :value
39
+ },
40
+ flag_false_all: { group_specifier: 'all-active',
41
+ group_condition: 'flag-false',
42
+ group_name: :value
43
+ },
44
+ flag_true_any: { group_specifier: 'any-active',
45
+ group_condition: 'flag-true',
46
+ group_name: :value
47
+ },
48
+ flag_true_all: { group_specifier: 'all-active',
49
+ group_condition: 'flag-true',
50
+ group_name: :value
51
+ },
52
+ flag_clear: { device_condition: 'flag-clear',
53
+ device_name: :value
54
+ }
55
+ }
56
+
57
+ # Assign attribute defaults here, generally this should match whatever defaults
58
+ # Teradyne has set whenever you create a new test instance, etc.
59
+ DEFAULTS = {
60
+ test: {
61
+ opcode: 'Test',
62
+ result: 'Fail'
63
+ },
64
+ cz: {
65
+ opcode: 'characterize',
66
+ result: 'None'
67
+ },
68
+ goto: {
69
+ opcode: 'goto'
70
+ },
71
+ nop: {
72
+ opcode: 'nop'
73
+ },
74
+ set_device: {
75
+ opcode: 'set-device'
76
+ },
77
+ enable_flow_word: {
78
+ opcode: 'enable-flow-word'
79
+ },
80
+ disable_flow_word: {
81
+ opcode: 'disable-flow-word'
82
+ },
83
+ logprint: {
84
+ opcode: 'logprint'
85
+ }
86
+ }
87
+
88
+ # Generate accessors for all attributes and their aliases
89
+ ATTRS.each do |attr|
90
+ attr_accessor attr.to_sym
91
+ end
92
+
93
+ ALIASES.each do |_alias, val|
94
+ if val.is_a? Hash
95
+ define_method("#{_alias}=") do |v|
96
+ val.each do |k, _v|
97
+ myval = _v == :value ? v : _v
98
+ send("#{k}=", myval)
99
+ end
100
+ end
101
+ else
102
+ define_method("#{_alias}=") do |v|
103
+ send("#{val}=", v)
104
+ end
105
+ define_method("#{_alias}") do
106
+ send(val)
107
+ end
108
+ end
109
+ end
110
+
111
+ def initialize(type, attrs = {})
112
+ @ignore_missing_instance = attrs.delete(:instance_not_available)
113
+ self.cz_setup = attrs.delete(:cz_setup)
114
+ @type = type
115
+ # Set the defaults
116
+ DEFAULTS[@type.to_sym].each do |k, v|
117
+ send("#{k}=", v) if self.respond_to?("#{k}=")
118
+ end
119
+ # Then the values that have been supplied
120
+ attrs.each do |k, v|
121
+ send("#{k}=", v) if self.respond_to?("#{k}=")
122
+ end
123
+ end
124
+
125
+ def parameter=(value)
126
+ if (@type == :test || @test == :cz) && !@ignore_missing_instance
127
+ if value.is_a?(String) || value.is_a?(Symbol)
128
+ fail "You must supply the actual test instance object for #{value} when adding it to the flow"
129
+ end
130
+ end
131
+ @parameter = value
132
+ end
133
+
134
+ def parameter
135
+ # When referring to the test instance take the opportunity to refresh the current
136
+ # version of the test instance
137
+ @parameter = Origen.interface.identity_map.current_version_of(@parameter)
138
+ end
139
+
140
+ # Returns the fully formatted flow line for insertion into a flow sheet
141
+ def to_s
142
+ l = "\t"
143
+ ATTRS.each do |attr|
144
+ if attr == 'parameter'
145
+ ins = parameter
146
+ if ins.respond_to?(:name)
147
+ l += "#{ins.name}"
148
+ else
149
+ l += "#{ins}"
150
+ end
151
+ if cz_setup
152
+ l += " #{cz_setup}\t"
153
+ else
154
+ l += "\t"
155
+ end
156
+ else
157
+ l += "#{send(attr)}\t"
158
+ end
159
+ end
160
+ "#{l}"
161
+ end
162
+
163
+ def job
164
+ if !if_jobs.empty? && !unless_jobs.empty?
165
+ fail "Both if and unless jobs have been defined for test: #{parameter}"
166
+ elsif !if_jobs.empty?
167
+ if_jobs.join(',')
168
+ elsif !unless_jobs.empty?
169
+ unless_jobs.map { |j| "!#{j}" }.join(',')
170
+ else
171
+ ''
172
+ end
173
+ end
174
+ alias_method :jobs, :job
175
+
176
+ def unless_enable=(*_args)
177
+ end
178
+ alias_method :unless_enabled=, :unless_enable=
179
+
180
+ def if_jobs
181
+ @if_jobs ||= []
182
+ end
183
+
184
+ def unless_jobs
185
+ @unless_jobs ||= []
186
+ end
187
+
188
+ def if_job=(jobs)
189
+ [jobs].flatten.compact.each do |job|
190
+ job = job.to_s.upcase
191
+ if job =~ /!/
192
+ self.unless_job = job
193
+ else
194
+ if_jobs << job unless if_jobs.include?(job)
195
+ end
196
+ end
197
+ end
198
+ alias_method :if_jobs=, :if_job=
199
+ alias_method :add_if_jobs, :if_job=
200
+ alias_method :add_if_job, :if_job=
201
+
202
+ def unless_job=(jobs)
203
+ [jobs].flatten.compact.each do |job|
204
+ job = job.to_s.upcase
205
+ job.gsub!('!', '')
206
+ unless_jobs << job unless unless_jobs.include?(job)
207
+ end
208
+ end
209
+ alias_method :unless_jobs=, :unless_job=
210
+ alias_method :add_unless_jobs, :unless_job=
211
+ alias_method :add_unless_job, :unless_job=
212
+
213
+ def continue_on_fail
214
+ self.result = 'None'
215
+ end
216
+
217
+ def set_flag_on_fail
218
+ self.flag_fail = "#{id}_FAILED"
219
+ end
220
+
221
+ def set_flag_on_pass
222
+ self.flag_pass = "#{id}_PASSED"
223
+ end
224
+
225
+ def set_flag_on_ran
226
+ self.flag_pass = "#{id}_RAN"
227
+ end
228
+
229
+ def run_if_any_passed(parent)
230
+ parent.continue_on_fail
231
+ self.flag_true_any = parent.set_flag_on_pass
232
+ end
233
+
234
+ def run_if_all_passed(parent)
235
+ parent.continue_on_fail
236
+ self.flag_true_all = parent.set_flag_on_pass
237
+ end
238
+
239
+ def run_if_any_failed(parent)
240
+ parent.continue_on_fail
241
+ self.flag_true_any = parent.set_flag_on_fail
242
+ end
243
+
244
+ def run_if_all_failed(parent)
245
+ parent.continue_on_fail
246
+ self.flag_true_all = parent.set_flag_on_fail
247
+ end
248
+
249
+ def id
250
+ @id || "#{parameter}_#{unique_counter}"
251
+ end
252
+
253
+ def unique_counter
254
+ @unique_counter ||= self.class.unique_counter
255
+ end
256
+
257
+ def self.unique_counter
258
+ @ix ||= -1
259
+ @ix += 1
260
+ end
261
+
262
+ def test?
263
+ @type == :test
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end