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,45 @@
|
|
1
|
+
module Origen
|
2
|
+
module ModelInitializer
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
# This overrides the new method of any class which includes this
|
7
|
+
# module to force the newly created instance to be registered as
|
8
|
+
# a top-level listener.
|
9
|
+
def new(*args, &block) # :nodoc:
|
10
|
+
options = args.find { |a| a.is_a?(Hash) } || {}
|
11
|
+
|
12
|
+
x = allocate
|
13
|
+
x.send(:init_top_level) if x.respond_to?(:includes_origen_top_level?)
|
14
|
+
x.send(:init_sub_blocks, *args) if x.respond_to?(:init_sub_blocks)
|
15
|
+
if x.respond_to?(:version=)
|
16
|
+
version = options[:version]
|
17
|
+
version ||= args.first if args.first.is_a?(Fixnum)
|
18
|
+
x.version = version
|
19
|
+
end
|
20
|
+
if x.respond_to?(:parent=)
|
21
|
+
parent = options.delete(:parent)
|
22
|
+
x.parent = parent if parent
|
23
|
+
end
|
24
|
+
if x.method(:initialize).arity == 0
|
25
|
+
x.send(:initialize, &block)
|
26
|
+
else
|
27
|
+
x.send(:initialize, *args, &block)
|
28
|
+
end
|
29
|
+
x.register_callback_listener if x.respond_to?(:register_callback_listener)
|
30
|
+
# Do this before wrapping, otherwise the respond to method in the controller will
|
31
|
+
# be looking for the model to be instantiated when it is not fully done yet
|
32
|
+
is_top_level = x.respond_to?(:includes_origen_top_level?)
|
33
|
+
if x.respond_to?(:wrap_in_controller)
|
34
|
+
x = x.wrap_in_controller
|
35
|
+
end
|
36
|
+
if is_top_level
|
37
|
+
Origen.app.listeners_for(:on_top_level_instantiated, top_level: false).each do |listener|
|
38
|
+
listener.on_top_level_instantiated(x)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
x
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Origen
|
2
|
+
module NVM
|
3
|
+
# A block array is a standard Ruby array that has been enhanced with additional
|
4
|
+
# methods related to the fact that it is intended to hold NVM block objects.
|
5
|
+
#
|
6
|
+
# This for example allows a block select value to be automatically generated for
|
7
|
+
# whatever blocks are contained in the array by calling the bsel method.
|
8
|
+
class BlockArray < ::Array
|
9
|
+
# Return all single blocks wrapped in a block array
|
10
|
+
def [](ix)
|
11
|
+
BlockArray.new << super(ix)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Extract a subset of blocks based on ids
|
15
|
+
#
|
16
|
+
# $nvm.blocks.find(0,3)
|
17
|
+
#
|
18
|
+
# An elegant way to implement this is via an accessor like this on your top-level
|
19
|
+
# object which owns the blocks:
|
20
|
+
#
|
21
|
+
# def blocks(*args)
|
22
|
+
# if args.empty?
|
23
|
+
# @blocks
|
24
|
+
# else
|
25
|
+
# @blocks.find(*args)
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
# alias :block :blocks
|
29
|
+
#
|
30
|
+
# This provides the following API:
|
31
|
+
#
|
32
|
+
# $nvm.blocks # Returns all blocks
|
33
|
+
# $nvm.block(0) # Returns block 0 wrapped in a block array
|
34
|
+
# $nvm.blocks(0, 3) # Returns blocks 0 and 3 wrapped in a block array
|
35
|
+
def find(*ids)
|
36
|
+
b = BlockArray.new
|
37
|
+
ids.each do |id|
|
38
|
+
b << self[id]
|
39
|
+
end
|
40
|
+
b
|
41
|
+
end
|
42
|
+
|
43
|
+
# def method_missing(method, *args, &blk)
|
44
|
+
# if self.size == 1
|
45
|
+
# self.first.send(method, *args, &blk)
|
46
|
+
# else
|
47
|
+
# super
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
|
51
|
+
# Returns the block select value required to select all contained blocks, the block object
|
52
|
+
# must implement a method called bsel for this to work
|
53
|
+
def bsel
|
54
|
+
reduce(0) { |bsels, block| bsels | block.bsel }
|
55
|
+
end
|
56
|
+
alias_method :block_select, :bsel
|
57
|
+
alias_method :block_select_value, :bsel
|
58
|
+
|
59
|
+
# Returns the sum of the size of all contained blocks in KB, the block object must implement
|
60
|
+
# a method called size_in_kb for this to work
|
61
|
+
def size_in_kb
|
62
|
+
reduce(0) { |sum, block| sum + block.size_in_kb }
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns the sum of the size of all contained blocks in bytes, the block object must implement
|
66
|
+
# a method called size_in_kb for this to work
|
67
|
+
def size_in_bytes
|
68
|
+
size_in_kb * 1024
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/origen/nvm.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Origen
|
2
|
+
module Parameters
|
3
|
+
require 'delegate'
|
4
|
+
class Live < ::Delegator
|
5
|
+
def initialize(options)
|
6
|
+
@owner = options[:owner]
|
7
|
+
@path = options[:path].split('.')
|
8
|
+
@name = options[:name]
|
9
|
+
end
|
10
|
+
|
11
|
+
def __getobj__
|
12
|
+
p = @owner.params
|
13
|
+
@path.each { |pt| p = p.send(pt) }
|
14
|
+
p.send(@name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_a_live_parameter?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Origen
|
2
|
+
module Parameters
|
3
|
+
# An instance of this class is returned whenever the parameter context is set to
|
4
|
+
# a value for which no parameter set has been defined.
|
5
|
+
#
|
6
|
+
# Sometime this may be valid in the case where the context is actually implemented
|
7
|
+
# by another object which shadows the context.
|
8
|
+
#
|
9
|
+
# The missing allows the user to do params.context to retrieve the value of the
|
10
|
+
# current context, but it will error out with a useful error message if they try
|
11
|
+
# to do anything else (i.e. retrieve a parameter from it)
|
12
|
+
class Missing
|
13
|
+
attr_reader :owner
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
@owner = options[:owner]
|
17
|
+
end
|
18
|
+
|
19
|
+
def context
|
20
|
+
owner._parameter_current
|
21
|
+
end
|
22
|
+
|
23
|
+
def method_missing(_method, *_args, &_block)
|
24
|
+
owner.send(:_validate_parameter_set_name, context)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module Origen
|
2
|
+
module Parameters
|
3
|
+
class Set < Hash
|
4
|
+
attr_accessor :top_level
|
5
|
+
attr_accessor :name
|
6
|
+
attr_accessor :path
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
if options[:top_level]
|
10
|
+
@top_level = self
|
11
|
+
@path = ''
|
12
|
+
@owner = options[:owner]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def define(parent = nil, &_block)
|
17
|
+
@defining = true
|
18
|
+
yield self, parent
|
19
|
+
@defining = false
|
20
|
+
finalize
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the current parameter context
|
24
|
+
def context
|
25
|
+
owner._parameter_current
|
26
|
+
end
|
27
|
+
alias_method :current_context, :context
|
28
|
+
|
29
|
+
def copy_defaults_from(set)
|
30
|
+
set.each do |name, val|
|
31
|
+
if val.is_a?(Set)
|
32
|
+
self[name] = new_subset(name)
|
33
|
+
self[name].copy_defaults_from(val)
|
34
|
+
else
|
35
|
+
self[name] = val
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def method_missing(method, *args, &block)
|
41
|
+
if defining?
|
42
|
+
if args.length == 0
|
43
|
+
self[method] ||= new_subset(method)
|
44
|
+
elsif args.length > 1
|
45
|
+
super
|
46
|
+
else
|
47
|
+
m = method.to_s.sub('=', '').to_sym
|
48
|
+
self[m] = args.first
|
49
|
+
end
|
50
|
+
else
|
51
|
+
if args.length != 0
|
52
|
+
super
|
53
|
+
else
|
54
|
+
val = self[method]
|
55
|
+
if !val
|
56
|
+
super
|
57
|
+
else
|
58
|
+
if val.is_a?(Set)
|
59
|
+
val
|
60
|
+
else
|
61
|
+
if live?
|
62
|
+
Live.new(owner: owner, path: path, name: method)
|
63
|
+
else
|
64
|
+
if val.is_a?(Proc)
|
65
|
+
val.call(*args)
|
66
|
+
else
|
67
|
+
val
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def each
|
77
|
+
super do |key, val|
|
78
|
+
if val.is_a?(Proc)
|
79
|
+
yield key, val.call
|
80
|
+
else
|
81
|
+
yield key, val
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def [](key)
|
87
|
+
val = super
|
88
|
+
val.is_a?(Proc) ? val.call : val
|
89
|
+
end
|
90
|
+
|
91
|
+
# Test seems to be some kind of reserved word, that doesn't trigger the method_missing,
|
92
|
+
# so re-defining it here to allow a param group called 'test'
|
93
|
+
def test(*args, &block)
|
94
|
+
method_missing(:test, *args, &block)
|
95
|
+
end
|
96
|
+
|
97
|
+
def defining?
|
98
|
+
if top_level?
|
99
|
+
@defining
|
100
|
+
else
|
101
|
+
top_level.defining?
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def owner
|
106
|
+
if top_level?
|
107
|
+
@owner
|
108
|
+
else
|
109
|
+
top_level.owner
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def top_level?
|
114
|
+
top_level == self
|
115
|
+
end
|
116
|
+
|
117
|
+
def finalize
|
118
|
+
freeze
|
119
|
+
each { |_name, val| val.finalize if val.is_a? Set }
|
120
|
+
end
|
121
|
+
|
122
|
+
def new_subset(name)
|
123
|
+
set = Set.new
|
124
|
+
set.name = name
|
125
|
+
set.top_level = top_level
|
126
|
+
if path == ''
|
127
|
+
set.path = name.to_s
|
128
|
+
else
|
129
|
+
set.path = "#{path}.#{name}"
|
130
|
+
end
|
131
|
+
set
|
132
|
+
end
|
133
|
+
|
134
|
+
def live?
|
135
|
+
owner._live_parameter_requested?
|
136
|
+
end
|
137
|
+
|
138
|
+
def live
|
139
|
+
owner._request_live_parameter
|
140
|
+
self
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
module Origen
|
3
|
+
module Parameters
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
autoload :Set, 'origen/parameters/set'
|
6
|
+
autoload :Live, 'origen/parameters/live'
|
7
|
+
autoload :Missing, 'origen/parameters/missing'
|
8
|
+
|
9
|
+
attr_accessor :current
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def parameters_context(obj = nil)
|
13
|
+
if obj
|
14
|
+
if obj.is_a?(Symbol)
|
15
|
+
valid = [:top, :dut].include?(obj)
|
16
|
+
end
|
17
|
+
valid ||= obj.is_a?(String)
|
18
|
+
unless valid
|
19
|
+
fail 'Invalid parameters context, must be :top or a string path to a model object'
|
20
|
+
end
|
21
|
+
@parameters_context = obj
|
22
|
+
else
|
23
|
+
@parameters_context
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def define_params(name, options = {}, &block)
|
29
|
+
if _parameter_sets[name]
|
30
|
+
fail 'Parameter sets cannot be re-opened once originally defined!'
|
31
|
+
else
|
32
|
+
_parameter_sets[name] = Set.new(top_level: true, owner: self)
|
33
|
+
if options[:inherit]
|
34
|
+
_validate_parameter_set_name(options[:inherit])
|
35
|
+
parent = _parameter_sets[options[:inherit]]
|
36
|
+
_parameter_sets[name].copy_defaults_from(parent)
|
37
|
+
_parameter_sets[name].define(parent, &block)
|
38
|
+
else
|
39
|
+
_parameter_sets[name].define(&block)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
alias_method :define_parameters, :define_params
|
44
|
+
|
45
|
+
def with_params(name, _options = {})
|
46
|
+
orig = _parameter_current
|
47
|
+
self.params = name
|
48
|
+
yield
|
49
|
+
self.params = orig
|
50
|
+
end
|
51
|
+
|
52
|
+
def params
|
53
|
+
@_live_parameter_requested = false
|
54
|
+
_parameter_sets[_parameter_current] || Missing.new(owner: self)
|
55
|
+
end
|
56
|
+
alias_method :parameters, :params
|
57
|
+
|
58
|
+
def params=(name)
|
59
|
+
# Don't validate on setting this as this object could be used to set
|
60
|
+
# the context on some other object, therefore validate later if someone tries
|
61
|
+
# to access the params on this object
|
62
|
+
# _validate_parameter_set_name(name)
|
63
|
+
@_parameter_current = name
|
64
|
+
end
|
65
|
+
alias_method :parameters=, :params=
|
66
|
+
|
67
|
+
# @api private
|
68
|
+
def _parameter_current
|
69
|
+
if path = self.class.parameters_context
|
70
|
+
case path
|
71
|
+
when :top, :dut
|
72
|
+
Origen.top_level._parameter_current
|
73
|
+
else
|
74
|
+
eval(path)._parameter_current
|
75
|
+
end
|
76
|
+
else
|
77
|
+
@_parameter_current || :default
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# @api private
|
82
|
+
def _parameter_sets
|
83
|
+
@_parameter_sets ||= {}
|
84
|
+
end
|
85
|
+
|
86
|
+
# @api private
|
87
|
+
def _request_live_parameter
|
88
|
+
@_live_parameter_requested = true
|
89
|
+
end
|
90
|
+
|
91
|
+
# @api private
|
92
|
+
def _live_parameter_requested?
|
93
|
+
@_live_parameter_requested
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def _validate_parameter_set_name(name)
|
99
|
+
unless _parameter_sets.key?(name)
|
100
|
+
puts "Unknown parameter set :#{name} requested for #{self.class}, these are the valid sets:"
|
101
|
+
_parameter_sets.keys.each { |k| puts " :#{k}" }
|
102
|
+
puts ''
|
103
|
+
fail 'Unknown parameter set!'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
data/lib/origen/pdm.rb
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
module Origen
|
2
|
+
module PDM
|
3
|
+
autoload :WebService, 'origen/pdm/web_service'
|
4
|
+
autoload :PI, 'origen/pdm/pi'
|
5
|
+
autoload :Tracker, 'origen/pdm/tracker'
|
6
|
+
|
7
|
+
require 'origen/pdm/attributes'
|
8
|
+
|
9
|
+
include Attributes
|
10
|
+
|
11
|
+
# Set true to use the PDM test system rather than the live system.
|
12
|
+
# The test system can be found at: http://designpdmtest.freescale.net/Agile
|
13
|
+
attr_accessor :pdm_use_test_system
|
14
|
+
|
15
|
+
# This should be set to the PDM version number that the current object represents.
|
16
|
+
# For example if the object represents C90TFS_NVM_tester_010, then set this
|
17
|
+
# attribute to 10.
|
18
|
+
#
|
19
|
+
# This attribute is required to be set when including a component in a BOM, otherwise
|
20
|
+
# it is not required to be set when releasing a new version.
|
21
|
+
#
|
22
|
+
# It can also be set to :latest to pick up the latest version number for the component.
|
23
|
+
attr_accessor :pdm_version_number
|
24
|
+
|
25
|
+
# Set this attribute to create a branch point release from the given version. If this
|
26
|
+
# attribute is not set then all releases will simply supercede the last release.
|
27
|
+
attr_accessor :pdm_branch_version_number
|
28
|
+
|
29
|
+
# Set this to specify which version the new release should supercede.
|
30
|
+
# If un-specified the new release will automatically supercede the last version on the
|
31
|
+
# trunk.
|
32
|
+
attr_accessor :pdm_supercedes_version_number
|
33
|
+
|
34
|
+
# Set this attribute to include components in the BOM, it should be set to an array
|
35
|
+
# of objects, each of which must also include the Origen::PDM module and have the
|
36
|
+
# pdm_version_number attribute set.
|
37
|
+
attr_accessor :pdm_bom
|
38
|
+
|
39
|
+
# If you begin automating PDM releases on a component that already exists on PDM, then
|
40
|
+
# you must set this attribute to let Origen know what the latest part number is on PDM.
|
41
|
+
#
|
42
|
+
# For example if the latest component is called C90TFS_NVM_tester_010 at the time of
|
43
|
+
# setting up the component in Origen then set this attribute to 10.
|
44
|
+
#
|
45
|
+
# If the object does not exist on PDM yet then you can leave this blank and Origen will
|
46
|
+
# create and begin tracking the component from the initial version.
|
47
|
+
attr_accessor :pdm_initial_version_number
|
48
|
+
|
49
|
+
attr_accessor :pdm_meta_tags
|
50
|
+
|
51
|
+
def self.update_ticket(tkt)
|
52
|
+
pdm_pi.update_ticket(tkt)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.pdm_pi(_options = {})
|
56
|
+
@pdm_pi ||= PI.new(use_test_system: true)
|
57
|
+
end
|
58
|
+
|
59
|
+
def pdm_base_url
|
60
|
+
if pdm_use_test_system
|
61
|
+
host = 'http://designpdmtest.freescale.net'
|
62
|
+
else
|
63
|
+
host = 'http://designpdm.freescale.net'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Returns the url for specific component version on PDM, i.e. if the model represents
|
68
|
+
# pdm component C90TFS_NVM_tester_010 then the link to that component version will be
|
69
|
+
# returned
|
70
|
+
def pdm_url
|
71
|
+
"#{pdm_base_url}/Agile/object/#{pdm_part_type}/#{pdm_part_number}"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Returns the url for component's item group on PDM, i.e. if the model represents
|
75
|
+
# pdm component C90TFS_NVM_tester_010 then the link to C90TFS_NVM_tester will be
|
76
|
+
# returned
|
77
|
+
def pdm_item_group_url
|
78
|
+
"#{pdm_base_url}/Agile/object/Item Group/#{pdm_part_name}"
|
79
|
+
end
|
80
|
+
|
81
|
+
# The PI API, returns an instance of Origen::PDM::PI
|
82
|
+
def pdm_pi
|
83
|
+
@pdm_pi ||= PI.new(use_test_system: pdm_use_test_system)
|
84
|
+
end
|
85
|
+
|
86
|
+
# The PDM Web Service API, returns an instance of Origen::PDM::WebService
|
87
|
+
def pdm_web_service
|
88
|
+
@pdm_web_service ||= WebService.new
|
89
|
+
end
|
90
|
+
|
91
|
+
# When talking to PDM we need to use the 'Part Number' which is comprised
|
92
|
+
# of the part name plus a numeric revision.
|
93
|
+
#
|
94
|
+
# For example 'C90TFS_NVM_tester' is the part name, 'C90TFS_NVM_tester_058' is a
|
95
|
+
# possible part number.
|
96
|
+
def pdm_part_number
|
97
|
+
pdm_part_name + '_%03d' % _pdm_version_number
|
98
|
+
end
|
99
|
+
|
100
|
+
def pdm_branch_part_number
|
101
|
+
if pdm_branch_version_number
|
102
|
+
pdm_part_name + '_%03d' % pdm_branch_version_number
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Returns the latest part number regardless of whether it is on a branch or not
|
107
|
+
def pdm_latest_part_number
|
108
|
+
if pdm_latest_version_number
|
109
|
+
pdm_part_name + '_%03d' % pdm_latest_version_number
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Returns the latest part number that is not on a branch
|
114
|
+
def pdm_latest_trunk_part_number
|
115
|
+
if pdm_latest_trunk_version_number
|
116
|
+
pdm_part_name + '_%03d' % pdm_latest_trunk_version_number
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def pdm_supercedes_part_number
|
121
|
+
if pdm_supercedes_version_number
|
122
|
+
pdm_part_name + '_%03d' % pdm_supercedes_version_number
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def pdm_bom
|
127
|
+
[]
|
128
|
+
end
|
129
|
+
|
130
|
+
def pdm_meta_tags
|
131
|
+
[]
|
132
|
+
end
|
133
|
+
|
134
|
+
def _pdm_version_number
|
135
|
+
if pdm_version_number && pdm_version_number != :latest
|
136
|
+
pdm_version_number
|
137
|
+
else
|
138
|
+
pdm_latest_version_number ||
|
139
|
+
fail("You must set the pdm_version_number attribute of #{self.class}")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def pdm_latest_version_number
|
144
|
+
if pdm_tracker.latest_version_number
|
145
|
+
if pdm_initial_version_number &&
|
146
|
+
pdm_initial_version_number > pdm_tracker.latest_version_number
|
147
|
+
pdm_initial_version_number
|
148
|
+
else
|
149
|
+
pdm_tracker.latest_version_number
|
150
|
+
end
|
151
|
+
else
|
152
|
+
pdm_initial_version_number
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def pdm_latest_trunk_version_number
|
157
|
+
if pdm_tracker.latest_trunk_version_number
|
158
|
+
if pdm_initial_version_number &&
|
159
|
+
pdm_initial_version_number > pdm_tracker.latest_trunk_version_number
|
160
|
+
pdm_initial_version_number
|
161
|
+
else
|
162
|
+
pdm_tracker.latest_trunk_version_number
|
163
|
+
end
|
164
|
+
else
|
165
|
+
pdm_initial_version_number
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def pdm_supercedes_version_number
|
170
|
+
@pdm_supercedes_version_number || pdm_latest_trunk_version_number
|
171
|
+
end
|
172
|
+
|
173
|
+
def pdm_component_binding
|
174
|
+
binding
|
175
|
+
end
|
176
|
+
|
177
|
+
def pdm_tracker
|
178
|
+
@pdm_tracker ||= Tracker.new(component: self)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Pulls the BOM from PDM into an array of hashes with the following keys:
|
182
|
+
#
|
183
|
+
# * :pdm_part_name (e.g. C90TFS_NVM_tester)
|
184
|
+
# * :pdm_version_number (e.g. 058 (actually returned as 58))
|
185
|
+
# * :pdm_version (e.g. Rel20121002)
|
186
|
+
def pdm_remote_bom
|
187
|
+
pdm_pi.catbom(self)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Release a new component version to PDM
|
191
|
+
def pdm_release!(options = {})
|
192
|
+
options = {
|
193
|
+
release_bom: false
|
194
|
+
}.merge(options)
|
195
|
+
ret = pdm_pi.release!(self)
|
196
|
+
pdm_tracker.release!
|
197
|
+
ret
|
198
|
+
end
|
199
|
+
|
200
|
+
# This method is called before permanently saving a released component in the store,
|
201
|
+
# override it to set instance variables for anything you wish to save.
|
202
|
+
#
|
203
|
+
# Normally it is best to assign the result of any pdm attributes that come from
|
204
|
+
# methods as instance variables so that the current state of the component can
|
205
|
+
# be reconstructed later.
|
206
|
+
def freeze
|
207
|
+
end
|
208
|
+
|
209
|
+
def pdm_prepare_for_store
|
210
|
+
freeze
|
211
|
+
# Clear these so as not to waste effort Marshalling them
|
212
|
+
@pdm_pi = nil
|
213
|
+
@pdm_web_service = nil
|
214
|
+
@pdm_tracker = nil
|
215
|
+
@pi_attributes = nil
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Origen
|
2
|
+
module Pins
|
3
|
+
require 'delegate'
|
4
|
+
require 'origen/pins/pin'
|
5
|
+
# Thin wrapper around pin objects to implement a defined function.
|
6
|
+
#
|
7
|
+
# The pin object stores all attributes associated with the function, this
|
8
|
+
# wrapper simply keeps track of what function a given pin reference refers to
|
9
|
+
class FunctionProxy < ::Delegator
|
10
|
+
def initialize(id, pin)
|
11
|
+
@id = id
|
12
|
+
@pin = pin
|
13
|
+
end
|
14
|
+
|
15
|
+
def __getobj__
|
16
|
+
@pin
|
17
|
+
end
|
18
|
+
|
19
|
+
# Intercept all calls to function-scoped attributes of the pin so
|
20
|
+
# that we can inject the function that we want the attribute value for
|
21
|
+
Pin::FUNCTION_SCOPED_ATTRIBUTES.each do |attribute|
|
22
|
+
define_method attribute do |options = {}|
|
23
|
+
options[:function] = @id
|
24
|
+
@pin.send(attribute, options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
# For debug
|
31
|
+
def _function
|
32
|
+
@id
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|