origen_std_lib 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23e07c1053dbf863471b6358d7695c9d67a298ec
4
+ data.tar.gz: 85629fd2efc77a3e5f320d01efc7b3cca92016e1
5
+ SHA512:
6
+ metadata.gz: 5ff4fabc366485fd8123219b502c5d31257f9f150c126b19946a2c5df938a51132709d09d8fc53cf5821e1290ef88d70a240e8cbbd37029e4cefeb3db4a3e4a5
7
+ data.tar.gz: ba7a297071ee31fce54aeebfbd0a62805a62588c2c0df5834eead7595bed7047c9bea5aab7afaaf508dfcf0bdc24c3fb83844356ae88e3731ea7e5bd8becc44a
@@ -0,0 +1,126 @@
1
+ require 'origen'
2
+ class OrigenStdLibApplication < Origen::Application
3
+
4
+ # See http://origen-sdk.org/origen/api/Origen/Application/Configuration.html
5
+ # for a full list of the configuration options available
6
+
7
+ # These attributes should never be changed, the duplication here will be resolved in future
8
+ # by condensing these attributes that do similar things
9
+ self.name = "origen_std_lib"
10
+ self.namespace = "OrigenStdLib"
11
+ config.name = "origen_std_lib"
12
+ config.initials = "OrigenStdLib"
13
+ # Change this to point to the revision control repository for this plugin
14
+ config.rc_url = "git@github.com:Origen-SDK/origen_std_lib.git"
15
+ config.release_externally = true
16
+
17
+ # To enable deployment of your documentation to a web server (via the 'origen web'
18
+ # command) fill in these attributes.
19
+ config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/std_lib"
20
+ config.web_domain = "http://origen-sdk.org/std_lib"
21
+
22
+ # When false Origen will be less strict about checking for some common coding errors,
23
+ # it is recommended that you leave this to true for better feedback and easier debug.
24
+ # This will be the default setting in Origen v3.
25
+ config.strict_errors = true
26
+
27
+ # See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
28
+ config.lint_test = {
29
+ # Require the lint tests to pass before allowing a release to proceed
30
+ run_on_tag: true,
31
+ # Auto correct violations where possible whenever 'origen lint' is run
32
+ auto_correct: true,
33
+ # Limit the testing for large legacy applications
34
+ #level: :easy,
35
+ # Run on these directories/files by default
36
+ #files: ["lib", "config/application.rb"],
37
+ }
38
+
39
+ config.semantically_version = true
40
+
41
+ def after_web_site_compile(options={})
42
+ if options[:api]
43
+ Dir.chdir "#{Origen.app.rc.root}/v93k" do
44
+ system "doxygen .doxygen"
45
+ d = "#{Origen.root}/web/output"
46
+ FileUtils.mkdir_p(d)
47
+ FileUtils.mv "html", "#{d}/v93k"
48
+ end
49
+ end
50
+ end
51
+
52
+ # An example of how to set application specific LSF parameters
53
+ #config.lsf.project = "msg.te"
54
+
55
+ # An example of how to specify a prefix to add to all generated patterns
56
+ #config.pattern_prefix = "nvm"
57
+
58
+ # An example of how to add header comments to all generated patterns
59
+ #config.pattern_header do
60
+ # cc "This is a pattern created by the example origen application"
61
+ #end
62
+
63
+ # By default all generated output will end up in ./output.
64
+ # Here you can specify an alternative directory entirely, or make it dynamic such that
65
+ # the output ends up in a setup specific directory.
66
+ #config.output_directory do
67
+ # "#{Origen.root}/output/#{$dut.class}"
68
+ #end
69
+
70
+ # Similarly for the reference files, generally you want to setup the reference directory
71
+ # structure to mirror that of your output directory structure.
72
+ #config.reference_directory do
73
+ # "#{Origen.root}/.ref/#{$dut.class}"
74
+ #end
75
+
76
+ def before_release_tag(identifier, note, type, selector, options)
77
+ v = Origen::VersionString.new(identifier)
78
+ # Update the version in the C code
79
+ f = "#{Origen.app.rc.root}/v93k/src/origen/origen.hpp"
80
+ data = File.read(f)
81
+ filtered_data = data.sub(/#define ORIGEN_VERSION \"\d+\.\d+\.\d+\"/, "#define ORIGEN_VERSION \"#{v}\"")
82
+ File.open(f, "w") do |f|
83
+ f.write(filtered_data)
84
+ end
85
+ Origen.app.rc.checkin f, comment: "Wrote new version in C++ code"
86
+ end
87
+
88
+ # This will automatically deploy your documentation after every tag
89
+ def after_release_email(tag, note, type, selector, options)
90
+ command = "origen web compile --remote --api"
91
+ Dir.chdir Origen.root do
92
+ system command
93
+ end
94
+ end
95
+
96
+ # Ensure that all tests pass before allowing a release to continue
97
+ def validate_release
98
+ if !system("origen examples")
99
+ puts "Sorry but you can't release with failing tests, please fix them and try again."
100
+ exit 1
101
+ else
102
+ puts "All tests passing, proceeding with release process!"
103
+ end
104
+ end
105
+
106
+ # To enabled source-less pattern generation create a class (for example PatternDispatcher)
107
+ # to generate the pattern. This should return false if the requested pattern has been
108
+ # dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
109
+ #def before_pattern_lookup(requested_pattern)
110
+ # PatternDispatcher.new.dispatch_or_return(requested_pattern)
111
+ #end
112
+
113
+ # If you use pattern iterators you may come across the case where you request a pattern
114
+ # like this:
115
+ # origen g example_pat_b0.atp
116
+ #
117
+ # However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
118
+ # In the case where the pattern cannot be found Origen will pass the name to this translator
119
+ # if it exists, and here you can make any substitutions to help Origen find the file you
120
+ # want. In this example any instances of _b\d, where \d means a number, are replaced by
121
+ # _bx.
122
+ #config.pattern_name_translator do |name|
123
+ # name.gsub(/_b\d/, "_bx")
124
+ #end
125
+
126
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,24 @@
1
+ # This file is used to boot your plugin when it is running in standalone mode
2
+ # from its own workspace - i.e. when the plugin is being developed.
3
+ #
4
+ # It will not be loaded when the plugin is imported by a 3rd party app - in that
5
+ # case only lib/origen_std_lib.rb is loaded.
6
+ #
7
+ # Therefore this file can be used to load anything extra that you need to boot
8
+ # the development environment for this app. For example, this is typically used
9
+ # to load some additional test classes to use your plugin APIs so that they can
10
+ # be tested and/or interacted with in the console.
11
+ require "origen_std_lib"
12
+
13
+ module OrigenStdLibDev
14
+ # Example of how to explicitly require a file
15
+ # require "origen_std_lib_dev/my_file"
16
+
17
+ # Load all files in the lib/origen_std_lib_dev directory.
18
+ # Note that there is no problem from requiring a file twice (Ruby will ignore
19
+ # the second require), so if you have a file that must be required first, then
20
+ # explicitly require it up above and then let this take care of the rest.
21
+ Dir.glob("#{File.dirname(__FILE__)}/../lib/origen_std_lib_dev/**/*.rb").sort.each do |file|
22
+ require file
23
+ end
24
+ end
@@ -0,0 +1,60 @@
1
+ # This file should be used to extend the origen with application specific commands
2
+
3
+ # Map any command aliases here, for example to allow 'origen ex' to refer to a
4
+ # command called execute you would add a reference as shown below:
5
+ aliases ={
6
+ # "ex" => "execute",
7
+ }
8
+
9
+ # The requested command is passed in here as @command, this checks it against
10
+ # the above alias table and should not be removed.
11
+ @command = aliases[@command] || @command
12
+
13
+ # Now branch to the specific task code
14
+ case @command
15
+
16
+ ## Example of how to make a command to run unit tests, this simply invokes RSpec on
17
+ ## the spec directory
18
+ #when "specs"
19
+ # require "rspec"
20
+ # exit RSpec::Core::Runner.run(['spec'])
21
+
22
+ # Example of how to make a command to run diff-based tests
23
+ when "examples"
24
+ Origen.load_application
25
+ status = 0
26
+
27
+ # Program generator tests
28
+ ARGV = %w(program/prb1.rb -t default -e v93k -r approved)
29
+ load "#{Origen.top}/lib/origen/commands/program.rb"
30
+
31
+ if Origen.app.stats.changed_files == 0 &&
32
+ Origen.app.stats.new_files == 0 &&
33
+ Origen.app.stats.changed_patterns == 0 &&
34
+ Origen.app.stats.new_patterns == 0
35
+
36
+ Origen.app.stats.report_pass
37
+ else
38
+ Origen.app.stats.report_fail
39
+ status = 1
40
+ end
41
+ puts
42
+ if @command == "test"
43
+ Origen.app.unload_target!
44
+ require "rspec"
45
+ result = RSpec::Core::Runner.run(['spec'])
46
+ status = status == 1 ? 1 : result
47
+ end
48
+ exit status # Exit with a 1 on the event of a failure per std unix result codes
49
+
50
+ # Always leave an else clause to allow control to fall back through to the
51
+ # Origen command handler.
52
+ else
53
+ # You probably want to also add the your commands to the help shown via
54
+ # origen -h, you can do this be assigning the required text to @application_commands
55
+ # before handing control back to Origen. Un-comment the example below to get started.
56
+ @application_commands = <<-EOT
57
+ examples Run the examples (tests), -c will enable coverage
58
+ EOT
59
+
60
+ end
data/config/version.rb ADDED
@@ -0,0 +1,8 @@
1
+ module OrigenStdLib
2
+ MAJOR = 0
3
+ MINOR = 3
4
+ BUGFIX = 0
5
+ DEV = nil
6
+
7
+ VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
+ end
@@ -0,0 +1,45 @@
1
+ module OrigenStdLib
2
+ def self.add_v93k_std_lib(i)
3
+ i.add_tml :origen,
4
+ class_name: 'origen_tml',
5
+
6
+ functional_test: {
7
+ },
8
+
9
+ dc_measurement: {
10
+ class_name: 'DCMeasurement',
11
+
12
+ apply_shutdown: [:integer, 1],
13
+ shutdown_pattern: [:string, nil],
14
+ measure: [:string, 'VOLT', %w(VOLT CURR v i voltage current)],
15
+ settling_time: [:double, 0],
16
+ pin: [:string, nil],
17
+ force_value: [:double, 0],
18
+ i_range: [:integer, nil],
19
+ methods: {
20
+ finalize: lambda do |tm|
21
+ # Clean up the measurement type parameter
22
+ if tm.measure == 'v' || tm.measure == 'voltage'
23
+ tm.measure = 'VOLT'
24
+ elsif tm.measure == 'i' || tm.measure == 'current'
25
+ tm.measure = 'CURR'
26
+ end
27
+ tm.measure = tm.measure.upcase # In case 'volt' entered
28
+
29
+ # Calculate an autorange if not supplied for current meas
30
+ if tm.measure == 'CURR' && !tm.i_range
31
+ max = [tm.limits.lo.to_f.abs, tm.limits.hi.to_f.abs].max
32
+ tm.i_range = max
33
+ end
34
+ end
35
+ }
36
+ },
37
+
38
+ frequency_measurement: {
39
+ period_based: [:integer, 0],
40
+ pin: [:string, nil],
41
+ samples: [:integer, 2000],
42
+ period_in_ns: [:integer, nil]
43
+ }
44
+ end
45
+ end
@@ -0,0 +1,26 @@
1
+ require 'origen'
2
+ require_relative '../config/application.rb'
3
+ require 'origen_testers'
4
+ module OrigenStdLib
5
+ # THIS FILE SHOULD ONLY BE USED TO LOAD RUNTIME DEPENDENCIES
6
+ # If this plugin has any development dependencies (e.g. dummy DUT or other models that are only used
7
+ # for testing), then these should be loaded from config/boot.rb
8
+
9
+ # Example of how to explicitly require a file
10
+ # require "origen_std_lib/my_file"
11
+
12
+ # Load all files in the lib/origen_std_lib directory.
13
+ # Note that there is no problem from requiring a file twice (Ruby will ignore
14
+ # the second require), so if you have a file that must be required first, then
15
+ # explicitly require it up above and then let this take care of the rest.
16
+ Dir.glob("#{File.dirname(__FILE__)}/origen_std_lib/**/*.rb").sort.each do |file|
17
+ require file
18
+ end
19
+
20
+ def initialize(*args)
21
+ super
22
+ if tester.v93k?
23
+ OrigenStdLib.add_v93k_std_lib(self)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ module OrigenStdLibDev
2
+ class DUT
3
+ include Origen::TopLevel
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ require 'origen_std_lib'
2
+ module OrigenStdLibDev
3
+ class Interface
4
+ include OrigenTesters::ProgramGenerators
5
+ include OrigenStdLib
6
+
7
+ def func(name)
8
+ i = test_suites.add(name)
9
+ i.test_method = test_methods.origen.functional_test
10
+ flow.test(i)
11
+ end
12
+
13
+ def dc_meas(name)
14
+ i = test_suites.add(name)
15
+ tm = test_methods.origen.dc_measurement
16
+ tm.apply_shutdown = 1
17
+ tm.shutdown_pattern = 'some_pattern'
18
+ tm.measure = 'CURR'
19
+ tm.settling_time = 100
20
+ tm.pin = 'SOME_PIN'
21
+ tm.force_value = 10.4
22
+ tm.i_range = 1000
23
+ tm.limits.lo = 1
24
+ tm.limits.hi = 2
25
+ i.test_method = tm
26
+ flow.test(i)
27
+ end
28
+
29
+ def freq_meas(name)
30
+ i = test_suites.add(name)
31
+ tm = test_methods.origen.frequency_measurement
32
+ tm.period_based = 1
33
+ tm.pin = 'PINA'
34
+ tm.samples = 4000
35
+ tm.period_in_ns = 40
36
+ tm.limits.lo = 1.Mhz
37
+ tm.limits.hi = 2.Mhz
38
+ i.test_method = tm
39
+ flow.test(i)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,6 @@
1
+ # You can define any Rake tasks to support your application here (or in any file
2
+ # ending in .rake in this directory).
3
+ #
4
+ # Rake (Ruby Make) is very useful for creating build scripts, see this short video
5
+ # for a quick introduction:
6
+ # http://railscasts.com/episodes/66-custom-rake-tasks
data/program/prb1.rb ADDED
@@ -0,0 +1,5 @@
1
+ Flow.create interface: "OrigenStdLibDev::Interface" do
2
+ func :test1
3
+ dc_meas :test2
4
+ freq_meas :test3
5
+ end
@@ -0,0 +1,21 @@
1
+ % render "layouts/basic.html" do
2
+
3
+ %# HTML tags can be embedded in mark down files if you want to do specific custom
4
+ %# formatting like this, but in most cases that is not required.
5
+ <h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ ### Purpose
8
+
9
+ This project provides a modern, standard test method library for the
10
+ Advantest V93000 tester that is freely available for anyone to use.
11
+
12
+ [See the FAQ](<%= path "faq" %>) for more background.
13
+
14
+ ### How To Install
15
+
16
+
17
+ ### How To Use
18
+
19
+
20
+
21
+ % end
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: <%= options[:title] || Origen.config.name %>
3
+ ---
4
+ <%= render "partials/navbar.html", tab: options[:tab] %>
5
+
6
+ <div class="row">
7
+ %# The markdown attribute is important if you are going to include content written
8
+ %# in markdown, without this is will be included verbatim
9
+ <div class="span12" markdown="1">
10
+ <%= yield %>
11
+
12
+ <%= disqus_comments %>
13
+
14
+ </div>
15
+ </div>
@@ -0,0 +1,23 @@
1
+ <nav class="navbar navbar-inverse navbar-fixed-top">
2
+ <div class="container">
3
+ <div class="navbar-header">
4
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
5
+ <span class="sr-only">Toggle navigation</span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ </button>
10
+ <a class="navbar-brand" href="<%= path "/" %>">Home</a>
11
+ </div>
12
+ <div id="navbar" class="collapse navbar-collapse">
13
+ <ul class="nav navbar-nav">
14
+ <li class="<%= options[:tab] == :faq ? 'active' : '' %>"><a href="<%= path "/faq" %>">FAQ</a></li>
15
+ <li class="<%= options[:tab] == :v93k ? 'active' : '' %>"><a href="<%= path "/v93k/annotated.html" %>">V93K</a></li>
16
+ <li class="<%= options[:tab] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
17
+ <li><a href="https://github.com/Origen-SDK/origen_std_lib">Github</a></li>
18
+ <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
19
+ </ul>
20
+ <%= import "origen/web/logo.html" %>
21
+ </div><!--/.nav-collapse -->
22
+ </div>
23
+ </nav>
@@ -0,0 +1,5 @@
1
+ % render "layouts/basic.html", tab: :release do
2
+
3
+ <%= render "#{Origen.root}/doc/history" %>
4
+
5
+ % end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: origen_std_lib
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen McGinty
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: origen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.29
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.29
27
+ - !ruby/object:Gem::Dependency
28
+ name: origen_testers
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.8.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.8.1
41
+ description:
42
+ email:
43
+ - stephen.mcginty@nxp.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - config/application.rb
49
+ - config/boot.rb
50
+ - config/commands.rb
51
+ - config/version.rb
52
+ - lib/origen_std_lib.rb
53
+ - lib/origen_std_lib/v93k.rb
54
+ - lib/origen_std_lib_dev/dut.rb
55
+ - lib/origen_std_lib_dev/interface.rb
56
+ - lib/tasks/origen_std_lib.rake
57
+ - program/prb1.rb
58
+ - templates/web/index.md.erb
59
+ - templates/web/layouts/_basic.html.erb
60
+ - templates/web/partials/_navbar.html.erb
61
+ - templates/web/release_notes.md.erb
62
+ homepage:
63
+ licenses: []
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '2'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 1.8.11
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.2.2
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Test program interface drivers for the Origen tester standard library
85
+ test_files: []