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,150 @@
|
|
1
|
+
module Origen
|
2
|
+
module Tester
|
3
|
+
class VectorPipeline
|
4
|
+
attr_reader :group_size, :pipeline
|
5
|
+
|
6
|
+
def initialize(group_size)
|
7
|
+
@group_size = group_size
|
8
|
+
@pipeline = []
|
9
|
+
end
|
10
|
+
|
11
|
+
# Add a vector/comment to the pipeline
|
12
|
+
def <<(vector)
|
13
|
+
if vector.is_a?(Vector)
|
14
|
+
consume_comments(vector)
|
15
|
+
if vector.repeat > 1
|
16
|
+
add_repeat_vector(vector)
|
17
|
+
else
|
18
|
+
pipeline << vector
|
19
|
+
end
|
20
|
+
else
|
21
|
+
comments << vector
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# If there are complete groups sitting at the top of the pipeline
|
26
|
+
# then this will yield them back line by line, stopping when after the last
|
27
|
+
# complete group and leaving any remaining single vectors in the pipeline
|
28
|
+
# If there are no complete groups present then it will just return
|
29
|
+
def flush
|
30
|
+
while lead_group_finalized?
|
31
|
+
lead_group.each do |vector|
|
32
|
+
vector.comments.each do |comment|
|
33
|
+
yield comment
|
34
|
+
end
|
35
|
+
yield vector
|
36
|
+
end
|
37
|
+
pipeline.shift(group_size)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Call at the end to force a flush out of any remaining vectors
|
42
|
+
def empty
|
43
|
+
if !pipeline.empty? || !comments.empty?
|
44
|
+
pipeline.each do |vector|
|
45
|
+
vector.comments.each do |comment|
|
46
|
+
yield comment
|
47
|
+
end
|
48
|
+
yield vector
|
49
|
+
end
|
50
|
+
comments.each do |comment|
|
51
|
+
yield comment
|
52
|
+
end
|
53
|
+
@pipeline = []
|
54
|
+
@comments = []
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
# Pushes a duplicate of the given vector with its repeat set to 1
|
61
|
+
# Also clears any comments associated with the vector with the rationale that we only
|
62
|
+
# want to see them the first time
|
63
|
+
def push_duplicate(vector)
|
64
|
+
v = vector.dup
|
65
|
+
v.repeat = 1
|
66
|
+
pipeline << v
|
67
|
+
vector.comments = []
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_repeat_vector(vector)
|
71
|
+
count = vector.repeat
|
72
|
+
# Align to the start of a new group by splitting off single vectors
|
73
|
+
# to complete the current group
|
74
|
+
while !aligned? && count > 0
|
75
|
+
push_duplicate(vector)
|
76
|
+
count -= 1
|
77
|
+
end
|
78
|
+
if count > group_size
|
79
|
+
remainder = count % group_size
|
80
|
+
# Create a group with the required repeat
|
81
|
+
group_size.times do
|
82
|
+
push_duplicate(vector)
|
83
|
+
end
|
84
|
+
pipeline.last.repeat = (count - remainder) / group_size
|
85
|
+
# Then expand out any leftover
|
86
|
+
remainder.times do
|
87
|
+
push_duplicate(vector)
|
88
|
+
end
|
89
|
+
# For small repeats that fit within the group just expand them
|
90
|
+
else
|
91
|
+
while count > 0
|
92
|
+
push_duplicate(vector)
|
93
|
+
count -= 1
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Returns true of the next vector to be added to the pipeline will
|
99
|
+
# be at the start of a new group
|
100
|
+
def aligned?
|
101
|
+
(pipeline.size % group_size) == 0
|
102
|
+
end
|
103
|
+
|
104
|
+
def consume_comments(vector)
|
105
|
+
vector.comments = comments
|
106
|
+
@comments = []
|
107
|
+
end
|
108
|
+
|
109
|
+
def comments
|
110
|
+
@comments ||= []
|
111
|
+
end
|
112
|
+
|
113
|
+
# When true the lead group is complete and a further repeat of it is not possible
|
114
|
+
# Calling this will compress the 2nd group into the 1st if possible
|
115
|
+
def lead_group_finalized?
|
116
|
+
if lead_group.size == group_size
|
117
|
+
if second_group_present?
|
118
|
+
i = -1
|
119
|
+
if second_group.all? do |vector|
|
120
|
+
i += 1
|
121
|
+
pipeline[i] == vector
|
122
|
+
end
|
123
|
+
pipeline[group_size - 1].repeat += 1
|
124
|
+
group_size.times { pipeline.delete_at(group_size) }
|
125
|
+
false
|
126
|
+
else
|
127
|
+
true
|
128
|
+
end
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def second_group_present?
|
138
|
+
second_group.size == group_size
|
139
|
+
end
|
140
|
+
|
141
|
+
def lead_group
|
142
|
+
pipeline[0..group_size - 1]
|
143
|
+
end
|
144
|
+
|
145
|
+
def second_group
|
146
|
+
pipeline[group_size..(group_size * 2) - 1]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
module Origen
|
3
|
+
module Tester
|
4
|
+
autoload :J750, 'origen/tester/j750/j750'
|
5
|
+
autoload :J750_HPT, 'origen/tester/j750/j750_hpt'
|
6
|
+
autoload :Ultraflex, 'origen/tester/ultraflex/ultraflex'
|
7
|
+
autoload :V93K, 'origen/tester/v93k/v93k'
|
8
|
+
autoload :BDM, 'origen/tester/bdm/bdm'
|
9
|
+
autoload :JLink, 'origen/tester/jlink/jlink'
|
10
|
+
autoload :Doc, 'origen/tester/doc/doc'
|
11
|
+
|
12
|
+
autoload :Vector, 'origen/tester/vector'
|
13
|
+
autoload :VectorPipeline, 'origen/tester/vector_pipeline'
|
14
|
+
autoload :CommandBasedTester, 'origen/tester/command_based_tester'
|
15
|
+
autoload :Interface, 'origen/tester/interface'
|
16
|
+
autoload :Generator, 'origen/tester/generator'
|
17
|
+
autoload :Parser, 'origen/tester/parser'
|
18
|
+
autoload :Time, 'origen/tester/time'
|
19
|
+
|
20
|
+
extend ActiveSupport::Concern
|
21
|
+
|
22
|
+
require 'origen/tester/vector_generator'
|
23
|
+
require 'origen/tester/timing'
|
24
|
+
require 'origen/tester/api'
|
25
|
+
|
26
|
+
include VectorGenerator
|
27
|
+
include Timing
|
28
|
+
include API
|
29
|
+
|
30
|
+
included do
|
31
|
+
end
|
32
|
+
|
33
|
+
module ClassMethods # :nodoc:
|
34
|
+
# This overrides the new method of any class which includes this
|
35
|
+
# module to force the newly created instance to be registered as
|
36
|
+
# a tester with Origen
|
37
|
+
def new(*args, &block) # :nodoc:
|
38
|
+
if Origen.app.with_doc_tester?
|
39
|
+
x = Origen::Tester::Doc.allocate
|
40
|
+
if Origen.app.with_html_doc_tester?
|
41
|
+
x.html_mode = true
|
42
|
+
end
|
43
|
+
else
|
44
|
+
x = allocate
|
45
|
+
end
|
46
|
+
x.send(:initialize, *args, &block)
|
47
|
+
x.register_tester
|
48
|
+
x
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def register_tester # :nodoc:
|
53
|
+
Origen.app.tester = self
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
module Origen
|
3
|
+
# Include this module to identify it as a top-level object in Origen, normally
|
4
|
+
# an object that represents the SoC/Top-level device.
|
5
|
+
#
|
6
|
+
# Origen will then fallback on this top-level object to service any register
|
7
|
+
# read/write requests or any pin requests that are generated by lower
|
8
|
+
# level objects and which cannot be fulfilled at that level.
|
9
|
+
#
|
10
|
+
# The current top level object can then be referenced at any time via
|
11
|
+
# Origen.top_level.
|
12
|
+
module TopLevel
|
13
|
+
extend ActiveSupport::Concern
|
14
|
+
|
15
|
+
included do
|
16
|
+
# Any pattern compilation or other operation that requires access to a pinmap
|
17
|
+
# will look for it via this attribute, this should return a path to the pinmap
|
18
|
+
# file to be used
|
19
|
+
attr_accessor :pinmap
|
20
|
+
|
21
|
+
# Store the current pattern compiler instance name
|
22
|
+
attr_accessor :compiler
|
23
|
+
|
24
|
+
include Origen::Model
|
25
|
+
end
|
26
|
+
|
27
|
+
def reset!
|
28
|
+
reset bang: true
|
29
|
+
end
|
30
|
+
|
31
|
+
def pinmap=(val)
|
32
|
+
@pinmap = Pathname.new(val)
|
33
|
+
end
|
34
|
+
|
35
|
+
def reset(options = {})
|
36
|
+
Origen.app.listeners_for(:before_top_level_reset).each(&:before_top_level_reset)
|
37
|
+
if options[:bang]
|
38
|
+
Origen.app.listeners_for(:shutdown, top_level: :last).each do |listener|
|
39
|
+
listener.shutdown(Pattern.create_options)
|
40
|
+
end
|
41
|
+
Origen.app.listeners_for(:on_top_level_reset!, top_level: false).each(&:on_top_level_reset!)
|
42
|
+
end
|
43
|
+
Origen.app.listeners_for(:on_top_level_reset, top_level: false).each(&:on_top_level_reset)
|
44
|
+
Origen.app.listeners_for(:reset_registers).each(&:reset_registers)
|
45
|
+
if options[:bang]
|
46
|
+
Origen.app.listeners_for(:startup).each do |listener|
|
47
|
+
listener.startup(Pattern.create_options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
Origen.app.listeners_for(:after_top_level_reset).each(&:after_top_level_reset)
|
51
|
+
end
|
52
|
+
|
53
|
+
def ip_name
|
54
|
+
@ip_name || self.class.to_s.split('::').last.symbolize
|
55
|
+
end
|
56
|
+
|
57
|
+
# Use this to specify the current package option for the given SoC.
|
58
|
+
#
|
59
|
+
# This allows different pin configurations to be specified by package.
|
60
|
+
def current_package=(val)
|
61
|
+
@current_package_id = val.is_a?(ChipPackage) ? val.id : val
|
62
|
+
end
|
63
|
+
alias_method :package=, :current_package=
|
64
|
+
|
65
|
+
# Returns the current package configuration of the pin owner, unless specifically
|
66
|
+
# specified by the application this will return nil.
|
67
|
+
def current_package(_options = {})
|
68
|
+
if @current_package_id
|
69
|
+
return _packages[@current_package_id] if _packages[@current_package_id]
|
70
|
+
fail "The package #{@current_package_id} of #{self.class} has not been defined!"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
alias_method :package, :current_package
|
74
|
+
|
75
|
+
# Returns an array containing the IDs of all known configurations if no ID is supplied,
|
76
|
+
# otherwise returns an object representing the given package ID
|
77
|
+
def packages(id = nil, _options = {})
|
78
|
+
id, options = nil, id if id.is_a?(Hash)
|
79
|
+
if id
|
80
|
+
_packages[id]
|
81
|
+
else
|
82
|
+
_packages.ids
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Execute the supplied block within the context of the given package, at the end
|
87
|
+
# the model's package attribute will be restored to what it was before calling
|
88
|
+
# this method.
|
89
|
+
def with_package(id, _options = {})
|
90
|
+
orig = package
|
91
|
+
self.package = id
|
92
|
+
yield
|
93
|
+
self.package = orig
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_package(id, _options = {})
|
97
|
+
p = ChipPackage.new
|
98
|
+
p.id = id
|
99
|
+
p.owner = self
|
100
|
+
yield p if block_given?
|
101
|
+
_add_package(p)
|
102
|
+
p
|
103
|
+
end
|
104
|
+
|
105
|
+
def includes_origen_top_level?
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Sets the Origen.top_level.packages array to nil. Written so packages created in memory can
|
110
|
+
# be erased so packages defined in Ruby files can be loaded
|
111
|
+
def delete_all_packages
|
112
|
+
@_packages = nil
|
113
|
+
end
|
114
|
+
alias_method :delete_all_pkgs, :delete_all_packages
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
def init_top_level
|
119
|
+
Origen.app.add_toplevel_listener(self)
|
120
|
+
end
|
121
|
+
|
122
|
+
def _packages
|
123
|
+
@_packages ||= {}
|
124
|
+
end
|
125
|
+
|
126
|
+
def _add_package(package)
|
127
|
+
if _packages[package.id]
|
128
|
+
fail "There is already a package called #{package.id}!"
|
129
|
+
else
|
130
|
+
_packages[package.id] = package
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Origen
|
2
|
+
module Users
|
3
|
+
# Interface to talk to a company's LDAP-based employee directory, an instance of this class is available
|
4
|
+
# at Origen.ldap
|
5
|
+
#
|
6
|
+
# This provides APIs to lookup public information about any user (email, phone number, etc)
|
7
|
+
class LDAP
|
8
|
+
require 'io/console'
|
9
|
+
require 'base64'
|
10
|
+
require 'net-ldap'
|
11
|
+
|
12
|
+
SERVICE_ACCOUNT = Origen.site_config.ldap_username
|
13
|
+
SERVICE_PASS = Origen.site_config.ldap_password
|
14
|
+
|
15
|
+
HOST = Origen.site_config.ldap_host
|
16
|
+
PORT = Origen.site_config.ldap_port
|
17
|
+
BASE_DN = Origen.site_config.ldap_base_dn
|
18
|
+
|
19
|
+
def available?
|
20
|
+
!!(SERVICE_ACCOUNT && SERVICE_PASS && HOST && PORT && BASE_DN)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Lookup the given user in the core directory and return an object representing the user's entry
|
24
|
+
# in the FSL application directory, run the display method from the console to see the field
|
25
|
+
# names and what information is available.
|
26
|
+
# The record for the given user will be cached the first time it is generated, so this method can be
|
27
|
+
# repeatedly called from the same thread without incurring a remote fetch each time.
|
28
|
+
#
|
29
|
+
# entry = Origen.fsl.lookup("r49409")
|
30
|
+
# entry.mail # => stephen.mcginty@freescale.com
|
31
|
+
def lookup(user_or_id = Origen.current_user)
|
32
|
+
id = id(user_or_id)
|
33
|
+
unless instance_variable_defined?("@#{id.downcase}")
|
34
|
+
record = service.search(base: BASE_DN, filter: "#{Origen.site_config.ldap_user_id_attribute || 'id'}=#{id}").first
|
35
|
+
instance_variable_set("@#{id.downcase}", record)
|
36
|
+
end
|
37
|
+
instance_variable_get("@#{id.downcase}")
|
38
|
+
end
|
39
|
+
|
40
|
+
# Prints out the information available for the given core, this is useful to work out the name
|
41
|
+
# of the information that you want to pull from the object returned from lookup
|
42
|
+
def display(user_or_id = Origen.current_user)
|
43
|
+
lookup(user_or_id).each do |attribute, values|
|
44
|
+
puts " #{attribute}:"
|
45
|
+
values.each do |value|
|
46
|
+
puts " --->#{value}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def id(user_or_id)
|
54
|
+
user_or_id.respond_to?(:id) ? user_or_id.id : user_or_id
|
55
|
+
end
|
56
|
+
|
57
|
+
def service
|
58
|
+
@service ||= Net::LDAP.new host: HOST,
|
59
|
+
port: PORT,
|
60
|
+
encryption: :simple_tls,
|
61
|
+
auth: { method: :simple, username: SERVICE_ACCOUNT, password: SERVICE_PASS }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
module Origen
|
2
|
+
module Users
|
3
|
+
class User
|
4
|
+
require 'openssl'
|
5
|
+
require 'digest/sha1'
|
6
|
+
|
7
|
+
attr_reader :role
|
8
|
+
attr_writer :name, :email
|
9
|
+
|
10
|
+
def self.current_user_id
|
11
|
+
`whoami`.strip
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.current
|
15
|
+
Origen.current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(*args)
|
19
|
+
if args.last.is_a?(Symbol)
|
20
|
+
@role = args.pop
|
21
|
+
else
|
22
|
+
@role = :user
|
23
|
+
end
|
24
|
+
if args.size == 2
|
25
|
+
@name = args.first
|
26
|
+
end
|
27
|
+
id = args.pop
|
28
|
+
if id.to_s =~ /(.*)@/
|
29
|
+
@email = id
|
30
|
+
@id = Regexp.last_match(1)
|
31
|
+
else
|
32
|
+
@id = id
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Send the user an email
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# User.current.send subject: "Complete", message: "Your job is done!"
|
40
|
+
# User.new("r49409").send subject: "Complete", message: "Your job is done!"
|
41
|
+
def send(options)
|
42
|
+
options[:body] ||= options[:message]
|
43
|
+
options[:to] = self
|
44
|
+
Origen.mailer.send_email(options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def id
|
48
|
+
@id.to_s.downcase
|
49
|
+
end
|
50
|
+
alias_method :core_id, :id
|
51
|
+
|
52
|
+
# Returns true if the user is an admin for the current application
|
53
|
+
def admin?
|
54
|
+
role == :admin
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns true if the user is the current user
|
58
|
+
def current?
|
59
|
+
id.to_s.downcase == self.class.current_user_id
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns the user's initials in lower case
|
63
|
+
def initials
|
64
|
+
initials = name.split(/\s+/).map { |n| n[0].chr }.join('')
|
65
|
+
initials.downcase
|
66
|
+
end
|
67
|
+
|
68
|
+
def name
|
69
|
+
@name || @id
|
70
|
+
end
|
71
|
+
|
72
|
+
def email
|
73
|
+
return @email if @email
|
74
|
+
if Origen.site_config.email_domain
|
75
|
+
"#{id}@#{Origen.site_config.email_domain}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Fetch user data from the FSL application directory
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
#
|
83
|
+
# User.new("r49409").lookup.motunixdomain # => ["cde-tx32.sps.mot.com"]
|
84
|
+
def lookup(default = 'Unknown')
|
85
|
+
data = Origen.ldap.lookup(self)
|
86
|
+
if block_given?
|
87
|
+
if data
|
88
|
+
yield data
|
89
|
+
else
|
90
|
+
default
|
91
|
+
end
|
92
|
+
else
|
93
|
+
data
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Prints all raw data available on the given user from the FSL
|
98
|
+
# application directory.
|
99
|
+
#
|
100
|
+
# Most of the useful data is already exposed through the available
|
101
|
+
# user methods, but if you want to get any of these parameters they
|
102
|
+
# can be fetched via the lookup method.
|
103
|
+
def raw
|
104
|
+
Origen.ldap.display(self)
|
105
|
+
nil
|
106
|
+
end
|
107
|
+
alias_method :display, :raw
|
108
|
+
|
109
|
+
def ==(user)
|
110
|
+
if user.is_a?(Origen::Users::User)
|
111
|
+
user.id == id
|
112
|
+
elsif user.is_a?(String)
|
113
|
+
user.downcase == id
|
114
|
+
else
|
115
|
+
super
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Provides methods to access attributes available from LDAP
|
120
|
+
def method_missing(method, *args, &block)
|
121
|
+
l = Origen.ldap.lookup(self)
|
122
|
+
if l
|
123
|
+
if l.attribute_names.include?(method)
|
124
|
+
l[method]
|
125
|
+
else
|
126
|
+
super
|
127
|
+
end
|
128
|
+
else
|
129
|
+
super
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def respond_to?(method)
|
134
|
+
super || begin
|
135
|
+
if Origen.ldap.available?
|
136
|
+
Origen.ldap.lookup(self) && Origen.ldap.lookup(self).attribute_names.include?(method.to_sym)
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns a string like "Stephen McGinty <Stephen.Mcginty@freescale.com>"
|
144
|
+
def name_and_email
|
145
|
+
"#{name} <#{email}>"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
data/lib/origen/users.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Origen
|
2
|
+
# Methods related to individual users and groups
|
3
|
+
module Users
|
4
|
+
autoload :User, 'origen/users/user'
|
5
|
+
autoload :LDAP, 'origen/users/ldap'
|
6
|
+
|
7
|
+
def app_users
|
8
|
+
# Had to do some shenanigans here due to Origen.root not being available
|
9
|
+
# when this file is included, only load the users from the app once a user
|
10
|
+
# method is first called
|
11
|
+
return @app_users if @app_users
|
12
|
+
require File.join(Origen.root, 'config', 'users')
|
13
|
+
@app_users = users
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns a user object representing the current user, will return a default
|
17
|
+
# user object if the current user is not known to the generator
|
18
|
+
def current_user
|
19
|
+
core_id = Origen::Users::User.current_user_id
|
20
|
+
user = app_users.find { |user| user.core_id == core_id }
|
21
|
+
user || User.new(core_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns all admin user objects
|
25
|
+
def admins
|
26
|
+
app_users.select(&:admin?)
|
27
|
+
end
|
28
|
+
alias_method :developers, :admins
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module Origen
|
2
|
+
module Utility
|
3
|
+
# BlockArgs provides a neat way to pass multiple block arguments to a method
|
4
|
+
# that the method can then used in various ways.
|
5
|
+
#
|
6
|
+
# (blocks in Ruby are merely nameless methods you can pass to methods as an argument. Used to pass ruby code to a method basically.)
|
7
|
+
#
|
8
|
+
# A single BlockArgs object is an array of these blocks that can be added or
|
9
|
+
# deleted.
|
10
|
+
#
|
11
|
+
# def handle_some_blocks(options={})
|
12
|
+
#
|
13
|
+
# blockA = Origen::Utility::BlockArgs.new
|
14
|
+
# blockB = Origen::Utility::BlockArgs.new
|
15
|
+
#
|
16
|
+
# yield blockA, blockB
|
17
|
+
#
|
18
|
+
# puts "Handling blocks!"
|
19
|
+
#
|
20
|
+
# if options[:block_to_run] == :blockA
|
21
|
+
# blockA.each do |block|
|
22
|
+
# block.call
|
23
|
+
# end
|
24
|
+
# else
|
25
|
+
# blockB.each do |block|
|
26
|
+
# block.call
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# puts "Done handling blocks!"
|
31
|
+
#
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# To then use the above method:
|
35
|
+
#
|
36
|
+
# handle_some_blocks(options) do |blockA, blockB|
|
37
|
+
# blockA.add do
|
38
|
+
# puts "do task 1"
|
39
|
+
# end
|
40
|
+
# blockA.add do
|
41
|
+
# puts "do task 2"
|
42
|
+
# end
|
43
|
+
# blockB.add do
|
44
|
+
# puts "do task 3"
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# Many blocks can be added in this case to either the blockA or blockB BlockArg objects.
|
49
|
+
# The only reason 2 BlockArg objects are used above is that handle_some_blocks wants to use
|
50
|
+
# different blocks depending on an option argument.
|
51
|
+
#
|
52
|
+
# This is a very powerful way to put code specific to one application in a different method in
|
53
|
+
# different class (e.g. handle_some_blocks) where the code calling it doesn't need to know
|
54
|
+
# exact implementation details.
|
55
|
+
#
|
56
|
+
class BlockArgs
|
57
|
+
# any Enumerable methods also can be used
|
58
|
+
# e.g. each_with_index
|
59
|
+
include Enumerable
|
60
|
+
|
61
|
+
# Creates a new BlockArgs object
|
62
|
+
def initialize
|
63
|
+
@block_args = []
|
64
|
+
end
|
65
|
+
|
66
|
+
# Adds a block to the BlockArgs object
|
67
|
+
def add(&block)
|
68
|
+
@block_args << block
|
69
|
+
end
|
70
|
+
|
71
|
+
# Deletes a block to the BlockArgs object
|
72
|
+
def delete(&block)
|
73
|
+
@block_args.delete(block)
|
74
|
+
end
|
75
|
+
|
76
|
+
# required to enumerate objects for Enumerable
|
77
|
+
# iterator returns each block at a time
|
78
|
+
def each
|
79
|
+
@block_args.each do |arg|
|
80
|
+
yield arg
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# same as each but returns index of each block
|
85
|
+
# instead of block itself.
|
86
|
+
def each_index
|
87
|
+
@block_args.each_index do |i|
|
88
|
+
yield i
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|