origen 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ctags +0 -0
- data/bin/origen +165 -1
- data/bin/rgen +2 -0
- data/config/application.rb +141 -0
- data/config/commands.rb +72 -0
- data/config/development.rb +7 -0
- data/config/environment.rb +0 -0
- data/config/rgen.policy +7 -0
- data/config/rubocop/easy.yml +620 -0
- data/config/rubocop/easy_disabled.yml +271 -0
- data/config/rubocop/easy_enabled.yml +731 -0
- data/config/rubocop/strict.yml +620 -0
- data/config/rubocop/strict_disabled.yml +247 -0
- data/config/rubocop/strict_enabled.yml +755 -0
- data/config/users.rb +20 -0
- data/config/version.rb +1 -1
- data/helpers/url.rb +68 -0
- data/lib/c99/doc_interface.rb +56 -0
- data/lib/c99/j750_interface.rb +85 -0
- data/lib/c99/nvm.rb +89 -0
- data/lib/c99/target/mock2.rb +1 -0
- data/lib/c99/target/subdir/mock3.rb +1 -0
- data/lib/option_parser/optparse.rb +12 -0
- data/lib/origen/acronyms.rb +60 -0
- data/lib/origen/application/command_dispatcher.rb +12 -0
- data/lib/origen/application/configuration.rb +206 -0
- data/lib/origen/application/configuration_manager.rb +78 -0
- data/lib/origen/application/deployer.rb +367 -0
- data/lib/origen/application/environment.rb +186 -0
- data/lib/origen/application/lsf.rb +145 -0
- data/lib/origen/application/lsf_manager.rb +657 -0
- data/lib/origen/application/plugins_manager.rb +280 -0
- data/lib/origen/application/release.rb +359 -0
- data/lib/origen/application/runner.rb +246 -0
- data/lib/origen/application/statistics.rb +191 -0
- data/lib/origen/application/target.rb +374 -0
- data/lib/origen/application/version_tracker.rb +59 -0
- data/lib/origen/application/workspace_manager.rb +151 -0
- data/lib/origen/application.rb +746 -0
- data/lib/origen/bugs/bug.rb +36 -0
- data/lib/origen/bugs.rb +45 -0
- data/lib/origen/callbacks.rb +35 -0
- data/lib/origen/chip_mode.rb +118 -0
- data/lib/origen/chip_package.rb +461 -0
- data/lib/origen/client.rb +87 -0
- data/lib/origen/code_generators/actions.rb +258 -0
- data/lib/origen/code_generators/base.rb +57 -0
- data/lib/origen/code_generators/bundler.rb +17 -0
- data/lib/origen/code_generators/gem_setup.rb +49 -0
- data/lib/origen/code_generators/rake.rb +13 -0
- data/lib/origen/code_generators/rspec.rb +12 -0
- data/lib/origen/code_generators/semver.rb +39 -0
- data/lib/origen/code_generators/timever.rb +37 -0
- data/lib/origen/code_generators.rb +111 -0
- data/lib/origen/commands/add.rb +12 -0
- data/lib/origen/commands/compile.rb +62 -0
- data/lib/origen/commands/ctags.rb +9 -0
- data/lib/origen/commands/dispatch.rb +22 -0
- data/lib/origen/commands/environment.rb +11 -0
- data/lib/origen/commands/fetch.rb +63 -0
- data/lib/origen/commands/generate.rb +130 -0
- data/lib/origen/commands/interactive.rb +73 -0
- data/lib/origen/commands/lint.rb +82 -0
- data/lib/origen/commands/lsf.rb +93 -0
- data/lib/origen/commands/merge.rb +55 -0
- data/lib/origen/commands/modifications.rb +12 -0
- data/lib/origen/commands/new.rb +113 -0
- data/lib/origen/commands/plugin.rb +105 -0
- data/lib/origen/commands/program.rb +70 -0
- data/lib/origen/commands/rc.rb +442 -0
- data/lib/origen/commands/save.rb +56 -0
- data/lib/origen/commands/target.rb +27 -0
- data/lib/origen/commands/time.rb +127 -0
- data/lib/origen/commands/version.rb +17 -0
- data/lib/origen/commands/web.rb +221 -0
- data/lib/origen/commands.rb +272 -0
- data/lib/origen/commands_global.rb +76 -0
- data/lib/origen/controller.rb +94 -0
- data/lib/origen/core_ext/array.rb +23 -0
- data/lib/origen/core_ext/bignum.rb +36 -0
- data/lib/origen/core_ext/enumerable.rb +76 -0
- data/lib/origen/core_ext/fixnum.rb +46 -0
- data/lib/origen/core_ext/hash.rb +52 -0
- data/lib/origen/core_ext/module.rb +14 -0
- data/lib/origen/core_ext/numeric.rb +126 -0
- data/lib/origen/core_ext/object.rb +13 -0
- data/lib/origen/core_ext/range.rb +7 -0
- data/lib/origen/core_ext/string.rb +124 -0
- data/lib/origen/core_ext.rb +10 -0
- data/lib/origen/database/key_value_store.rb +111 -0
- data/lib/origen/database/key_value_stores.rb +108 -0
- data/lib/origen/database.rb +6 -0
- data/lib/origen/encodings.rb +102 -0
- data/lib/origen/features/feature.rb +22 -0
- data/lib/origen/features.rb +104 -0
- data/lib/origen/file_handler.rb +429 -0
- data/lib/origen/generator/comparator.rb +56 -0
- data/lib/origen/generator/compiler.rb +277 -0
- data/lib/origen/generator/flow.rb +49 -0
- data/lib/origen/generator/job.rb +131 -0
- data/lib/origen/generator/pattern.rb +356 -0
- data/lib/origen/generator/pattern_finder.rb +155 -0
- data/lib/origen/generator/pattern_iterator.rb +55 -0
- data/lib/origen/generator/renderer.rb +113 -0
- data/lib/origen/generator/resources.rb +40 -0
- data/lib/origen/generator/stage.rb +89 -0
- data/lib/origen/generator.rb +85 -0
- data/lib/origen/global_methods.rb +205 -0
- data/lib/origen/import_manager.rb +596 -0
- data/lib/origen/location/base.rb +116 -0
- data/lib/origen/location/map.rb +83 -0
- data/lib/origen/location.rb +6 -0
- data/lib/origen/log.rb +217 -0
- data/lib/origen/logger_methods.rb +56 -0
- data/lib/origen/mode.rb +61 -0
- data/lib/origen/model.rb +267 -0
- data/lib/origen/model_initializer.rb +45 -0
- data/lib/origen/nvm/block_array.rb +72 -0
- data/lib/origen/nvm.rb +6 -0
- data/lib/origen/parameters/live.rb +22 -0
- data/lib/origen/parameters/missing.rb +28 -0
- data/lib/origen/parameters/set.rb +144 -0
- data/lib/origen/parameters.rb +107 -0
- data/lib/origen/pdm.rb +218 -0
- data/lib/origen/pins/function_proxy.rb +36 -0
- data/lib/origen/pins/ground_pin.rb +6 -0
- data/lib/origen/pins/pin.rb +860 -0
- data/lib/origen/pins/pin_bank.rb +349 -0
- data/lib/origen/pins/pin_clock.rb +124 -0
- data/lib/origen/pins/pin_collection.rb +492 -0
- data/lib/origen/pins/pin_common.rb +206 -0
- data/lib/origen/pins/port.rb +268 -0
- data/lib/origen/pins/power_pin.rb +30 -0
- data/lib/origen/pins.rb +696 -0
- data/lib/origen/registers/bit.rb +562 -0
- data/lib/origen/registers/bit_collection.rb +787 -0
- data/lib/origen/registers/container.rb +288 -0
- data/lib/origen/registers/domain.rb +16 -0
- data/lib/origen/registers/reg.rb +1406 -0
- data/lib/origen/registers/reg_collection.rb +24 -0
- data/lib/origen/registers.rb +652 -0
- data/lib/origen/regression_manager.rb +251 -0
- data/lib/origen/remote_manager.rb +340 -0
- data/lib/origen/revision_control/base.rb +257 -0
- data/lib/origen/revision_control/design_sync.rb +276 -0
- data/lib/origen/revision_control/git.rb +243 -0
- data/lib/origen/revision_control/subversion.rb +6 -0
- data/lib/origen/revision_control.rb +44 -0
- data/lib/origen/ruby_version_check.rb +131 -0
- data/lib/origen/site_config.rb +61 -0
- data/lib/origen/specs/checkers.rb +103 -0
- data/lib/origen/specs/creation_info.rb +17 -0
- data/lib/origen/specs/doc_resource.rb +91 -0
- data/lib/origen/specs/exhibit.rb +17 -0
- data/lib/origen/specs/mode_select.rb +16 -0
- data/lib/origen/specs/note.rb +17 -0
- data/lib/origen/specs/override.rb +21 -0
- data/lib/origen/specs/power_supply.rb +13 -0
- data/lib/origen/specs/spec.rb +226 -0
- data/lib/origen/specs/version_history.rb +14 -0
- data/lib/origen/specs.rb +552 -0
- data/lib/origen/sub_blocks.rb +298 -0
- data/lib/origen/tester/api.rb +277 -0
- data/lib/origen/tester/bdm/bdm.rb +25 -0
- data/lib/origen/tester/command_based_tester.rb +46 -0
- data/lib/origen/tester/doc/doc.rb +226 -0
- data/lib/origen/tester/doc/generator/flow.rb +71 -0
- data/lib/origen/tester/doc/generator/flow_line.rb +203 -0
- data/lib/origen/tester/doc/generator/test.rb +68 -0
- data/lib/origen/tester/doc/generator/test_group.rb +66 -0
- data/lib/origen/tester/doc/generator/tests.rb +47 -0
- data/lib/origen/tester/doc/generator.rb +126 -0
- data/lib/origen/tester/doc/model.rb +162 -0
- data/lib/origen/tester/generator/flow_control_api.rb +606 -0
- data/lib/origen/tester/generator/identity_map.rb +25 -0
- data/lib/origen/tester/generator/placeholder.rb +13 -0
- data/lib/origen/tester/generator/test_numberer.rb +25 -0
- data/lib/origen/tester/generator.rb +271 -0
- data/lib/origen/tester/interface.rb +154 -0
- data/lib/origen/tester/j750/files.rb +45 -0
- data/lib/origen/tester/j750/generator/flow.rb +123 -0
- data/lib/origen/tester/j750/generator/flow_line.rb +288 -0
- data/lib/origen/tester/j750/generator/patgroup.rb +111 -0
- data/lib/origen/tester/j750/generator/patgroups.rb +41 -0
- data/lib/origen/tester/j750/generator/patset.rb +111 -0
- data/lib/origen/tester/j750/generator/patsets.rb +41 -0
- data/lib/origen/tester/j750/generator/templates/flow.txt.erb +9 -0
- data/lib/origen/tester/j750/generator/templates/instances.txt.erb +16 -0
- data/lib/origen/tester/j750/generator/templates/patgroups.txt.erb +8 -0
- data/lib/origen/tester/j750/generator/templates/patsets.txt.erb +10 -0
- data/lib/origen/tester/j750/generator/test_instance.rb +846 -0
- data/lib/origen/tester/j750/generator/test_instance_group.rb +60 -0
- data/lib/origen/tester/j750/generator/test_instances.rb +182 -0
- data/lib/origen/tester/j750/generator.rb +203 -0
- data/lib/origen/tester/j750/j750.rb +845 -0
- data/lib/origen/tester/j750/j750_hpt.rb +35 -0
- data/lib/origen/tester/j750/parser/ac_spec.rb +11 -0
- data/lib/origen/tester/j750/parser/ac_specs.rb +0 -0
- data/lib/origen/tester/j750/parser/dc_spec.rb +36 -0
- data/lib/origen/tester/j750/parser/dc_specs.rb +50 -0
- data/lib/origen/tester/j750/parser/descriptions.rb +340 -0
- data/lib/origen/tester/j750/parser/flow.rb +111 -0
- data/lib/origen/tester/j750/parser/flow_line.rb +207 -0
- data/lib/origen/tester/j750/parser/flows.rb +23 -0
- data/lib/origen/tester/j750/parser/pattern_set.rb +94 -0
- data/lib/origen/tester/j750/parser/pattern_sets.rb +33 -0
- data/lib/origen/tester/j750/parser/test_instance.rb +322 -0
- data/lib/origen/tester/j750/parser/test_instances.rb +26 -0
- data/lib/origen/tester/j750/parser/timeset.rb +15 -0
- data/lib/origen/tester/j750/parser/timesets.rb +0 -0
- data/lib/origen/tester/j750/parser.rb +104 -0
- data/lib/origen/tester/jlink/jlink.rb +33 -0
- data/lib/origen/tester/parser/description_lookup.rb +64 -0
- data/lib/origen/tester/parser/searchable_array.rb +32 -0
- data/lib/origen/tester/parser/searchable_hash.rb +32 -0
- data/lib/origen/tester/parser.rb +24 -0
- data/lib/origen/tester/time.rb +338 -0
- data/lib/origen/tester/timing.rb +253 -0
- data/lib/origen/tester/ultraflex/files.rb +45 -0
- data/lib/origen/tester/ultraflex/generator/flow.rb +119 -0
- data/lib/origen/tester/ultraflex/generator/flow_line.rb +269 -0
- data/lib/origen/tester/ultraflex/generator/patgroup.rb +111 -0
- data/lib/origen/tester/ultraflex/generator/patgroups.rb +41 -0
- data/lib/origen/tester/ultraflex/generator/patset.rb +111 -0
- data/lib/origen/tester/ultraflex/generator/patsets.rb +41 -0
- data/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb +9 -0
- data/lib/origen/tester/ultraflex/generator/templates/instances.txt.erb +16 -0
- data/lib/origen/tester/ultraflex/generator/templates/patgroups.txt.erb +8 -0
- data/lib/origen/tester/ultraflex/generator/templates/patsets.txt.erb +10 -0
- data/lib/origen/tester/ultraflex/generator/test_instance.rb +622 -0
- data/lib/origen/tester/ultraflex/generator/test_instance_group.rb +60 -0
- data/lib/origen/tester/ultraflex/generator/test_instances.rb +174 -0
- data/lib/origen/tester/ultraflex/generator.rb +200 -0
- data/lib/origen/tester/ultraflex/parser/ac_spec.rb +11 -0
- data/lib/origen/tester/ultraflex/parser/ac_specs.rb +0 -0
- data/lib/origen/tester/ultraflex/parser/dc_spec.rb +36 -0
- data/lib/origen/tester/ultraflex/parser/dc_specs.rb +50 -0
- data/lib/origen/tester/ultraflex/parser/descriptions.rb +342 -0
- data/lib/origen/tester/ultraflex/parser/flow.rb +111 -0
- data/lib/origen/tester/ultraflex/parser/flow_line.rb +207 -0
- data/lib/origen/tester/ultraflex/parser/flows.rb +23 -0
- data/lib/origen/tester/ultraflex/parser/pattern_set.rb +94 -0
- data/lib/origen/tester/ultraflex/parser/pattern_sets.rb +33 -0
- data/lib/origen/tester/ultraflex/parser/test_instance.rb +262 -0
- data/lib/origen/tester/ultraflex/parser/test_instances.rb +26 -0
- data/lib/origen/tester/ultraflex/parser/timeset.rb +15 -0
- data/lib/origen/tester/ultraflex/parser/timesets.rb +0 -0
- data/lib/origen/tester/ultraflex/parser.rb +104 -0
- data/lib/origen/tester/ultraflex/ultraflex.rb +759 -0
- data/lib/origen/tester/v93k/generator/flow.rb +63 -0
- data/lib/origen/tester/v93k/generator/flow_node/print.rb +10 -0
- data/lib/origen/tester/v93k/generator/flow_node.rb +17 -0
- data/lib/origen/tester/v93k/generator/pattern.rb +16 -0
- data/lib/origen/tester/v93k/generator/pattern_master.rb +54 -0
- data/lib/origen/tester/v93k/generator/templates/_test_method.txt.erb +6 -0
- data/lib/origen/tester/v93k/generator/templates/_test_suite.txt.erb +11 -0
- data/lib/origen/tester/v93k/generator/templates/template.flow.erb +121 -0
- data/lib/origen/tester/v93k/generator/templates/template.pmfl.erb +9 -0
- data/lib/origen/tester/v93k/generator/test_function.rb +103 -0
- data/lib/origen/tester/v93k/generator/test_functions.rb +79 -0
- data/lib/origen/tester/v93k/generator/test_method.rb +46 -0
- data/lib/origen/tester/v93k/generator/test_methods.rb +75 -0
- data/lib/origen/tester/v93k/generator/test_suite.rb +54 -0
- data/lib/origen/tester/v93k/generator/test_suites.rb +65 -0
- data/lib/origen/tester/v93k/generator.rb +80 -0
- data/lib/origen/tester/v93k/v93k.rb +420 -0
- data/lib/origen/tester/vector.rb +86 -0
- data/lib/origen/tester/vector_generator.rb +633 -0
- data/lib/origen/tester/vector_pipeline.rb +150 -0
- data/lib/origen/tester.rb +56 -0
- data/lib/origen/top_level.rb +134 -0
- data/lib/origen/users/ldap.rb +65 -0
- data/lib/origen/users/user.rb +149 -0
- data/lib/origen/users.rb +30 -0
- data/lib/origen/utility/block_args.rb +93 -0
- data/lib/origen/utility/csv_data.rb +110 -0
- data/lib/origen/utility/design_sync.rb +494 -0
- data/lib/origen/utility/diff.rb +158 -0
- data/lib/origen/utility/input_capture.rb +121 -0
- data/lib/origen/utility/mailer.rb +143 -0
- data/lib/origen/utility/s_record.rb +205 -0
- data/lib/origen/utility/time_and_date.rb +30 -0
- data/lib/origen/utility.rb +12 -0
- data/lib/origen/version_checker.rb +117 -0
- data/lib/origen/version_string.rb +356 -0
- data/lib/origen.rb +648 -0
- data/lib/tasks/gem.rake +27 -22
- data/origen_site_config.yml +36 -0
- data/source_setup +17 -0
- data/spec/format/rgen_formatter.rb +14 -0
- data/templates/api_doc/README.txt.erb +24 -0
- data/templates/code_generators/gemfile_app.rb +4 -0
- data/templates/code_generators/gemfile_plugin.rb +6 -0
- data/templates/code_generators/gemspec.rb +33 -0
- data/templates/code_generators/rakefile.rb +10 -0
- data/templates/code_generators/spec_helper.rb +49 -0
- data/templates/code_generators/version.rb +8 -0
- data/templates/code_generators/version_time.rb +3 -0
- data/templates/git/gitignore.erb +33 -0
- data/templates/j750/_vt_flow.txt.erb +8 -0
- data/templates/j750/_vt_instances.txt.erb +4 -0
- data/templates/j750/program_sheet.txt.erb +9 -0
- data/templates/nanoc/Rules +74 -0
- data/templates/nanoc/config.yaml +77 -0
- data/templates/nanoc/content/favicon.ico +0 -0
- data/templates/nanoc/layouts/bootstrap.html.erb +63 -0
- data/templates/nanoc/layouts/bootstrap3.html.erb +71 -0
- data/templates/nanoc/layouts/freescale.html.erb +79 -0
- data/templates/nanoc/lib/bootstrap_filter.rb +49 -0
- data/templates/nanoc/lib/codeblocks_filter.rb +41 -0
- data/templates/nanoc/lib/default.rb +2 -0
- data/templates/nanoc/lib/gzip_filter.rb +16 -0
- data/templates/nanoc/lib/haml_code_filter.rb +41 -0
- data/templates/nanoc/lib/helpers.rb +1 -0
- data/templates/nanoc/lib/search_filter.rb +62 -0
- data/templates/nanoc_dynamic/content/search.js.erb +92 -0
- data/templates/shared/web/_logo.html +10 -0
- data/templates/test/_inline_sub.txt.erb +2 -0
- data/templates/test/environment.txt.erb +1 -0
- data/templates/test/inline.txt.erb +11 -0
- data/templates/test/inspections.txt.erb +19 -0
- data/templates/test/set1/_sub1.txt.erb +12 -0
- data/templates/test/set1/_sub4.txt.erb +1 -0
- data/templates/test/set1/_sub5.txt.erb +1 -0
- data/templates/test/set1/main.txt.erb +53 -0
- data/templates/test/set1/sub_dir/_sub2.txt.erb +20 -0
- data/templates/test/set1/sub_dir/_sub3.txt.erb +12 -0
- data/templates/test/set1/sub_dir/main2.txt.erb +4 -0
- data/templates/test/set2/template_with_no_erb_1.txt +9 -0
- data/templates/test/set2/template_with_no_erb_2.txt +9 -0
- data/templates/test/set3/_layout.html.erb +4 -0
- data/templates/test/set3/content.html.erb +6 -0
- data/templates/time/filter.rb.erb +15 -0
- data/templates/time/rules.rb.erb +45 -0
- metadata +639 -5
@@ -0,0 +1,492 @@
|
|
1
|
+
module Origen
|
2
|
+
module Pins
|
3
|
+
# A class that is used to wrap collections of one or more pins. Anytime a group
|
4
|
+
# of pins is fetched or returned by the Pin API it will be wrapped in a PinCollection.
|
5
|
+
class PinCollection
|
6
|
+
include PinCommon
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
attr_accessor :endian
|
10
|
+
attr_accessor :description
|
11
|
+
|
12
|
+
def initialize(owner, *pins)
|
13
|
+
options = pins.last.is_a?(Hash) ? pins.pop : {}
|
14
|
+
options = {
|
15
|
+
endian: :big
|
16
|
+
}.merge(options)
|
17
|
+
@power_pins = options.delete(:power_pin) || options.delete(:power_pins)
|
18
|
+
@ground_pins = options.delete(:ground_pin) || options.delete(:ground_pins)
|
19
|
+
@endian = options[:endian]
|
20
|
+
@description = options[:description] || options[:desc]
|
21
|
+
@options = options
|
22
|
+
@store = []
|
23
|
+
pins.each_with_index do |pin, i|
|
24
|
+
@store[i] = pin
|
25
|
+
end
|
26
|
+
on_init(owner, options)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns the value held by the pin group as a string formatted to the current tester's pattern syntax
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
#
|
33
|
+
# pin_group.drive_hi
|
34
|
+
# pin_group.to_vector # => "11111111"
|
35
|
+
# pin_group.expect_lo
|
36
|
+
# pin_group.to_vector # => "LLLLLLLL"
|
37
|
+
def to_vector
|
38
|
+
return @vector_formatted_value if @vector_formatted_value
|
39
|
+
vals = map(&:to_vector)
|
40
|
+
vals.reverse! if endian == :little
|
41
|
+
@vector_formatted_value = vals.join('')
|
42
|
+
end
|
43
|
+
|
44
|
+
# @api private
|
45
|
+
def invalidate_vector_cache
|
46
|
+
@vector_formatted_value = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
# Set the values and states of the pin group's pins from a string formatted to the current tester's pattern syntax,
|
50
|
+
# this is the opposite of the to_vector method
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
#
|
54
|
+
# pin_group.vector_formatted_value = "LLLLLLLL"
|
55
|
+
# pin_group[0].driving? # => false
|
56
|
+
# pin_group[0].value # => 0
|
57
|
+
# pin_group.vector_formatted_value = "HHHH1111"
|
58
|
+
# pin_group[0].driving? # => true
|
59
|
+
# pin_group[0].value # => 1
|
60
|
+
# pin_group[7].driving? # => false
|
61
|
+
# pin_group[7].value # => 1
|
62
|
+
def vector_formatted_value=(val)
|
63
|
+
unless @vector_formatted_value == val
|
64
|
+
unless val.size == size
|
65
|
+
fail 'When setting vector_formatted_value on a pin group you must supply values for all pins!'
|
66
|
+
end
|
67
|
+
val.split(//).reverse.each_with_index do |val, i|
|
68
|
+
self[i].vector_formatted_value = val
|
69
|
+
end
|
70
|
+
@vector_formatted_value = val
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Returns true if the pin collection contains power pins rather than regular pins
|
75
|
+
def power_pins?
|
76
|
+
@power_pins
|
77
|
+
end
|
78
|
+
|
79
|
+
# Returns true if the pin collection contains ground pins rather than regular pins
|
80
|
+
def ground_pins?
|
81
|
+
@ground_pins
|
82
|
+
end
|
83
|
+
|
84
|
+
def id
|
85
|
+
@id
|
86
|
+
end
|
87
|
+
|
88
|
+
# Explicitly set the name of a pin group/collection
|
89
|
+
def name=(val)
|
90
|
+
@name = val
|
91
|
+
end
|
92
|
+
|
93
|
+
def name
|
94
|
+
@name || id
|
95
|
+
end
|
96
|
+
|
97
|
+
# Overrides the regular Ruby array each to be endian aware. If the pin collection/group is
|
98
|
+
# defined as big endian then this will yield the least significant pin first, otherwise for
|
99
|
+
# little endian the most significant pin will come out first.
|
100
|
+
def each
|
101
|
+
size.times do |i|
|
102
|
+
if endian == :big
|
103
|
+
yield @store[size - i - 1]
|
104
|
+
else
|
105
|
+
yield @store[i]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def size
|
111
|
+
@store.size
|
112
|
+
end
|
113
|
+
|
114
|
+
def [](*indexes)
|
115
|
+
if indexes.size > 1 || indexes.first.is_a?(Range)
|
116
|
+
p = PinCollection.new(owner, @options)
|
117
|
+
expand_and_order(indexes).each do |index|
|
118
|
+
p << @store[index]
|
119
|
+
end
|
120
|
+
p
|
121
|
+
else
|
122
|
+
@store[indexes.first]
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def sort!(&block)
|
127
|
+
@store = sort(&block)
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
def sort_by!
|
132
|
+
@store = sort_by
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
def []=(index, pin)
|
137
|
+
@store[index] = pin
|
138
|
+
end
|
139
|
+
|
140
|
+
# Describe the pin group contents. Default is to display pin.id but passing in
|
141
|
+
# :name will display pin.name
|
142
|
+
def describe(display = :id)
|
143
|
+
desc = ['********************']
|
144
|
+
desc << "Group id: #{id}"
|
145
|
+
desc << "\nDescription: #{description}" if description
|
146
|
+
desc << "\nEndianness: #{endian}"
|
147
|
+
|
148
|
+
unless size == 0
|
149
|
+
desc << ''
|
150
|
+
desc << 'Pins'
|
151
|
+
desc << '-------'
|
152
|
+
if display == :id
|
153
|
+
desc << map(&:id).join(', ')
|
154
|
+
elsif display == :name
|
155
|
+
desc << map(&:name).join(', ')
|
156
|
+
else
|
157
|
+
fail 'Error: Argument options for describe method are :id and :name. Default is :id'
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
desc << '********************'
|
162
|
+
puts desc.join("\n")
|
163
|
+
end
|
164
|
+
|
165
|
+
def add_pin(pin, _options = {})
|
166
|
+
if pin.is_a?(PinCollection)
|
167
|
+
# Need this to bypass the endianness aware iteration, the storing order
|
168
|
+
# is always the same. So can't use each and co here.
|
169
|
+
pin.size.times do |i|
|
170
|
+
pin[i].invalidate_group_cache
|
171
|
+
@store.push(pin[i])
|
172
|
+
end
|
173
|
+
else
|
174
|
+
# Convert any named reference to a pin object
|
175
|
+
if power_pins?
|
176
|
+
pin = owner.power_pins(pin)
|
177
|
+
elsif ground_pins?
|
178
|
+
pin = owner.ground_pins(pin)
|
179
|
+
else
|
180
|
+
pin = owner.pins(pin)
|
181
|
+
end
|
182
|
+
if @store.include?(pin)
|
183
|
+
fail "Pin collection #{id} already contains pin #{pin.id}!"
|
184
|
+
else
|
185
|
+
pin.invalidate_group_cache
|
186
|
+
@store.push(pin)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
alias_method :<<, :add_pin
|
191
|
+
|
192
|
+
def drive(val)
|
193
|
+
val = val.data if val.respond_to?('data')
|
194
|
+
each_with_index do |pin, i|
|
195
|
+
pin.drive(val[size - i - 1])
|
196
|
+
end
|
197
|
+
self
|
198
|
+
end
|
199
|
+
|
200
|
+
def drive!(val)
|
201
|
+
drive(val)
|
202
|
+
cycle
|
203
|
+
end
|
204
|
+
|
205
|
+
# Set all pins in pin group to drive 1's on future cycles
|
206
|
+
def drive_hi
|
207
|
+
each(&:drive_hi)
|
208
|
+
self
|
209
|
+
end
|
210
|
+
|
211
|
+
def drive_hi!
|
212
|
+
drive_hi
|
213
|
+
cycle
|
214
|
+
end
|
215
|
+
|
216
|
+
# Set all pins in pin group to drive 0's on future cycles
|
217
|
+
def drive_lo
|
218
|
+
each(&:drive_lo)
|
219
|
+
self
|
220
|
+
end
|
221
|
+
|
222
|
+
def drive_lo!
|
223
|
+
drive_lo
|
224
|
+
cycle
|
225
|
+
end
|
226
|
+
|
227
|
+
# Set all pins in the pin group to drive a high voltage on future cycles (if the tester supports it).
|
228
|
+
# For example on a J750 high-voltage channel the pin state would be set to "2"
|
229
|
+
def drive_very_hi
|
230
|
+
each(&:drive_very_hi)
|
231
|
+
self
|
232
|
+
end
|
233
|
+
|
234
|
+
def drive_very_hi!
|
235
|
+
drive_very_hi
|
236
|
+
cycle
|
237
|
+
end
|
238
|
+
|
239
|
+
def drive_mem
|
240
|
+
each(&:drive_mem)
|
241
|
+
self
|
242
|
+
end
|
243
|
+
|
244
|
+
def drive_mem!
|
245
|
+
drive_mem
|
246
|
+
cycle
|
247
|
+
end
|
248
|
+
|
249
|
+
def expect_mem
|
250
|
+
each(&:expect_mem)
|
251
|
+
self
|
252
|
+
end
|
253
|
+
|
254
|
+
def expect_mem!
|
255
|
+
expect_mem
|
256
|
+
cycle
|
257
|
+
end
|
258
|
+
|
259
|
+
# Returns the data value held by the collection
|
260
|
+
# ==== Example
|
261
|
+
# pins(:porta).write(0x55)
|
262
|
+
# pins(:porta).data # => 0x55
|
263
|
+
def data
|
264
|
+
data = 0
|
265
|
+
each_with_index { |pin, i| data |= pin.data << (size - i - 1) }
|
266
|
+
data
|
267
|
+
end
|
268
|
+
alias_method :val, :data
|
269
|
+
alias_method :value, :data
|
270
|
+
|
271
|
+
# Returns the inverse of the data value held by the collection
|
272
|
+
def data_b
|
273
|
+
# (& operation takes care of Bignum formatting issues)
|
274
|
+
~data & ((1 << size) - 1)
|
275
|
+
end
|
276
|
+
|
277
|
+
def toggle
|
278
|
+
each(&:toggle)
|
279
|
+
self
|
280
|
+
end
|
281
|
+
|
282
|
+
def toggle!
|
283
|
+
toggle
|
284
|
+
cycle
|
285
|
+
end
|
286
|
+
|
287
|
+
def repeat_previous=(bool)
|
288
|
+
each { |pin| pin.repeat_previous = bool }
|
289
|
+
self
|
290
|
+
end
|
291
|
+
|
292
|
+
# Mark the (data) from all the pins in the pin group to be captured
|
293
|
+
def capture
|
294
|
+
each(&:capture)
|
295
|
+
self
|
296
|
+
end
|
297
|
+
alias_method :store, :capture
|
298
|
+
|
299
|
+
def capture!
|
300
|
+
capture
|
301
|
+
cycle
|
302
|
+
end
|
303
|
+
alias_method :store!, :capture!
|
304
|
+
|
305
|
+
def restore_state
|
306
|
+
each(&:save)
|
307
|
+
yield
|
308
|
+
each(&:restore)
|
309
|
+
end
|
310
|
+
|
311
|
+
def id=(val)
|
312
|
+
@id = val.to_sym
|
313
|
+
end
|
314
|
+
|
315
|
+
def cycle
|
316
|
+
Origen.tester.cycle
|
317
|
+
end
|
318
|
+
|
319
|
+
def assert(value, options = {})
|
320
|
+
value = value.data if value.respond_to?('data')
|
321
|
+
each_with_index do |pin, i|
|
322
|
+
pin.assert(value[size - i - 1], options)
|
323
|
+
end
|
324
|
+
self
|
325
|
+
end
|
326
|
+
alias_method :compare, :assert
|
327
|
+
alias_method :expect, :assert
|
328
|
+
|
329
|
+
def assert!(*args)
|
330
|
+
assert(*args)
|
331
|
+
cycle
|
332
|
+
end
|
333
|
+
alias_method :compare!, :assert!
|
334
|
+
alias_method :expect!, :assert!
|
335
|
+
|
336
|
+
# Set all pins in the pin group to expect 1's on future cycles
|
337
|
+
def assert_hi(options = {})
|
338
|
+
each { |pin| pin.assert_hi(options) }
|
339
|
+
self
|
340
|
+
end
|
341
|
+
alias_method :expect_hi, :assert_hi
|
342
|
+
alias_method :compare_hi, :assert_hi
|
343
|
+
|
344
|
+
def assert_hi!
|
345
|
+
assert_hi
|
346
|
+
cycle
|
347
|
+
end
|
348
|
+
alias_method :expect_hi!, :assert_hi!
|
349
|
+
alias_method :compare_hi!, :assert_hi!
|
350
|
+
|
351
|
+
# Set all pins in the pin group to expect 0's on future cycles
|
352
|
+
def assert_lo(options = {})
|
353
|
+
each { |pin| pin.assert_lo(options) }
|
354
|
+
self
|
355
|
+
end
|
356
|
+
alias_method :expect_lo, :assert_lo
|
357
|
+
alias_method :compare_lo, :assert_lo
|
358
|
+
|
359
|
+
def assert_lo!
|
360
|
+
assert_lo
|
361
|
+
cycle
|
362
|
+
end
|
363
|
+
alias_method :expect_lo!, :assert_lo!
|
364
|
+
alias_method :compare_lo!, :assert_lo!
|
365
|
+
|
366
|
+
# Set all pins in the pin group to X on future cycles
|
367
|
+
def dont_care
|
368
|
+
each(&:dont_care)
|
369
|
+
self
|
370
|
+
end
|
371
|
+
|
372
|
+
def dont_care!
|
373
|
+
dont_care
|
374
|
+
cycle
|
375
|
+
end
|
376
|
+
|
377
|
+
def inverted?
|
378
|
+
all?(&:inverted?)
|
379
|
+
end
|
380
|
+
|
381
|
+
def comparing?
|
382
|
+
all?(&:comparing?)
|
383
|
+
end
|
384
|
+
|
385
|
+
def comparing_mem?
|
386
|
+
all?(&:comparing_mem?)
|
387
|
+
end
|
388
|
+
|
389
|
+
def driving?
|
390
|
+
all?(&:driving?)
|
391
|
+
end
|
392
|
+
|
393
|
+
def driving_mem?
|
394
|
+
all?(&:driving_mem?)
|
395
|
+
end
|
396
|
+
|
397
|
+
def high_voltage?
|
398
|
+
all?(&:high_voltage?)
|
399
|
+
end
|
400
|
+
|
401
|
+
def repeat_previous?
|
402
|
+
all?(&:repeat_previous?)
|
403
|
+
end
|
404
|
+
|
405
|
+
# Returns true if the (data) from the port is marked to be captured
|
406
|
+
def to_be_captured?
|
407
|
+
all?(&:to_be_captured?)
|
408
|
+
end
|
409
|
+
alias_method :to_be_stored?, :to_be_captured?
|
410
|
+
alias_method :is_to_be_stored?, :to_be_captured?
|
411
|
+
alias_method :is_to_be_captured?, :to_be_captured?
|
412
|
+
|
413
|
+
# Deletes all occurrences of a pin in a pin group
|
414
|
+
def delete(p)
|
415
|
+
@store.delete(p)
|
416
|
+
end
|
417
|
+
|
418
|
+
# Deletes the pin at a particular numeric index within the pin group
|
419
|
+
def delete_at(index)
|
420
|
+
@store.delete_at(index)
|
421
|
+
end
|
422
|
+
|
423
|
+
def pins(nick = :id)
|
424
|
+
Origen.deprecate <<-END
|
425
|
+
The PinCollection#pins method is deprecated, if you want to get a list of pin IDs
|
426
|
+
in the given collection just do pins(:some_group).map(&:id)
|
427
|
+
Note that the pins method (confusingly) also does a sort, to replicate that:
|
428
|
+
pins(:some_group).map(&:id).sort
|
429
|
+
END
|
430
|
+
if nick == :id
|
431
|
+
@store.map(&:id).sort
|
432
|
+
elsif nick == :name
|
433
|
+
@store.map(&:name).sort
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
# Delete this pingroup (self)
|
438
|
+
def delete!
|
439
|
+
owner.delete_pin(self)
|
440
|
+
end
|
441
|
+
|
442
|
+
private
|
443
|
+
|
444
|
+
# Cleans up indexed references to pins, e.g. makes these equal:
|
445
|
+
#
|
446
|
+
# pins(:pb)[0,1,2,3]
|
447
|
+
# pins(:pb)[3,2,1,0]
|
448
|
+
# pins(:pb)[0..3]
|
449
|
+
# pins(:pb)[3..0]
|
450
|
+
def expand_and_order(*indexes)
|
451
|
+
ixs = []
|
452
|
+
indexes.flatten.each do |index|
|
453
|
+
if index.is_a?(Range)
|
454
|
+
if index.first > index.last
|
455
|
+
ixs << (index.last..index.first).to_a
|
456
|
+
else
|
457
|
+
ixs << index.to_a
|
458
|
+
end
|
459
|
+
else
|
460
|
+
ixs << index
|
461
|
+
end
|
462
|
+
end
|
463
|
+
ixs.flatten.sort
|
464
|
+
end
|
465
|
+
|
466
|
+
def method_missing(method, *args, &block)
|
467
|
+
# Where the collection is only comprised of one pin delegate missing methods/attributes
|
468
|
+
# to that pin
|
469
|
+
if size == 1
|
470
|
+
first.send(method, *args, &block)
|
471
|
+
# Send all assignment methods to all contained pins
|
472
|
+
elsif method.to_s =~ /.*=$/
|
473
|
+
each do |pin|
|
474
|
+
pin.send(method, *args, &block)
|
475
|
+
end
|
476
|
+
else
|
477
|
+
if block_given?
|
478
|
+
fail 'Blocks are not currently supported by pin collections containing multiple pins!'
|
479
|
+
else
|
480
|
+
# Allow getters if all pins are the same
|
481
|
+
ref = first.send(method, *args)
|
482
|
+
if self.all? { |pin| pin.send(method, *args) == ref }
|
483
|
+
ref
|
484
|
+
else
|
485
|
+
fail "The pins held by pin collection #{id} have different values for #{method}"
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
end
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
module Origen
|
2
|
+
module Pins
|
3
|
+
# Methods and attributes that are common to both pins
|
4
|
+
# and pin groups
|
5
|
+
module PinCommon
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
attr_reader :id
|
10
|
+
attr_reader :owner
|
11
|
+
# Returns a hash containing the chip packages that the given pin is present in and a metadata hash for each package option containing
|
12
|
+
# information like the location or pin number for the given in pin in the given package.
|
13
|
+
attr_reader :packages
|
14
|
+
# Returns a hash containing the chip modes that the given pin is present in and a metadata hash for storing any information
|
15
|
+
# specific to the operation of the given pin in that mode
|
16
|
+
attr_reader :modes
|
17
|
+
# Returns a hash containing the chip configurations that the given pin is present in and a metadata hash for storing any information
|
18
|
+
# specific to the operation of the given pin in that configuration
|
19
|
+
attr_reader :configurations
|
20
|
+
# Override the chip-level configuration attribute for the given pin
|
21
|
+
attr_accessor :configuration
|
22
|
+
# Free format field to store an description of the pin or pin group function
|
23
|
+
attr_accessor :description
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_sym
|
27
|
+
id
|
28
|
+
end
|
29
|
+
|
30
|
+
# The ID of a pin should be considered immutable, however internally it may be neccessary
|
31
|
+
# to change the initial ID as the pins are initially setup
|
32
|
+
#
|
33
|
+
# @api private
|
34
|
+
def id=(val)
|
35
|
+
if @id && @finalized
|
36
|
+
fail 'The ID of a pin cannot be changed once it has been set!'
|
37
|
+
else
|
38
|
+
@id = val
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# @api private
|
43
|
+
def finalize
|
44
|
+
@finalized = true
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns true if the pin is enabled by the current or given context
|
48
|
+
def enabled?(options = {})
|
49
|
+
present_in_package?(options) # && enabled_in_mode?(options) && enabled_in_configuration?(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns true if the pin or pin group is present in the current package context.
|
53
|
+
#
|
54
|
+
# A pin is considered enabled when either no package context is set (all pins available
|
55
|
+
# at die level), or when a package context is set and it matches one attached to the pin
|
56
|
+
def enabled_in_package?(options = {})
|
57
|
+
package = options[:package] || current_package_id
|
58
|
+
if package
|
59
|
+
!!(packages[:all] || packages[package])
|
60
|
+
else
|
61
|
+
true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
alias_method :present_in_package?, :enabled_in_package?
|
65
|
+
|
66
|
+
# Returns true if the pin or pin group is present in the current mode context.
|
67
|
+
def enabled_in_mode?(options = {})
|
68
|
+
mode = options[:mode] || current_mode_id
|
69
|
+
if mode
|
70
|
+
!!(modes[:all] || modes.empty? || modes[mode])
|
71
|
+
# If no mode is specified a pin is only available if it does not have a mode constraint
|
72
|
+
else
|
73
|
+
!!(modes[:all] || modes.empty?)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns true if the pin or pin group is present in the current configuration context.
|
78
|
+
def enabled_in_configuration?(options = {})
|
79
|
+
config = options[:configuration] || current_configuration
|
80
|
+
if config
|
81
|
+
!!(configurations[:all] || configurations.empty? || configurations[config])
|
82
|
+
# If no configuration is specified a pin is only available if it does not have a configuration constraint
|
83
|
+
else
|
84
|
+
!!(configurations[:all] || configurations.empty?)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Make the pin available in the given package, any options that are supplied will be
|
89
|
+
# saved as metadata associated with the given pin in that package
|
90
|
+
def add_package(id, options = {})
|
91
|
+
packages[id] = options
|
92
|
+
if is_a?(Pin)
|
93
|
+
add_location(options[:location], package: id) if options[:location]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Make the pin or pin group available in the given mode, any options that are supplied will be
|
98
|
+
# saved as metadata associated with the given pin in that mode
|
99
|
+
def add_mode(id, options = {})
|
100
|
+
modes[id] = options
|
101
|
+
end
|
102
|
+
|
103
|
+
# Make the pin or pin group available in the given configuration, any options that are supplied will be
|
104
|
+
# saved as metadata associated with the given pin in that configuration
|
105
|
+
def add_configuration(id, options = {})
|
106
|
+
configurations[id] = options
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def on_init(owner, options = {})
|
112
|
+
@owner = owner
|
113
|
+
@description = options[:description]
|
114
|
+
apply_initial_scope(options)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns the current configuration context for this pin/pin group, if a configuration has been
|
118
|
+
# explicitly set on this pin that will be returned, otherwise the current chip-level configuration
|
119
|
+
# context will be returned (nil if none is set)
|
120
|
+
def current_configuration
|
121
|
+
configuration || begin
|
122
|
+
if Origen.top_level
|
123
|
+
Origen.top_level.current_configuration
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Returns the current top-level package ID, nil if none is set.
|
129
|
+
def current_package_id
|
130
|
+
if Origen.top_level && Origen.top_level.current_package
|
131
|
+
Origen.top_level.current_package.id
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Returns the current top-level mode ID, nil if none is set.
|
136
|
+
def current_mode_id
|
137
|
+
if Origen.top_level && Origen.top_level.current_mode
|
138
|
+
Origen.top_level.current_mode.id
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def apply_initial_scope(options)
|
143
|
+
@packages = {}
|
144
|
+
@modes = {}
|
145
|
+
@configurations = {}
|
146
|
+
add_initial_packages(options)
|
147
|
+
add_initial_modes(options)
|
148
|
+
add_initial_configurations(options)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns an array containing the package ids resolved from the given options or
|
152
|
+
# the current top-level context
|
153
|
+
def resolve_packages(options = {})
|
154
|
+
[options.delete(:package) || options.delete(:packages) || current_package_id].flatten.compact
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns an array containing the mode ids resolved from the given options or
|
158
|
+
# the current top-level context
|
159
|
+
def resolve_modes(options = {})
|
160
|
+
[options.delete(:mode) || options.delete(:modes) || current_mode_id].flatten.compact
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns an array containing the configuration ids resolved from the given options or
|
164
|
+
# the current top-level context
|
165
|
+
def resolve_configurations(options = {})
|
166
|
+
[options.delete(:configuration) || options.delete(:configurations) || current_configuration].flatten.compact
|
167
|
+
end
|
168
|
+
|
169
|
+
def add_initial_packages(options)
|
170
|
+
resolve_packages(options).each do |package|
|
171
|
+
if package.is_a?(Hash)
|
172
|
+
package.each do |id, attributes|
|
173
|
+
add_package(id, attributes)
|
174
|
+
end
|
175
|
+
else
|
176
|
+
add_package(package)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def add_initial_modes(options)
|
182
|
+
resolve_modes(options).each do |mode|
|
183
|
+
if mode.is_a?(Hash)
|
184
|
+
mode.each do |id, attributes|
|
185
|
+
add_mode(id, attributes)
|
186
|
+
end
|
187
|
+
else
|
188
|
+
add_mode(mode)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def add_initial_configurations(options)
|
194
|
+
resolve_configurations(options).each do |config|
|
195
|
+
if config.is_a?(Hash)
|
196
|
+
config.each do |id, attributes|
|
197
|
+
add_configuration(id, attributes)
|
198
|
+
end
|
199
|
+
else
|
200
|
+
add_configuration(config)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|