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,562 @@
|
|
1
|
+
module Origen
|
2
|
+
module Registers
|
3
|
+
# Models bits within Reg objects
|
4
|
+
class Bit
|
5
|
+
# The :access property of registers or bits can be set to any of the following
|
6
|
+
# key values. Implemented refers to whether the behaviour is accurately modelled
|
7
|
+
# by the Origen register model or not.
|
8
|
+
ACCESS_CODES = {
|
9
|
+
ro: { implemented: false, description: 'Read-Only' },
|
10
|
+
rw: { implemented: true, description: 'Read-Write' },
|
11
|
+
rc: { implemented: false, description: 'Read-only, Clear-on-read' },
|
12
|
+
rs: { implemented: false, description: "Set-on-read (all bits become '1' on read)" },
|
13
|
+
wrc: { implemented: false, description: 'Writable, clear-on-read' },
|
14
|
+
wrs: { implemented: false, description: 'Writable, Sets-on-read' },
|
15
|
+
wc: { implemented: false, description: 'Clear-on-write' },
|
16
|
+
ws: { implemented: false, description: 'Set-on-write' },
|
17
|
+
wsrc: { implemented: false, description: 'Set-on-write, clear-on-read' },
|
18
|
+
wcrs: { implemented: false, description: 'Clear-on-write, set-on-read' },
|
19
|
+
w1c: { implemented: false, description: "Write '1' to clear bits" },
|
20
|
+
w1s: { implemented: false, description: "Write '1' to set bits" },
|
21
|
+
w1t: { implemented: false, description: "Write '1' to toggle bits" },
|
22
|
+
w0c: { implemented: false, description: "Write '0' to clear bits" },
|
23
|
+
w0s: { implemented: false, description: "Write '0' to set bits" },
|
24
|
+
w0t: { implemented: false, description: "Write '0' to toggle bits" },
|
25
|
+
w1src: { implemented: false, description: "Write '1' to set and clear-on-read" },
|
26
|
+
w1crs: { implemented: false, description: "Write '1' to clear and set-on-read" },
|
27
|
+
w0src: { implemented: false, description: "Write '0' to set and clear-on-read" },
|
28
|
+
w0crs: { implemented: false, description: "Write '0' to clear and set-on-read" },
|
29
|
+
wo: { implemented: false, description: 'Write-only' },
|
30
|
+
woc: { implemented: false, description: "When written sets the field to '0'. Read undeterministic" },
|
31
|
+
worz: { implemented: false, description: 'Write-only, Reads zero' },
|
32
|
+
wos: { implemented: false, description: "When written sets all bits to '1'. Read undeterministic" },
|
33
|
+
w1: { implemented: false, description: 'Write-once. Next time onwards, write is ignored. Read returns the value' },
|
34
|
+
wo1: { implemented: false, description: 'Write-once. Next time onwards, write is ignored. Read is undeterministic' },
|
35
|
+
dc: { implemented: false, description: 'RW but no check' },
|
36
|
+
rowz: { implemented: false, description: 'Read-only, value is cleared on read' }
|
37
|
+
}
|
38
|
+
|
39
|
+
# Returns the Reg object that owns the bit
|
40
|
+
attr_reader :owner
|
41
|
+
# Returns the integer position of the bit within the register
|
42
|
+
attr_reader :position
|
43
|
+
# Current the data value currently held by the bit, 0 or 1
|
44
|
+
attr_reader :data
|
45
|
+
# Returns any overlay string attached to the bit
|
46
|
+
attr_reader :overlay
|
47
|
+
# If the bit does not read back with the same data as is written to it
|
48
|
+
# then this will return true. This property can be assigned durgin the
|
49
|
+
# register instantiation, e.g.
|
50
|
+
# add_reg :control, 0x00, :mode => { :pos => 8, :bits => 8 },
|
51
|
+
# :status => { :pos => 4, :bits => 2, :read_data_matches_write => false }
|
52
|
+
attr_reader :read_data_matches_write
|
53
|
+
# Returns true if this bit has the sticky_overlay flag set, see Reg#sticky_overlay for
|
54
|
+
# a full description. This is true by default.
|
55
|
+
attr_accessor :sticky_overlay
|
56
|
+
# Returns true if this bit has the sticky_store flag set, see Reg#sticky_store for
|
57
|
+
# a full description. This is false by default.
|
58
|
+
attr_accessor :sticky_store
|
59
|
+
# Any feature associated with the bit/bits
|
60
|
+
attr_reader :feature
|
61
|
+
# Returns the reset value of the bit
|
62
|
+
attr_accessor :reset_val
|
63
|
+
alias_method :reset_data, :reset_val
|
64
|
+
alias_method :reset_value, :reset_val
|
65
|
+
# Allow modify of writable flag, bit is writeable by write method
|
66
|
+
attr_writer :writable
|
67
|
+
# Allow modify of readable flag, bit is readable by read method
|
68
|
+
attr_writer :readable
|
69
|
+
# Sets or returns the status of "write-one-to-clear"
|
70
|
+
attr_accessor :w1c
|
71
|
+
# Allow modify of clr_only flag, bit can only be cleared (made 0)
|
72
|
+
attr_writer :clr_only
|
73
|
+
# Allow modify of set_only flag, bit can only be set (made 1)
|
74
|
+
attr_writer :set_only
|
75
|
+
# Returns true if bit depends on initial state of NVM in some way
|
76
|
+
attr_reader :nvm_dep
|
77
|
+
# Returns true if bit is critical to starting an important operation (like a state machine)
|
78
|
+
# so that it can be made not writable during basic register checks
|
79
|
+
attr_reader :start
|
80
|
+
# Returns any application-specific meta-data attatched to the given bit
|
81
|
+
attr_accessor :meta
|
82
|
+
alias_method :meta_data, :meta
|
83
|
+
alias_method :metadata, :meta
|
84
|
+
# Returns the access method for the given bit (a symbol), see the ACCESS_CODES constant for
|
85
|
+
# the possible values this can have and their meaning
|
86
|
+
attr_accessor :access
|
87
|
+
|
88
|
+
def initialize(owner, position, options = {}) # rubocop:disable MethodLength
|
89
|
+
options = {
|
90
|
+
start: false, # whether bit starts a state machine so be careful
|
91
|
+
read_data_matches_write: true,
|
92
|
+
read: false,
|
93
|
+
overlay: false,
|
94
|
+
store: false,
|
95
|
+
sticky_overlay: true,
|
96
|
+
sticky_store: false,
|
97
|
+
nvm_dep: false, # whether is an NVM dependent bit
|
98
|
+
}.merge(options)
|
99
|
+
@owner = owner
|
100
|
+
@position = position
|
101
|
+
@undefined = options.delete(:undefined)
|
102
|
+
@reset_val = (options.delete(:res) || options.delete(:reset) || options.delete(:data) || 0)
|
103
|
+
if @reset_val.is_a?(Symbol)
|
104
|
+
@data = 0
|
105
|
+
else
|
106
|
+
@reset_val &= 1 unless @reset_val.is_a?(Symbol)
|
107
|
+
@data = @reset_val
|
108
|
+
end
|
109
|
+
|
110
|
+
access_code = options.delete(:access)
|
111
|
+
# If access has been defined then none of these other attributes can be
|
112
|
+
if access_code
|
113
|
+
conflicts = [:readable, :writable, :clr_only, :set_only, :w1c]
|
114
|
+
if conflicts.any? { |k| options.key?(k) }
|
115
|
+
puts 'The following attributes cannot be set in combination with :access'
|
116
|
+
puts " #{conflicts.join(', ')}"
|
117
|
+
puts ''
|
118
|
+
puts 'Use :access to defined the required behavior, the above attributes will be deprecated in future.'
|
119
|
+
puts ''
|
120
|
+
fail 'Conflicting access!'
|
121
|
+
end
|
122
|
+
set_access(access_code)
|
123
|
+
else
|
124
|
+
options = {
|
125
|
+
writable: true, # whether bit is writable
|
126
|
+
readable: true, # whether bit is readable
|
127
|
+
clr_only: false, # whether bit is clear only
|
128
|
+
set_only: false, # whether bit is set only
|
129
|
+
w1c: false, # whether bit is w1c (when written to 1 immediately becomes 0)
|
130
|
+
}.merge(options)
|
131
|
+
@readable = options.delete(:readable)
|
132
|
+
@writable = options.delete(:writable)
|
133
|
+
@clr_only = options.delete(:clr_only)
|
134
|
+
@set_only = options.delete(:set_only)
|
135
|
+
@w1c = options.delete(:w1c)
|
136
|
+
set_access_from_rw
|
137
|
+
end
|
138
|
+
# Would like to get this integrated with access as well
|
139
|
+
@read_data_matches_write = options.delete(:read_data_matches_write)
|
140
|
+
|
141
|
+
@feature = options.delete(:feature)
|
142
|
+
if !!feature && @writable
|
143
|
+
@writable = enabled?
|
144
|
+
end
|
145
|
+
@path = options.delete(:path)
|
146
|
+
@abs_path = options.delete(:abs_path)
|
147
|
+
@start = options.delete(:start)
|
148
|
+
@read = options.delete(:read)
|
149
|
+
@overlay = options.delete(:overlay)
|
150
|
+
@store = options.delete(:store)
|
151
|
+
@update_required = false
|
152
|
+
@sticky_store = options.delete(:sticky_store)
|
153
|
+
@sticky_overlay = options.delete(:sticky_overlay)
|
154
|
+
@nvm_dep = (options.delete(:nvm_dep) ? 1 : 0)
|
155
|
+
# Delete some other noise that can be left over...
|
156
|
+
options.delete(:bits)
|
157
|
+
options.delete(:pos)
|
158
|
+
options.delete(:position)
|
159
|
+
options.delete(:data)
|
160
|
+
# Whatever is left must be custom application meta-data
|
161
|
+
@meta = (default_bit_metadata).merge(options)
|
162
|
+
end
|
163
|
+
|
164
|
+
def set_access(value)
|
165
|
+
unless ACCESS_CODES.keys.include?(value)
|
166
|
+
puts 'Invalid access code, must be one of these:'
|
167
|
+
ACCESS_CODES.each do |code, meta|
|
168
|
+
puts " :#{code}".ljust(10) + " - #{meta[:description]}"
|
169
|
+
end
|
170
|
+
puts ''
|
171
|
+
fail 'Invalid access code!'
|
172
|
+
end
|
173
|
+
@access = value
|
174
|
+
|
175
|
+
# Set readable & writable based on access
|
176
|
+
if @access == :ro
|
177
|
+
@readable = true
|
178
|
+
@writable = false
|
179
|
+
elsif @access == :wo || @access == :worz
|
180
|
+
@writable = true
|
181
|
+
@readable = false
|
182
|
+
elsif @access == :w1c
|
183
|
+
@w1c = true
|
184
|
+
@writable = true
|
185
|
+
@readable = true # Is this always valid?
|
186
|
+
elsif @access == :wc
|
187
|
+
@clr_only = true
|
188
|
+
@writable = true
|
189
|
+
@readable = true # Is this always valid?
|
190
|
+
elsif @access == :ws
|
191
|
+
@set_only = true
|
192
|
+
@writable = true
|
193
|
+
@readable = true # Is this always valid?
|
194
|
+
# Catch all for now until the behavior of this class is based around @access
|
195
|
+
else
|
196
|
+
@writable = true
|
197
|
+
@readable = true
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Set @access based on @readable and @writable
|
202
|
+
def set_access_from_rw
|
203
|
+
if @w1c
|
204
|
+
@access = :w1c
|
205
|
+
elsif @clr_only
|
206
|
+
@access = :wc
|
207
|
+
elsif @set_only
|
208
|
+
@access = :ws
|
209
|
+
elsif @readable && @writable
|
210
|
+
@access = :rw
|
211
|
+
elsif @readable
|
212
|
+
@access = :ro
|
213
|
+
elsif @writable && @access != :worz
|
214
|
+
@access = :wo
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def path_var
|
219
|
+
@path
|
220
|
+
end
|
221
|
+
|
222
|
+
def abs_path
|
223
|
+
@abs_path
|
224
|
+
end
|
225
|
+
|
226
|
+
ACCESS_CODES.each do |code, _meta|
|
227
|
+
define_method "#{code}?" do
|
228
|
+
!!(access == code || instance_variable_get("@#{code}"))
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns any application specific metadata that has been inherited by the
|
233
|
+
# given bit.
|
234
|
+
# This does not account for any overridding that may have been applied to
|
235
|
+
# this bit specifically however, use the meta method to get that.
|
236
|
+
def default_bit_metadata
|
237
|
+
Origen::Registers.default_bit_metadata.merge(
|
238
|
+
Origen::Registers.bit_metadata[owner.owner.class] || {})
|
239
|
+
end
|
240
|
+
|
241
|
+
def inspect
|
242
|
+
"<#{self.class}:#{object_id}>"
|
243
|
+
end
|
244
|
+
|
245
|
+
# Always returns 1 when asked for size, a BitCollection on the other hand will return something higher
|
246
|
+
def size
|
247
|
+
1
|
248
|
+
end
|
249
|
+
|
250
|
+
# Make this bit disappear, make it unwritable with a data value of 0
|
251
|
+
def delete
|
252
|
+
@sticky_overlay = false
|
253
|
+
@sticky_store = false
|
254
|
+
clear_flags
|
255
|
+
@data = 0
|
256
|
+
@writable = false
|
257
|
+
self
|
258
|
+
end
|
259
|
+
|
260
|
+
# Returns true if the bit is set (holds a data value of 1)
|
261
|
+
def set?
|
262
|
+
@data == 1 ? true : false
|
263
|
+
end
|
264
|
+
|
265
|
+
# Resets the data value back to the reset value and calls Bit#clear_flags
|
266
|
+
def reset
|
267
|
+
if @reset_val.is_a?(Symbol)
|
268
|
+
@data = 0
|
269
|
+
else
|
270
|
+
@data = @reset_val
|
271
|
+
end
|
272
|
+
@updated_post_reset = false
|
273
|
+
clear_flags
|
274
|
+
self
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns true if the bit object is a placeholder for bit positions that have
|
278
|
+
# not been defined within the parent register
|
279
|
+
def undefined?
|
280
|
+
@undefined
|
281
|
+
end
|
282
|
+
|
283
|
+
# Returns true if the value of the bit is known. The value will be
|
284
|
+
# unknown in cases where the reset value is undefined or determined by a memory location
|
285
|
+
# and where the bit has not been written or read to a specific value yet.
|
286
|
+
def has_known_value?
|
287
|
+
!@reset_val.is_a?(Symbol) || @updated_post_reset
|
288
|
+
end
|
289
|
+
|
290
|
+
# Set the data value of the bit to the given value (1 or 0)
|
291
|
+
# If the bit is read-only, the value of the bit can be forced with 'force: true'
|
292
|
+
def write(value, options = {})
|
293
|
+
# If an array is written it means a data value and an overlay have been supplied
|
294
|
+
# in one go...
|
295
|
+
if value.is_a?(Array)
|
296
|
+
overlay(value[1])
|
297
|
+
value = value[0]
|
298
|
+
end
|
299
|
+
if (@data != value & 1 && @writable) ||
|
300
|
+
(@data != value & 1 && options[:force] == true)
|
301
|
+
if ((set?) && (!@set_only)) ||
|
302
|
+
((!set?) && (!@clr_only))
|
303
|
+
@data = value & 1
|
304
|
+
@update_required = true
|
305
|
+
@updated_post_reset = true
|
306
|
+
end
|
307
|
+
end
|
308
|
+
self
|
309
|
+
end
|
310
|
+
|
311
|
+
# Will tag all bits for read and if a data value is supplied it
|
312
|
+
# will update the expected data for when the read is performed.
|
313
|
+
def read(value = nil, _options = {})
|
314
|
+
# First properly assign the args if value is absent...
|
315
|
+
if value.is_a?(Hash)
|
316
|
+
options = value
|
317
|
+
value = nil
|
318
|
+
end
|
319
|
+
write(value) if value
|
320
|
+
@read = true if @readable && @read_data_matches_write
|
321
|
+
self
|
322
|
+
end
|
323
|
+
|
324
|
+
# Sets the store flag attribute
|
325
|
+
def store
|
326
|
+
@store = true
|
327
|
+
self
|
328
|
+
end
|
329
|
+
|
330
|
+
# Set the overlay attribute to the supplied value
|
331
|
+
def overlay(value)
|
332
|
+
@overlay = value
|
333
|
+
self
|
334
|
+
end
|
335
|
+
|
336
|
+
# Returns the overlay attribute
|
337
|
+
def overlay_str
|
338
|
+
@overlay
|
339
|
+
end
|
340
|
+
|
341
|
+
# Returns true if the bit's read flag is set
|
342
|
+
def is_to_be_read?
|
343
|
+
@read
|
344
|
+
end
|
345
|
+
|
346
|
+
# Returns true if the bit's store flag is set
|
347
|
+
def is_to_be_stored?
|
348
|
+
@store
|
349
|
+
end
|
350
|
+
|
351
|
+
# Returns true if the overlay attribute is set, optionally supply an overlay
|
352
|
+
# name and this will only return true if the overlay attribute matches that name
|
353
|
+
def has_overlay?(name = nil)
|
354
|
+
if name
|
355
|
+
name.to_s == @overlay.to_s
|
356
|
+
else
|
357
|
+
!!@overlay
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
# Returns true if the bit is writable
|
362
|
+
def is_writable?
|
363
|
+
@writable
|
364
|
+
end
|
365
|
+
alias_method :writable?, :is_writable?
|
366
|
+
|
367
|
+
def is_readable?
|
368
|
+
@readable
|
369
|
+
end
|
370
|
+
alias_method :readable?, :is_readable?
|
371
|
+
|
372
|
+
# Clears the read, store, overlay and update_required flags of this bit.
|
373
|
+
# The store and overlay flags will not be cleared if the the bit's sticky_store
|
374
|
+
# or sticky_overlay attributes are set respectively.
|
375
|
+
def clear_flags
|
376
|
+
@read = false
|
377
|
+
@store = false unless @sticky_store
|
378
|
+
@overlay = false unless @sticky_overlay
|
379
|
+
@update_required = false
|
380
|
+
self
|
381
|
+
end
|
382
|
+
|
383
|
+
# Clears the read flag of this bit.
|
384
|
+
def clear_read_flag
|
385
|
+
@read = false
|
386
|
+
self
|
387
|
+
end
|
388
|
+
|
389
|
+
# Returns a bit mask for this bit, that is a 1 shifted into the position
|
390
|
+
# corresponding to this bit's position. e.g. A bit with position 4 would return
|
391
|
+
# %1_0000
|
392
|
+
def mask
|
393
|
+
mask_val = 1
|
394
|
+
mask_val << @position
|
395
|
+
end
|
396
|
+
|
397
|
+
# Returns a 'null' bit object which has value 0 and no other attributes set
|
398
|
+
def self.null(owner, position) # :nodoc:
|
399
|
+
Bit.new(owner, position, writable: false)
|
400
|
+
end
|
401
|
+
|
402
|
+
# Returns the value you would need to write to the register to put the given
|
403
|
+
# value in this bit
|
404
|
+
def setting(value)
|
405
|
+
value = value & 1 # As this bit can only hold one bit of data force it
|
406
|
+
value << @position
|
407
|
+
end
|
408
|
+
|
409
|
+
# Returns true if the bit's update_required flag is set, typically this will be the
|
410
|
+
# case when a write has changed the data value of the bit but a BitCollection#write!
|
411
|
+
# method has not been called yet to apply it to silicon
|
412
|
+
def update_required?
|
413
|
+
@update_required
|
414
|
+
end
|
415
|
+
|
416
|
+
# With only one bit it just returns itself
|
417
|
+
def shift_out_left
|
418
|
+
yield self
|
419
|
+
end
|
420
|
+
|
421
|
+
# Returns the data shifted by the bit position
|
422
|
+
def data_in_position
|
423
|
+
data << position
|
424
|
+
end
|
425
|
+
|
426
|
+
# Clears any w1c bits that are set
|
427
|
+
def clear_w1c
|
428
|
+
if @w1c && set?
|
429
|
+
@data = 0
|
430
|
+
end
|
431
|
+
self
|
432
|
+
end
|
433
|
+
|
434
|
+
# Clears any start bits that are set
|
435
|
+
def clear_start
|
436
|
+
if @start && set?
|
437
|
+
@data = 0
|
438
|
+
end
|
439
|
+
self
|
440
|
+
end
|
441
|
+
|
442
|
+
def respond_to?(sym) # :nodoc:
|
443
|
+
meta_data_method?(sym) || super(sym)
|
444
|
+
end
|
445
|
+
|
446
|
+
# @api private
|
447
|
+
def meta_data_method?(method)
|
448
|
+
attr_name = method.to_s.gsub(/\??=?/, '').to_sym
|
449
|
+
if default_bit_metadata.key?(attr_name)
|
450
|
+
if method.to_s =~ /\?/
|
451
|
+
[true, false].include?(default_bit_metadata[attr_name])
|
452
|
+
else
|
453
|
+
true
|
454
|
+
end
|
455
|
+
else
|
456
|
+
false
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
def extract_meta_data(method, *args)
|
461
|
+
method = method.to_s.sub('?', '')
|
462
|
+
if method =~ /=/
|
463
|
+
instance_variable_set("@#{method.sub('=', '')}", args.first)
|
464
|
+
else
|
465
|
+
instance_variable_get("@#{method}") || meta[method.to_sym]
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
def method_missing(method, *args, &block) # :nodoc:
|
470
|
+
if meta_data_method?(method)
|
471
|
+
extract_meta_data(method, *args)
|
472
|
+
else
|
473
|
+
super
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
# Returns true if the bit is constrained by the given/any feature
|
478
|
+
def enabled_by_feature?(name = nil)
|
479
|
+
if !name
|
480
|
+
!!feature
|
481
|
+
else
|
482
|
+
if feature.class == Array
|
483
|
+
feature.each do |f|
|
484
|
+
if f == name
|
485
|
+
return true
|
486
|
+
end
|
487
|
+
end
|
488
|
+
return false
|
489
|
+
else
|
490
|
+
feature == name
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
alias_method :has_feature_constraint?, :enabled_by_feature?
|
495
|
+
|
496
|
+
def enabled?
|
497
|
+
if feature
|
498
|
+
value = false
|
499
|
+
current_owner = self
|
500
|
+
if feature.class == Array
|
501
|
+
feature.each do |f|
|
502
|
+
current_owner = self
|
503
|
+
loop do
|
504
|
+
if current_owner.respond_to?(:owner)
|
505
|
+
current_owner = current_owner.owner
|
506
|
+
if current_owner.respond_to?(:has_feature?)
|
507
|
+
if current_owner.has_feature?(f)
|
508
|
+
value = true
|
509
|
+
break
|
510
|
+
end
|
511
|
+
end
|
512
|
+
else # if current owner does not have a owner
|
513
|
+
value = false
|
514
|
+
break
|
515
|
+
end
|
516
|
+
end # loop end
|
517
|
+
unless value
|
518
|
+
if Origen.top_level && \
|
519
|
+
Origen.top_level.respond_to?(:has_feature?) && \
|
520
|
+
Origen.top_level.has_feature?(f)
|
521
|
+
value = true
|
522
|
+
unless value
|
523
|
+
break
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
unless value
|
528
|
+
break # break if feature not found and return false
|
529
|
+
end
|
530
|
+
end # iterated through all features in array
|
531
|
+
return value
|
532
|
+
else # if feature.class != Array
|
533
|
+
loop do
|
534
|
+
if current_owner.respond_to?(:owner)
|
535
|
+
current_owner = current_owner.owner
|
536
|
+
if current_owner.respond_to?(:has_feature?)
|
537
|
+
if current_owner.has_feature?(feature)
|
538
|
+
value = true
|
539
|
+
break
|
540
|
+
end
|
541
|
+
end
|
542
|
+
else # if current owner does not have a owner
|
543
|
+
value = false
|
544
|
+
break
|
545
|
+
end
|
546
|
+
end # loop end
|
547
|
+
unless value
|
548
|
+
if Origen.top_level && \
|
549
|
+
Origen.top_level.respond_to?(:has_feature?) && \
|
550
|
+
Origen.top_level.has_feature?(feature)
|
551
|
+
value = true
|
552
|
+
end
|
553
|
+
end
|
554
|
+
return value
|
555
|
+
end
|
556
|
+
else
|
557
|
+
return true
|
558
|
+
end
|
559
|
+
end
|
560
|
+
end
|
561
|
+
end
|
562
|
+
end
|