origen 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,696 @@
1
+ module Origen
2
+ # ****** These notes refer to the pin model for the upcoming Origen V3 ******
3
+ #
4
+ # Pin muxing and grouping on modern SoCs can be incredibly complex, Origen provides the following pin model
5
+ # architecture which should hopefully be sufficient to accurately model even the most complex of cases...
6
+ #
7
+ # At the lowest layer are the pin objects, one per physical pin on a DUT. Each pin can store 1-bit of data
8
+ # with directional/state information for pattern generation, and additional metadata about the function of
9
+ # that pin in different modes of operation.
10
+ #
11
+ # pin1 pin2 pin3 pin4
12
+ #
13
+ # *Package*
14
+ #
15
+ # Packages are the first layer of filtering that can be applied to pins, each pin has a package hash which
16
+ # contains information about which packages it is available in and any additional metadata associated with
17
+ # the pin when in that package - for example what package pin location it is.
18
+ #
19
+ # pin1 pin2 pin3 pin4
20
+ # packages: packages: packages: packages:
21
+ # p1: p1: p1:
22
+ # location: "A5" location: "B2" location: "B3"
23
+ # p2: p2:
24
+ # location: "A5" location: "B2"
25
+ #
26
+ # Based on the above metadata these pins will work as follows within an SoC model:
27
+ #
28
+ # $dut.package # => :none
29
+ # $dut.pins.size # => 4
30
+ #
31
+ # $dut.with_package :p1 do
32
+ # $dut.pins.size # => 3 (No pin4)
33
+ # $dut.pin(:pin1).location # => "A5"
34
+ # $dut.has_pin?(:pin2) # => true
35
+ # $dut.pin(:pin2).location # => "B2"
36
+ # $dut.pin(:pin3).location # => "B3"
37
+ # end
38
+ #
39
+ # $dut.with_package :p2 do
40
+ # $dut.pins.size # => 2 (No pin2 or pin4)
41
+ # $dut.pin(:pin1).location # => "A5"
42
+ # $dut.has_pin?(:pin2) # => false
43
+ # $dut.pin(:pin2).location # => ERROR! The soc does not have pin 2 in the current configuration!
44
+ # $dut.pin(:pin3).location # => "B2"
45
+ # end
46
+ #
47
+ # Aside from a physical package the packages attribute can also be used to model pseudo-packages like the
48
+ # subset of pins that are available in a probe or burn-in setup for example.
49
+ #
50
+ # Pins availability can also be scoped by SoC mode and configuration...
51
+ #
52
+ # *Mode*
53
+ #
54
+ # The SoC mode attribute is inteded to be used to model top-level operating modes, such as functional test,
55
+ # RAMBIST, NVMBIST, etc. As such it is a top-level attribute similar to package attribute e.g. the SoC can be
56
+ # in RAMBIST mode within package P1, or it could be in User mode within package P2.
57
+ #
58
+ # *Configuration*
59
+ #
60
+ # The configuration scope should be used to model pin muxing that can occur independently of the SoC mode, for
61
+ # example in a functional test mode many different pin configurations may exist based on the IP modules that
62
+ # are enabled or disabled at runtime.
63
+ # Unlike the mode the configuration attribute can also be set at pin level as well. Any configuration attribute
64
+ # set on a pin will override the configuration attribute that is currently live on the SoC. This allows individual
65
+ # pins, or perhaps more commonly individual pin groups, to be set to a particular configuration independently
66
+ # of the other pins or the SoC.
67
+ #
68
+ # The mode and configuration attributes at pin level are similar to those for the package, each pin also has a
69
+ # current_configuration attribute which will override the current_configuration attribute of the SoC when
70
+ # present. Each mode and configuration entry will be hash for storing meta data as required.
71
+ #
72
+ # pin1 pin2 pin3 pin4
73
+ # modes: modes: modes: modes:
74
+ # user: user: user:
75
+ # nvmbist: nvmbist:
76
+ # configurations: configurations: configurations: configurations:
77
+ # default: default: default: default:
78
+ # alt0: alt1: alt0:
79
+ # alt1:
80
+ #
81
+ # Pin availability will be scoped accordingly when the mode and configuration of the SoC model is changed.
82
+ #
83
+ # Although not shown in this example all of these filters are AND'd together, so a pin is only available if it
84
+ # is available in the current package, mode and configuration.
85
+ #
86
+ # $dut.mode # => :none
87
+ # $dut.configuration # => :none
88
+ #
89
+ # $dut.pins.size # => 4
90
+ # $dut.mode = :user
91
+ # $dut.pins.size # => 3 (No pin4)
92
+ #
93
+ # $dut.configuration = :alt0
94
+ # $dut.pins.size # => 2 (No pin2 or pin4)
95
+ # # Set the configuration of pin2 directly, the all_pins method will bypass the current scope
96
+ # # when looking up a pin
97
+ # $dut.all_pins(:pin2).configuration = :alt1
98
+ # $dut.pins.size # => 3 (pin2 is now available to)
99
+ #
100
+ # While not shown here an additional value of :all can be set when specifying the mode/configuration attributes
101
+ # of a given pin and which means that it will be available in all modes and/or configurations.
102
+ #
103
+ # *Functions*
104
+ #
105
+ # Each pin can have multiple functions associated with it which is intended to reflect the current signal that is
106
+ # mux'd onto it. Functions are scoped by mode and configuration (not package) and only one function can exist
107
+ # per mode/configuration combo.
108
+ #
109
+ # Again the reserved mode/configuration name :all can be used here to reflect a function that will be common to
110
+ # all modes/configurations unless a more specific function has been declared.
111
+ # The top-level key of the functions hash is the mode, then the configuration and then the meta data associated
112
+ # with that selection:
113
+ #
114
+ # pin1 pin2 pin3 pin4
115
+ # functions: functions: functions: functions:
116
+ # user: user: user:
117
+ # all: default: default:
118
+ # name: "TDI" name: "PORTA0" name: "PORTA1"
119
+ # direction: :input direction: :io direction: :io
120
+ # alt1: alt0:
121
+ # name: "SPI0" name: "IIC0"
122
+ # direction: :io direction: :output
123
+ # alt1:
124
+ # name: "SPI1"
125
+ # direction: :io
126
+ # nvmbist: nvmbist:
127
+ # all: all:
128
+ # name: "NVM_FAIL" name: "NVM_DONE"
129
+ # direction: :output direction: :output
130
+ #
131
+ # The function attributes returned will automatically scope to the current SoC state:
132
+ #
133
+ # $dut.mode = :user
134
+ # $dut.pin(:pin1).name # => "TDI"
135
+ # $dut.pin(:pin1).direction # => :input
136
+ #
137
+ # $dut.mode = :nvmbist
138
+ # $dut.pin(:pin1).name # => "NVM_FAIL"
139
+ # $dut.pin(:pin1).direction # => :output
140
+ #
141
+ # *Aliases*
142
+ #
143
+ # Aliases are alternative names/handles to give to pins when using them to create patterns and other IP in Origen.
144
+ # Aliases can be made universal in which case they will work regardless of scope, or they can be scoped to the
145
+ # current package, mode and configuration.
146
+ #
147
+ # The Origen pin API will automatically create scoped aliases for functions and package locations as they are
148
+ # declared, so for example:
149
+ #
150
+ # $dut.mode = :user
151
+ # $dut.pin(:pin1).name # => "TDI"
152
+ # $dut.pin(:tdi).name # => "TDI"
153
+ # $dut.has_pin?(:nvm_fail) # => false
154
+ # $dut.pin(:nvm_fail).name # => ERROR! No pin called NVM_FAIL in the current scope!
155
+ #
156
+ # $dut.mode = :nvmbist
157
+ # $dut.pin(:pin1).name # => "NVM_FAIL"
158
+ # $dut.has_pin?(:nvm_fail) # => true
159
+ # $dut.pin(:nvm_fail).name # => "NVM_FAIL"
160
+ #
161
+ #
162
+ # *Pin Groups*
163
+ #
164
+ # Pin groups will be similar to aliases in that they can be made universal or scoped to a specific package/mode/
165
+ # configuration.
166
+ #
167
+ # While aliases are simply pointers to pin objects pin groups will themselves be an Origen object which will be like
168
+ # a Ruby array with additional metadata attached (such as a name) and a dedicated API for working with the pins.
169
+ # Generally a pin and pingroup will respond to the same API so that calling code does not need to worry very much
170
+ # about dealing with a single pin vs. a collection.
171
+ module Pins
172
+ autoload :Pin, 'origen/pins/pin'
173
+ autoload :Port, 'origen/pins/port'
174
+ autoload :PinCollection, 'origen/pins/pin_collection'
175
+ autoload :PinBank, 'origen/pins/pin_bank'
176
+ autoload :PinCommon, 'origen/pins/pin_common'
177
+ autoload :PinClock, 'origen/pins/pin_clock'
178
+ autoload :PowerPin, 'origen/pins/power_pin'
179
+ autoload :GroundPin, 'origen/pins/ground_pin'
180
+ autoload :FunctionProxy, 'origen/pins/function_proxy'
181
+
182
+ # @api private
183
+ # API v2, deprecated
184
+ def self.clear_pin_aliases
185
+ @@pin_aliases = {}
186
+ end
187
+
188
+ # @api private
189
+ #
190
+ # Aliases are stored in a global array that is cleared out everytime the target is loaded,
191
+ # while a bit hacky this is an easy way to allow sub modules to defined con
192
+ #
193
+ # API v2, deprecated
194
+ def self.pin_aliases
195
+ @@pin_aliases ||= {}
196
+ end
197
+
198
+ # Use this method to add any pins that are considered owned by the given object.
199
+ # Pins declared via this method will be accessible within the object via
200
+ # pin(:pinname) or if you prefer self.pin(:pinname). Externally you would refer
201
+ # to it via $top.pin(:pinname) or $soc.pin(:pinname) or even
202
+ # $top.sub_module.pin(:pinname) depending on where you called this method.
203
+ # Pins are output in the pattern in the order that they are declared.
204
+ # A minimum declaration is this:
205
+ # add_pin :d_out # A single pin that will be set to :dont_care by default
206
+ # To set the initial state at the same time:
207
+ # add_pin :d_in, :reset => :drive_hi
208
+ # add_pin :invoke, :reset => :drive_lo
209
+ # You can override the name that appears in the pattern by providing a string
210
+ # as the last argument
211
+ # add_pin :done, :reset => :expect_hi, :name => "bist_done"
212
+ # add_pin :fail, :name => "bist_fail"
213
+ def add_pin(id = nil, options = {}, &_block)
214
+ id, options = nil, id if id.is_a?(Hash)
215
+ power_pin = options.delete(:power_pin)
216
+ ground_pin = options.delete(:ground_pin)
217
+ if options[:size] && options[:size] > 1
218
+ group = PinCollection.new(self, options.merge(placeholder: true))
219
+ group.id = id if id
220
+ options = {
221
+ name: ''
222
+ }.merge(options)
223
+
224
+ options.delete(:size).times do |i|
225
+ options[:name] = "#{id}#{i}".to_sym
226
+
227
+ if power_pin
228
+ group[i] = PowerPin.new(i, self, options)
229
+ elsif ground_pin
230
+ group[i] = GroundPin.new(i, self, options)
231
+ else
232
+ group[i] = Pin.new(i, self, options)
233
+ end
234
+ group[i].invalidate_group_cache
235
+ end
236
+ yield group if block_given?
237
+ group.each do |pin|
238
+ pin.id = "#{group.id}#{pin.id}".to_sym
239
+ pin.finalize
240
+ end
241
+ if group.size == 1
242
+ Origen.pin_bank.add_pin(group.first, self, options)
243
+ else
244
+ Origen.pin_bank.add_pin_group(group, self, options)
245
+ end
246
+ else
247
+ if power_pin
248
+ pin = PowerPin.new(id || :temp, self, options)
249
+ elsif ground_pin
250
+ pin = GroundPin.new(id || :temp, self, options)
251
+ else
252
+ pin = Pin.new(id || :temp, self, options)
253
+ end
254
+ yield pin if block_given?
255
+ pin.finalize
256
+ Origen.pin_bank.add_pin(pin, self, options)
257
+ end
258
+ end
259
+ alias_method :add_pins, :add_pin
260
+
261
+ def add_power_pin(id = nil, options = {}, &block)
262
+ id, options = nil, id if id.is_a?(Hash)
263
+ options = {
264
+ power_pin: true
265
+ }.merge(options)
266
+ add_pin(id, options, &block)
267
+ end
268
+ alias_method :add_power_pins, :add_power_pin
269
+
270
+ def add_ground_pin(id = nil, options = {}, &block)
271
+ id, options = nil, id if id.is_a?(Hash)
272
+ options = {
273
+ ground_pin: true
274
+ }.merge(options)
275
+ add_pin(id, options, &block)
276
+ end
277
+ alias_method :add_ground_pins, :add_ground_pin
278
+
279
+ # Specifiy the order that pins will appear in the output pattern, unspecified
280
+ # pins will appear in an arbitrary order at the end
281
+ #
282
+ # API v2, deprecated
283
+ def pin_pattern_order(*pin_ids)
284
+ if pin_ids.last.is_a?(Hash)
285
+ options = pin_ids.pop
286
+ else
287
+ options = {}
288
+ end
289
+ pin_ids.each do |id|
290
+ if pin_aliases[id]
291
+ Origen.app.pin_names[pin_aliases[id].first] = id
292
+ id = pin_aliases[id].first
293
+ end
294
+ Origen.app.pin_pattern_order << id
295
+ end
296
+ Origen.app.pin_pattern_order << options unless options.empty?
297
+ end
298
+
299
+ # Specifiy the pins will not appear in the output pattern
300
+ def pin_pattern_exclude(*pin_ids)
301
+ if pin_ids.last.is_a?(Hash)
302
+ options = pin_ids.pop
303
+ else
304
+ options = {}
305
+ end
306
+ pin_ids.each do |id|
307
+ if pin_aliases[id]
308
+ Origen.app.pin_names[pin_aliases[id].first] = id
309
+ id = pin_aliases[id].first
310
+ end
311
+ Origen.app.pin_pattern_exclude << id
312
+ end
313
+ Origen.app.pin_pattern_exclude << options unless options.empty?
314
+ end
315
+
316
+ # API v2, deprecated
317
+ def add_port(id, options = {})
318
+ add_pins(id, options)
319
+ end
320
+
321
+ def add_pin_alias(new_name, original_name, options = {})
322
+ if pin_groups.include?(original_name) # this is a pin group
323
+ if options[:pin] # alias single pin from a pin group
324
+ pin(original_name)[options[:pin]].add_alias(new_name, options)
325
+ else # alias subset of pins from a pin group
326
+ add_pin_group_alias(new_name, original_name, options)
327
+ end
328
+ else # this is a pin
329
+ pin(original_name).add_alias(new_name, options)
330
+ end
331
+ end
332
+ alias_method :pin_alias, :add_pin_alias
333
+ alias_method :alias_pin, :add_pin_alias
334
+ alias_method :add_port_alias, :add_pin_alias
335
+
336
+ def add_pin_group_alias(new_name, original_name, options = {})
337
+ group = Origen.pin_bank.find_or_create_pin_group(new_name, self, options)
338
+ if options[:pins] # alias to range of pins from a pin group
339
+ options[:pins].each do |mypin|
340
+ pin(new_name).add_pin(pin(original_name)[mypin])
341
+ end
342
+ else
343
+ pin(original_name).each_with_index { |_pin, i| pin(new_name).add_pin(pin(original_name)[i]) }
344
+ end
345
+ group
346
+ end
347
+
348
+ # @api private
349
+ #
350
+ # API v2, deprecated
351
+ def pin_aliases
352
+ # Clear this out every time the target changes
353
+ if !(defined? @@pin_aliases_target) ||
354
+ (@@pin_aliases_target != Origen.target.signature)
355
+ Origen::Pins.clear_pin_aliases
356
+ @@pin_aliases_target = Origen.target.signature
357
+ end
358
+ Origen::Pins.pin_aliases
359
+ end
360
+
361
+ # API v2, deprecated
362
+ def pin_order
363
+ @pin_order ||= 10_000_000
364
+ @pin_order += 1
365
+ end
366
+
367
+ # API v2, deprecated
368
+ def pin_order_block(order)
369
+ pin_order_orig = @pin_order
370
+ @pin_order = order * 1000
371
+ yield
372
+ @pin_order = pin_order_orig
373
+ end
374
+
375
+ # Returns true if the module has access to a pin with the given name
376
+ # within the current context
377
+ def has_pin?(id)
378
+ !!Origen.pin_bank.find(id)
379
+ end
380
+ alias_method :has_pins?, :has_pin?
381
+
382
+ # Equivalent to the has_pin? method but considers power pins rather than regular pins
383
+ def has_power_pin?(id)
384
+ !!Origen.pin_bank.find(id, power_pin: true)
385
+ end
386
+ alias_method :has_power_pins?, :has_power_pin?
387
+
388
+ # Equivalent to the has_pin? method but considers ground pins rather than regular pins
389
+ def has_ground_pin?(id)
390
+ !!Origen.pin_bank.find(id, ground_pin: true)
391
+ end
392
+ alias_method :has_ground_pins?, :has_ground_pin?
393
+
394
+ def add_pin_group(id, *pins, &_block)
395
+ if pins.last.is_a?(Hash)
396
+ options = pins.pop
397
+ else
398
+ options = {}
399
+ end
400
+ # check if this is a pin group alias
401
+
402
+ found = false
403
+ group = nil
404
+ unless options[:pins_only] == true
405
+ pins.each do |i|
406
+ if pin_groups.include?(i)
407
+ group = add_pin_group_alias(id, i, options)
408
+ found = true
409
+ end
410
+ end
411
+ end
412
+ unless found # not a pin group alias
413
+ group = Origen.pin_bank.find_or_create_pin_group(id, self, options)
414
+ if block_given?
415
+ yield group
416
+ else
417
+ # SMcG:
418
+ #
419
+ # Not 100% sure that this is right, but the idea here is that when manually defining a pin
420
+ # group the user will naturally think in endian order. e.g. when defining a big endian group
421
+ # they would do:
422
+ #
423
+ # add_pin_group :pa, :pa7, :pa5, :pa1, :pa0
424
+ #
425
+ # But if it was little endian they would probably do:
426
+ #
427
+ # add_pin_group :pa, :pa0, :pa1, :pa5, :pa7, :endian => :little
428
+ #
429
+ # However I never work on little endian ports so I don't know for sure!
430
+ #
431
+ # In both cases though we always want pins(:pa)[0] to return :pa0.
432
+ if options[:endian] == :little
433
+ pins.each { |pin| group.add_pin(pin, options) }
434
+ else
435
+ pins.reverse_each { |pin| group.add_pin(pin, options) }
436
+ end
437
+ end
438
+ end
439
+ group
440
+ # Origen.pin_bank.add_pin_group(group, self, {:pins_exist => true}.merge(options))
441
+ end
442
+
443
+ def add_power_pin_group(id, *pins, &block)
444
+ if pins.last.is_a?(Hash)
445
+ options = pins.pop
446
+ else
447
+ options = {}
448
+ end
449
+ options = {
450
+ power_pin: true
451
+ }.merge(options)
452
+ add_pin_group(id, *pins, options, &block)
453
+ end
454
+
455
+ def add_ground_pin_group(id, *pins, &block)
456
+ if pins.last.is_a?(Hash)
457
+ options = pins.pop
458
+ else
459
+ options = {}
460
+ end
461
+ options = {
462
+ ground_pin: true
463
+ }.merge(options)
464
+ add_pin_group(id, *pins, options, &block)
465
+ end
466
+
467
+ # Similar to the pins method except that this method will bypass the package/mode/configuration
468
+ # scope.
469
+ #
470
+ # Therefore with no id supplied it will return all known pins and with an id it will return the
471
+ # given pin object regardless of where or not it is enabled by the current context
472
+ def all_pins(id = nil, _options = {}, &_block)
473
+ if id
474
+ pin = Origen.pin_bank.find(id, ignore_context: true)
475
+ else
476
+ Origen.pin_bank.all_pins
477
+ end
478
+ end
479
+
480
+ # Equivalent to the all_pins method but considers power pins rather than regular pins
481
+ def all_power_pins(id = nil, _options = {}, &_block)
482
+ if id
483
+ pin = Origen.pin_bank.find(id, ignore_context: true, power_pin: true)
484
+ else
485
+ Origen.pin_bank.all_power_pins
486
+ end
487
+ end
488
+
489
+ # Equivalent to the all_pins method but considers ground pins rather than regular pins
490
+ def all_ground_pins(id = nil, _options = {}, &_block)
491
+ if id
492
+ pin = Origen.pin_bank.find(id, ignore_context: true, ground_pin: true)
493
+ else
494
+ Origen.pin_bank.all_ground_pins
495
+ end
496
+ end
497
+
498
+ def pin_groups(id = nil, options = {}, &_block)
499
+ id, options = nil, id if id.is_a?(Hash)
500
+ if id
501
+ pin = Origen.pin_bank.find(id, options)
502
+ unless pin
503
+ puts <<-END
504
+ You have tried to reference pin_group :#{id} within #{self.class} but it does not exist, this could be
505
+ because the pin has not been defined yet or it is an alias that is not available in the current context.
506
+
507
+ If you meant to define the pin_group then use the add_pin_group method instead.
508
+
509
+ END
510
+ fail 'Pin not found'
511
+ end
512
+ pin
513
+ else
514
+ Origen.pin_bank.pin_groups(options)
515
+ end
516
+ end
517
+ alias_method :pin_group, :pin_groups
518
+
519
+ # Equivalent to the pin_groups method but considers power pins rather than regular pins
520
+ def power_pin_groups(id = nil, options = {}, &_block)
521
+ id, options = nil, id if id.is_a?(Hash)
522
+ if id
523
+ pin = Origen.pin_bank.find(id, options.merge(power_pin: true))
524
+ unless pin
525
+ puts <<-END
526
+ You have tried to reference power_pin_group :#{id} within #{self.class} but it does not exist, this could be
527
+ because the pin group has not been defined yet or it is an alias that is not available in the current context.
528
+
529
+ If you meant to define the power_pin_group then use the add_power_pin_group method instead.
530
+
531
+ END
532
+ fail 'Power pin group not found'
533
+ end
534
+ pin
535
+ else
536
+ Origen.pin_bank.power_pin_groups(options)
537
+ end
538
+ end
539
+ alias_method :power_pin_group, :power_pin_groups
540
+
541
+ # Equivalent to the pin_groups method but considers ground pins rather than regular pins
542
+ def ground_pin_groups(id = nil, options = {}, &_block)
543
+ id, options = nil, id if id.is_a?(Hash)
544
+ if id
545
+ pin = Origen.pin_bank.find(id, options.merge(ground_pin: true))
546
+ unless pin
547
+ puts <<-END
548
+ You have tried to reference ground_pin_group :#{id} within #{self.class} but it does not exist, this could be
549
+ because the pin group has not been defined yet or it is an alias that is not available in the current context.
550
+
551
+ If you meant to define the ground_pin_group then use the add_ground_pin_group method instead.
552
+
553
+ END
554
+ fail 'Power pin group not found'
555
+ end
556
+ pin
557
+ else
558
+ Origen.pin_bank.ground_pin_groups(options)
559
+ end
560
+ end
561
+ alias_method :ground_pin_group, :ground_pin_groups
562
+
563
+ # Permits access via object.pin(x), returns a hash of all pins if no id
564
+ # is specified.
565
+ # ==== Examples
566
+ # $top.pin(:done)
567
+ # $soc.pin(:port_a1)
568
+ # pin(:fail) # Access directly from within the module
569
+ def pins(id = nil, options = {}, &_block)
570
+ id, options = nil, id if id.is_a?(Hash)
571
+ if id
572
+ pin = Origen.pin_bank.find(id, options)
573
+ unless pin
574
+ puts <<-END
575
+ You have tried to reference pin :#{id} within #{self.class} but it does not exist, this could be
576
+ because the pin has not been defined yet or it is an alias that is not available in the current context.
577
+
578
+ If you meant to define the pin then use the add_pin method instead.
579
+
580
+ END
581
+ fail 'Pin not found'
582
+ end
583
+ pin
584
+ else
585
+ if options[:power_pin]
586
+ Origen.pin_bank.power_pins
587
+ elsif options[:ground_pin]
588
+ Origen.pin_bank.ground_pins
589
+ else
590
+ Origen.pin_bank.pins
591
+ end
592
+ end
593
+ end
594
+ alias_method :pin, :pins
595
+ alias_method :port, :pins
596
+ alias_method :ports, :pins
597
+
598
+ # Equivalent to the pins method but considers power pins rather than regular pins
599
+ def power_pins(id = nil, options = {}, &block)
600
+ id, options = nil, id if id.is_a?(Hash)
601
+ options = {
602
+ power_pin: true
603
+ }.merge(options)
604
+ pins(id, options, &block)
605
+ end
606
+
607
+ # Equivalent to the pins method but considers ground pins rather than regular pins
608
+ def ground_pins(id = nil, options = {}, &block)
609
+ id, options = nil, id if id.is_a?(Hash)
610
+ options = {
611
+ ground_pin: true
612
+ }.merge(options)
613
+ pins(id, options, &block)
614
+ end
615
+
616
+ def delete_all_pins
617
+ Origen.pin_bank.send :empty!
618
+ end
619
+
620
+ # Delete any pin or pin group. If arg is a pin then delete the pin and any instances
621
+ # of it in any pin groups
622
+ def delete_pin(id, options = {})
623
+ id = id.to_sym
624
+ # Check if this is a Pin or a PinGroup
625
+ if pin_groups.key? id
626
+ Origen.pin_bank.delete_pingroup(Origen.pin_bank.find_pin_group(id, options))
627
+ elsif pins(id).class.to_s.match(/Pin/)
628
+ Origen.pin_bank.delete_pin(Origen.pin_bank.find(id, options))
629
+ else
630
+ fail "Error: the object #{id} you tried to delete is not a pin or pingroup"
631
+ end
632
+ end
633
+
634
+ # @api private
635
+ #
636
+ # If the pin is a port it will select the target pin from it based on the options
637
+ #
638
+ # API v2, deprecated
639
+ def resolve_pin(obj, options)
640
+ if obj.is_a?(Port)
641
+ pins = options[:pin] || options[:pins]
642
+ if pins
643
+ pins = clean_pin_arg(pins)
644
+ if pins.size == 1
645
+ obj[pins.first]
646
+ else
647
+ port = Port.new("subset_of_#{obj.id}", obj.owner, add_pins: false, size: pins.size)
648
+ pins.each do |pin|
649
+ port.add_pin_object(obj[pin])
650
+ end
651
+ port
652
+ end
653
+ else
654
+ obj
655
+ end
656
+ else
657
+ obj
658
+ end
659
+ end
660
+
661
+ # @api private
662
+ #
663
+ # Returns an array of ids, regardless if the input is a single number, an array,
664
+ # a range, or an array contaning a range
665
+ #
666
+ # API v2, deprecated
667
+ def clean_pin_arg(pin)
668
+ pin = [pin].flatten
669
+ pin.map { |obj| range_to_array(obj) }.flatten.sort
670
+ end
671
+
672
+ # @api private
673
+ #
674
+ # API v2, deprecated
675
+ def range_to_array(range)
676
+ if range.is_a?(Range)
677
+ a = range.first
678
+ b = range.last
679
+ if a > b
680
+ (b..a).to_a
681
+ else
682
+ (a..b).to_a
683
+ end
684
+ else
685
+ range
686
+ end
687
+ end
688
+
689
+ # API v2, deprecated
690
+ # @api private
691
+ def add_pin_object(pin)
692
+ @pins ||= {}
693
+ @pins[@pins.size] = pin
694
+ end
695
+ end
696
+ end