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,35 @@
|
|
1
|
+
module Origen
|
2
|
+
module Tester
|
3
|
+
# rubocop:disable ClassAndModuleCamelCase
|
4
|
+
|
5
|
+
# Tester model to generate .atp patterns for the Teradyne J750 in HPT mode
|
6
|
+
#
|
7
|
+
# == Basic Usage
|
8
|
+
# $tester = J750_HPT.new
|
9
|
+
# $tester.cycle # Generate a vector
|
10
|
+
#
|
11
|
+
# Many more methods exist to generate J750 specific micro-code, see J750
|
12
|
+
# parent class definition for details.
|
13
|
+
#
|
14
|
+
# *Also note that this class inherits from the base Tester class and so all methods
|
15
|
+
# described there are also available*
|
16
|
+
class J750_HPT < J750
|
17
|
+
def initialize
|
18
|
+
super
|
19
|
+
@@hpt_mode = true
|
20
|
+
@drive_hi_state = '.1'
|
21
|
+
@drive_lo_state = '.0'
|
22
|
+
@expect_hi_state = '.H'
|
23
|
+
@expect_lo_state = '.L'
|
24
|
+
@dont_care_state = '.X'
|
25
|
+
@overlay_state = '.V'
|
26
|
+
@drive_very_hi_state = '.2'
|
27
|
+
@drive_mem_state = '.D'
|
28
|
+
@expect_mem_state = '.E'
|
29
|
+
@name = 'j750_hpt'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# rubocop:enable ClassAndModuleCamelCase
|
34
|
+
end
|
35
|
+
end
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Origen
|
2
|
+
module Tester
|
3
|
+
class J750
|
4
|
+
class Parser
|
5
|
+
class DCSpec
|
6
|
+
attr_accessor :parser
|
7
|
+
attr_accessor :name, :categories
|
8
|
+
alias_method :symbol, :name
|
9
|
+
|
10
|
+
def initialize(name, categories, options = {})
|
11
|
+
@parser = options[:parser]
|
12
|
+
@name = name
|
13
|
+
@categories = categories
|
14
|
+
@values = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_values(components)
|
18
|
+
@categories.each_with_index do |category, i|
|
19
|
+
@values[category] ||= {}
|
20
|
+
@values[category]['Typ'] ||= components[5 + (i * 3) + 0]
|
21
|
+
@values[category]['Min'] ||= components[5 + (i * 3) + 1]
|
22
|
+
@values[category]['Max'] ||= components[5 + (i * 3) + 2]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def lookup(category, selector)
|
27
|
+
v = @values[category]
|
28
|
+
if v
|
29
|
+
v[selector]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Origen
|
2
|
+
module Tester
|
3
|
+
class J750
|
4
|
+
class Parser
|
5
|
+
class DCSpecs < Origen::Tester::Parser::SearchableHash
|
6
|
+
attr_accessor :parser
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@parser = options[:parser]
|
10
|
+
end
|
11
|
+
|
12
|
+
def import(file)
|
13
|
+
@categories = []
|
14
|
+
File.readlines(file).each do |line|
|
15
|
+
unless line.strip.empty?
|
16
|
+
components = line.split("\t")
|
17
|
+
if components[3] == 'Selector'
|
18
|
+
extract_categories(components)
|
19
|
+
else
|
20
|
+
unless components[1] == 'DC Specs' || components[1] == 'Symbol'
|
21
|
+
extract_spec(components)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def inspect
|
29
|
+
"<DCSpecs: #{size}>"
|
30
|
+
end
|
31
|
+
|
32
|
+
def extract_categories(components)
|
33
|
+
components.each_with_index do |val, i|
|
34
|
+
if i > 4
|
35
|
+
@categories << val unless val.strip.empty?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
@categories.uniq!
|
39
|
+
end
|
40
|
+
|
41
|
+
def extract_spec(components)
|
42
|
+
name = components[1]
|
43
|
+
self[name] ||= DCSpec.new(name, @categories, parser: parser)
|
44
|
+
self[name].add_values(components)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,340 @@
|
|
1
|
+
module Origen
|
2
|
+
module Tester
|
3
|
+
class J750
|
4
|
+
class Parser
|
5
|
+
# Extracts embedded test and flow descriptions (comments) from test
|
6
|
+
# program source files
|
7
|
+
class Descriptions
|
8
|
+
attr_accessor :source_directories, :template_directories, :parser
|
9
|
+
|
10
|
+
SCRATCH_DIR = "#{Origen.root}/.j750_scratch"
|
11
|
+
|
12
|
+
# All descriptions are stored in this lookup table
|
13
|
+
def lookup
|
14
|
+
return @lookup if @lookup
|
15
|
+
# Use the one from the interface if present, program generation will
|
16
|
+
# automatically push descriptions in here
|
17
|
+
if Origen.interface_present?
|
18
|
+
@lookup = Origen.interface.descriptions
|
19
|
+
else
|
20
|
+
@lookup = Origen::Tester::Parser::DescriptionLookup.new
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(options = {})
|
25
|
+
@parser = options[:parser]
|
26
|
+
FileUtils.rm_rf(SCRATCH_DIR) if File.exist?(SCRATCH_DIR)
|
27
|
+
parse_program
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns the description for the given flow
|
32
|
+
def flow_summary(options = {})
|
33
|
+
lookup.for_flow(options[:file])
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the description of the given test from the test
|
37
|
+
# instance sheet declaration
|
38
|
+
def test_instance(options = {})
|
39
|
+
lookup.for_test_definition(options[:name])
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns the description of the given test from the test
|
43
|
+
# flow
|
44
|
+
def flow_line(options = {})
|
45
|
+
lookup.for_test_usage(options[:name], options[:flow])
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_program
|
49
|
+
Origen.file_handler.preserve_state do
|
50
|
+
generate_program_files
|
51
|
+
# Comments must be extracted manually for any compiled files, for
|
52
|
+
# generated files the comments will already be in the lookup
|
53
|
+
extract_flow_summaries
|
54
|
+
extract_test_instance_descriptions
|
55
|
+
extract_flow_line_descriptions
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def source_directories
|
60
|
+
[@source_directories, Origen.config.test_program_source_directory].compact.flatten
|
61
|
+
end
|
62
|
+
|
63
|
+
def template_directories
|
64
|
+
[@template_directories, Origen.config.test_program_template_directory].compact.flatten
|
65
|
+
end
|
66
|
+
|
67
|
+
def extract_flow_summaries
|
68
|
+
Origen.file_handler.resolve_files(compiled_dir) do |file|
|
69
|
+
if flow_file?(file)
|
70
|
+
lookup.add_for_flow(file, parse_flow_summary(file))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Parses a compiled template for marked up comments
|
76
|
+
def extract_test_instance_descriptions
|
77
|
+
Origen.file_handler.resolve_files(compiled_dir) do |file|
|
78
|
+
if instance_file?(file)
|
79
|
+
comments = []
|
80
|
+
File.readlines(file).each do |line|
|
81
|
+
if line =~ /^<comment>(.*)/
|
82
|
+
comments << Regexp.last_match[1].gsub("\r", '')
|
83
|
+
else
|
84
|
+
fields = line.split("\t")
|
85
|
+
unless ['Test Instances', '', 'Test Name'].include? fields[1]
|
86
|
+
lookup.add_for_test_definition(fields[1], comments)
|
87
|
+
end
|
88
|
+
comments = []
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def extract_flow_line_descriptions
|
96
|
+
Origen.file_handler.resolve_files(compiled_dir) do |file|
|
97
|
+
if flow_file?(file)
|
98
|
+
f = file.basename('.txt').to_s
|
99
|
+
comments = []
|
100
|
+
header_line = true
|
101
|
+
File.readlines(file).each do |line|
|
102
|
+
if header_line
|
103
|
+
header_line = false if line =~ /^\s*Label/
|
104
|
+
else
|
105
|
+
if line =~ /^<comment>(.*)/
|
106
|
+
comments << Regexp.last_match[1].gsub("\r", '')
|
107
|
+
else
|
108
|
+
t = FlowLine.extract_test(line)
|
109
|
+
if t
|
110
|
+
lookup.add_for_test_usage(t, file, comments)
|
111
|
+
end
|
112
|
+
comments = []
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def generate_program_files
|
121
|
+
a = generate_program
|
122
|
+
b = compile_program
|
123
|
+
unless a || b
|
124
|
+
fail 'No source or template files declared from which to parse descriptions!'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Parses the given flow file for summary text and returns it, summary
|
129
|
+
# text must be the very first thing in the file.
|
130
|
+
# Returns an array of strings each representing a line of text.
|
131
|
+
def parse_flow_summary(file)
|
132
|
+
desc = []
|
133
|
+
File.readlines(file).each do |line|
|
134
|
+
if line =~ /%?\s*<comment>(.*)/
|
135
|
+
desc << Regexp.last_match[1].gsub("\r", '')
|
136
|
+
else
|
137
|
+
break
|
138
|
+
end
|
139
|
+
end
|
140
|
+
desc
|
141
|
+
end
|
142
|
+
|
143
|
+
# Generate a scratch version of the program for parsing
|
144
|
+
def generate_program
|
145
|
+
if source_directories.size > 0
|
146
|
+
unless @program_generated
|
147
|
+
Origen.log.info ''
|
148
|
+
Origen.log.info 'Extracting embedded comments:'
|
149
|
+
Origen.log.info ''
|
150
|
+
copy_source_files_to_scratch
|
151
|
+
markup_source_file_comments
|
152
|
+
# Compile the flow file, with Ruby comments now preserved and marked up
|
153
|
+
desc = Origen.app.runner.generate(program: true, patterns: ungenerated_dir, output: generated_dir,
|
154
|
+
check_for_changes: false, collect_stats: false, quiet: true,
|
155
|
+
collect_descriptions: true)
|
156
|
+
Origen.log.info ''
|
157
|
+
end
|
158
|
+
@program_generated = true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Compile a scratch version of the program for parsing
|
165
|
+
def compile_program
|
166
|
+
if template_directories.size > 0
|
167
|
+
unless @program_compiled
|
168
|
+
Origen.log.info ''
|
169
|
+
Origen.log.info 'Extracting embedded comments:'
|
170
|
+
Origen.log.info ''
|
171
|
+
copy_templates_to_scratch
|
172
|
+
markup_template_comments
|
173
|
+
# Compile the flow file, with Ruby comments now preserved and marked up
|
174
|
+
Origen.app.runner.generate(compile: true, patterns: uncompiled_dir, output: compiled_dir,
|
175
|
+
check_for_changes: false, collect_stats: false, quiet: true)
|
176
|
+
Origen.log.info ''
|
177
|
+
end
|
178
|
+
@program_compiled = true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Copy all flow and instance template files to the scratch dir
|
185
|
+
def copy_templates_to_scratch
|
186
|
+
uncompiled_dir(true)
|
187
|
+
template_directories.each do |dir|
|
188
|
+
Origen.file_handler.resolve_files(dir) do |file|
|
189
|
+
subdir = file.relative_path_from(Pathname.new(dir)).dirname.to_s
|
190
|
+
cpydir = "#{uncompiled_dir}/#{subdir}"
|
191
|
+
FileUtils.mkdir_p(cpydir) unless File.exist?(cpydir)
|
192
|
+
FileUtils.copy(file, cpydir) if flow_or_instance_file?(file)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
`chmod -R 777 #{uncompiled_dir}/*` unless Dir["#{uncompiled_dir}/*"].empty?
|
196
|
+
end
|
197
|
+
|
198
|
+
# Copy all flow and instance source files to the scratch dir
|
199
|
+
def copy_source_files_to_scratch
|
200
|
+
source_directories.each do |dir|
|
201
|
+
Origen.file_handler.resolve_files(dir) do |file|
|
202
|
+
subdir = file.relative_path_from(Pathname.new(dir)).dirname.to_s
|
203
|
+
cpydir = "#{ungenerated_dir}/#{subdir}"
|
204
|
+
FileUtils.mkdir_p(cpydir) unless File.exist?(cpydir)
|
205
|
+
FileUtils.copy(file, cpydir)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def uncompiled_dir(force_make = false)
|
211
|
+
@uncompiled_dir ||= "#{SCRATCH_DIR}/uncompiled"
|
212
|
+
if force_make
|
213
|
+
FileUtils.rm_rf(@uncompiled_dir) if File.exist?(@uncompiled_dir)
|
214
|
+
@uncompiled_dir_created = false
|
215
|
+
end
|
216
|
+
unless @uncompiled_dir_created
|
217
|
+
FileUtils.mkdir_p(@uncompiled_dir) unless File.exist?(@uncompiled_dir)
|
218
|
+
@uncompiled_dir_created = true
|
219
|
+
end
|
220
|
+
@uncompiled_dir
|
221
|
+
end
|
222
|
+
|
223
|
+
def ungenerated_dir
|
224
|
+
@ungenerated_dir ||= "#{SCRATCH_DIR}/ungenerated"
|
225
|
+
unless @ungenerated_dir_created
|
226
|
+
FileUtils.mkdir_p(@ungenerated_dir) unless File.exist?(@ungenerated_dir)
|
227
|
+
@ungenerated_dir_created = true
|
228
|
+
end
|
229
|
+
@ungenerated_dir
|
230
|
+
end
|
231
|
+
|
232
|
+
def compiled_dir
|
233
|
+
@compiled_dir ||= "#{SCRATCH_DIR}/compiled"
|
234
|
+
unless @compiled_dir_created
|
235
|
+
FileUtils.mkdir_p(@compiled_dir) unless File.exist?(@compiled_dir)
|
236
|
+
@compiled_dir_created = true
|
237
|
+
end
|
238
|
+
@compiled_dir
|
239
|
+
end
|
240
|
+
|
241
|
+
def generated_dir
|
242
|
+
@generated_dir ||= "#{SCRATCH_DIR}/generated"
|
243
|
+
unless @generated_dir_created
|
244
|
+
FileUtils.mkdir_p(@generated_dir) unless File.exist?(@generated_dir)
|
245
|
+
@generated_dir_created = true
|
246
|
+
end
|
247
|
+
@generated_dir
|
248
|
+
end
|
249
|
+
|
250
|
+
# Returns true if the given file looks like a J750 flow file, works for
|
251
|
+
# templates to
|
252
|
+
def flow_or_instance_file?(file, options = {})
|
253
|
+
options = { flow: true,
|
254
|
+
instance: true
|
255
|
+
}.merge(options)
|
256
|
+
if options[:flow] && options[:instance]
|
257
|
+
match = 'Flow|Instances'
|
258
|
+
elsif options[:flow]
|
259
|
+
match = 'Flow'
|
260
|
+
else
|
261
|
+
match = 'Instances'
|
262
|
+
end
|
263
|
+
# Not sure the best way to determine the file type of a partial, just
|
264
|
+
# return true for now to play it safe
|
265
|
+
return true if file.basename.to_s =~ /^_/
|
266
|
+
File.readlines(file).each do |line|
|
267
|
+
begin
|
268
|
+
unless line =~ /^%/ || line =~ /^\s*<comment>/
|
269
|
+
return !!(line =~ /#{match}/)
|
270
|
+
end
|
271
|
+
rescue Exception => e
|
272
|
+
if e.is_a?(ArgumentError) && e.message =~ /invalid byte sequence/
|
273
|
+
return false
|
274
|
+
else
|
275
|
+
puts e.message
|
276
|
+
puts e.backtrace
|
277
|
+
exit 1
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
def flow_file?(file)
|
284
|
+
flow_or_instance_file?(file, instance: false)
|
285
|
+
end
|
286
|
+
|
287
|
+
def instance_file?(file)
|
288
|
+
flow_or_instance_file?(file, flow: false)
|
289
|
+
end
|
290
|
+
|
291
|
+
# Substitute Ruby line comments so they are preserved by compilation
|
292
|
+
def markup_template_comments
|
293
|
+
Origen.file_handler.resolve_files(uncompiled_dir) do |file|
|
294
|
+
lines = File.readlines(file)
|
295
|
+
File.open(file, 'w') do |f|
|
296
|
+
lines.each do |line|
|
297
|
+
if line =~ /^%\s*#\s?(.*)/ # Remove single leading whitespace from comment if it exists
|
298
|
+
comment = Regexp.last_match[1]
|
299
|
+
# If comment starts with a '#-' it should be removed by compilation
|
300
|
+
if line =~ /^%\s*#-.*/
|
301
|
+
f.write line
|
302
|
+
# Otherwise preserve it
|
303
|
+
else
|
304
|
+
f.write "<comment>#{comment}\n"
|
305
|
+
end
|
306
|
+
else
|
307
|
+
f.write line
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
# Substitute Ruby line comments so they are preserved by generation
|
315
|
+
def markup_source_file_comments
|
316
|
+
Origen.file_handler.resolve_files(ungenerated_dir) do |file|
|
317
|
+
lines = File.readlines(file)
|
318
|
+
File.open(file, 'w') do |f|
|
319
|
+
lines.each do |line|
|
320
|
+
if line =~ /^\s*#\s?(.*)/ # Remove single leading whitespace from comment if it exists
|
321
|
+
comment = Regexp.last_match[1]
|
322
|
+
# If comment starts with a '#-' it should be removed by generation
|
323
|
+
if line =~ /^\s*#-.*/
|
324
|
+
f.write line
|
325
|
+
# Otherwise preserve it
|
326
|
+
else
|
327
|
+
f.write "Origen.interface.comment '#{comment}'\n"
|
328
|
+
end
|
329
|
+
else
|
330
|
+
f.write line
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Origen
|
2
|
+
module Tester
|
3
|
+
class J750
|
4
|
+
class Parser
|
5
|
+
class Flow < Origen::Tester::Parser::SearchableArray
|
6
|
+
require 'pathname'
|
7
|
+
|
8
|
+
attr_accessor :parser, :file
|
9
|
+
|
10
|
+
def initialize(file, options = {}) # :nodoc:
|
11
|
+
@parser = options[:parser]
|
12
|
+
@file = Pathname.new(file)
|
13
|
+
parse
|
14
|
+
end
|
15
|
+
|
16
|
+
def description
|
17
|
+
@parser.descriptions.flow_summary(file: file)
|
18
|
+
end
|
19
|
+
alias_method :summary, :description
|
20
|
+
|
21
|
+
# Returns the filename of the sheet that contained the current flow
|
22
|
+
def filename
|
23
|
+
@file.basename.to_s
|
24
|
+
end
|
25
|
+
alias_method :name, :filename
|
26
|
+
|
27
|
+
# Returns all flow lines that are tests, optionally supply a context to
|
28
|
+
# have only the test that will execute in that context returned
|
29
|
+
#
|
30
|
+
# $tester.flow.first.tests.size
|
31
|
+
# => 20
|
32
|
+
# $tester.flow.first.tests(:job => "P1").size
|
33
|
+
# => 10
|
34
|
+
# $tester.flow.first.tests(:job => "P1", :enable => "data_collection").size
|
35
|
+
# => 15
|
36
|
+
def tests(context = {})
|
37
|
+
run_context(context)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns all tests in the current flow, regardless of context
|
41
|
+
def all_tests
|
42
|
+
where(opcode: %w(Test characterize), exact: true)
|
43
|
+
end
|
44
|
+
|
45
|
+
def run_context(context) # :nodoc:
|
46
|
+
capture = true
|
47
|
+
waiting_for_label = false
|
48
|
+
select do |line|
|
49
|
+
if capture
|
50
|
+
if !waiting_for_label || waiting_for_label == line.label
|
51
|
+
waiting_for_label = false
|
52
|
+
case line.type
|
53
|
+
when 'Test', 'characterize'
|
54
|
+
line.executes_under_context?(context)
|
55
|
+
when 'set-device', 'stop'
|
56
|
+
capture = false if line.executes_under_context?(context)
|
57
|
+
false
|
58
|
+
when 'enable-flow-word'
|
59
|
+
if line.executes_under_context?(context)
|
60
|
+
context[:enable] = [context[:enable]].flatten
|
61
|
+
context[:enable] << line.parameter
|
62
|
+
end
|
63
|
+
false
|
64
|
+
when 'flag-true'
|
65
|
+
if line.executes_under_context?(context)
|
66
|
+
context[:true_flags] = [context[:true_flags]].flatten
|
67
|
+
context[:true_flags] << line.parameter
|
68
|
+
end
|
69
|
+
false
|
70
|
+
when 'flag-false'
|
71
|
+
if line.executes_under_context?(context)
|
72
|
+
context[:false_flags] = [context[:false_flags]].flatten
|
73
|
+
context[:false_flags] << line.parameter
|
74
|
+
end
|
75
|
+
false
|
76
|
+
when 'disable-flow-word'
|
77
|
+
if line.executes_under_context?(context)
|
78
|
+
context[:enable] = [context[:enable]].flatten
|
79
|
+
context[:enable].delete(line.parameter)
|
80
|
+
end
|
81
|
+
false
|
82
|
+
when 'logprint', 'nop', 'print'
|
83
|
+
false
|
84
|
+
when 'goto'
|
85
|
+
waiting_for_label = line.parameter
|
86
|
+
false
|
87
|
+
else
|
88
|
+
fail "Don't know how to process: #{line.type}, in file #{filename}"
|
89
|
+
end
|
90
|
+
else
|
91
|
+
false
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse # :nodoc:
|
98
|
+
File.readlines(@file).each do |line|
|
99
|
+
l = FlowLine.new(line, parser: parser, flow: self)
|
100
|
+
self << l if l.valid?
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def inspect # :nodoc:
|
105
|
+
"<TestFlow: #{filename}, Lines: #{size}>"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|