origen_svf 0.2.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: 1bb5b824cb644b52080ffddc04613d9827465ecb
4
+ data.tar.gz: 7cae99545002ab896e0bcf5b7bec1171316a36df
5
+ SHA512:
6
+ metadata.gz: b34127b8fa03a714e4ea36774c63e9e9f2055702bfdc455a0f5e7a3daa6f75556f04012f1fd75fda46cc970cfc185a5e777fa4463923366ef3ed8e733a8db6ea
7
+ data.tar.gz: 4b9d055cea13e319472967da0a9586eccb9d905d0d5f064d2c47ed186ddf67898edc59c7efb487a0c085bcc89d84c8ded7d245c3b442a9e2cd8fb1045fc71055
@@ -0,0 +1,103 @@
1
+ require 'origen'
2
+ class OrigenSVFApplication < 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_svf"
10
+ self.namespace = "OrigenSVF"
11
+ config.name = "origen_svf"
12
+ config.initials = "OrigenSVF"
13
+ # Change this to point to the revision control repository for this plugin
14
+ config.rc_url = "ssh://git@github.com:Origen-SDK/origen_svf.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/svf"
20
+ config.web_domain = "http://origen-sdk.org/svf"
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
+ # An example of how to set application specific LSF parameters
42
+ #config.lsf.project = "msg.te"
43
+
44
+ # An example of how to specify a prefix to add to all generated patterns
45
+ #config.pattern_prefix = "nvm"
46
+
47
+ # An example of how to add header comments to all generated patterns
48
+ #config.pattern_header do
49
+ # cc "This is a pattern created by the example origen application"
50
+ #end
51
+
52
+ # By default all generated output will end up in ./output.
53
+ # Here you can specify an alternative directory entirely, or make it dynamic such that
54
+ # the output ends up in a setup specific directory.
55
+ #config.output_directory do
56
+ # "#{Origen.root}/output/#{$dut.class}"
57
+ #end
58
+
59
+ # Similarly for the reference files, generally you want to setup the reference directory
60
+ # structure to mirror that of your output directory structure.
61
+ #config.reference_directory do
62
+ # "#{Origen.root}/.ref/#{$dut.class}"
63
+ #end
64
+
65
+ # This will automatically deploy your documentation after every tag
66
+ def after_release_email(tag, note, type, selector, options)
67
+ command = "origen web compile --remote --api"
68
+ Dir.chdir Origen.root do
69
+ system command
70
+ end
71
+ end
72
+
73
+ # Ensure that all tests pass before allowing a release to continue
74
+ #def validate_release
75
+ # if !system("origen specs") || !system("origen examples")
76
+ # puts "Sorry but you can't release with failing tests, please fix them and try again."
77
+ # exit 1
78
+ # else
79
+ # puts "All tests passing, proceeding with release process!"
80
+ # end
81
+ #end
82
+
83
+ # To enabled source-less pattern generation create a class (for example PatternDispatcher)
84
+ # to generate the pattern. This should return false if the requested pattern has been
85
+ # dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
86
+ #def before_pattern_lookup(requested_pattern)
87
+ # PatternDispatcher.new.dispatch_or_return(requested_pattern)
88
+ #end
89
+
90
+ # If you use pattern iterators you may come across the case where you request a pattern
91
+ # like this:
92
+ # origen g example_pat_b0.atp
93
+ #
94
+ # However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
95
+ # In the case where the pattern cannot be found Origen will pass the name to this translator
96
+ # if it exists, and here you can make any substitutions to help Origen find the file you
97
+ # want. In this example any instances of _b\d, where \d means a number, are replaced by
98
+ # _bx.
99
+ #config.pattern_name_translator do |name|
100
+ # name.gsub(/_b\d/, "_bx")
101
+ #end
102
+
103
+ 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_svf.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_svf"
12
+
13
+ module OrigenSVFDev
14
+ # Example of how to explicitly require a file
15
+ # require "origen_svf_dev/my_file"
16
+
17
+ # Load all files in the lib/origen_svf_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_svf_dev/**/*.rb").sort.each do |file|
22
+ require file
23
+ end
24
+ end
@@ -0,0 +1,74 @@
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
+ # Here is an example of how to implement a command, the logic can go straight
17
+ # in here or you can require an external file if preferred.
18
+ when "my_command"
19
+ puts "Doing something..."
20
+ #require "commands/my_command" # Would load file lib/commands/my_command.rb
21
+ # You must always exit upon successfully capturing a command to prevent
22
+ # control flowing back to Origen
23
+ exit 0
24
+
25
+ ## Example of how to make a command to run unit tests, this simply invokes RSpec on
26
+ ## the spec directory
27
+ #when "specs"
28
+ # require "rspec"
29
+ # exit RSpec::Core::Runner.run(['spec'])
30
+
31
+ ## Example of how to make a command to run diff-based tests
32
+ #when "examples", "test"
33
+ # Origen.load_application
34
+ # status = 0
35
+ #
36
+ # # Compiler tests
37
+ # ARGV = %w(templates/example.txt.erb -t debug -r approved)
38
+ # load "origen/commands/compile.rb"
39
+ # # Pattern generator tests
40
+ # #ARGV = %w(some_pattern -t debug -r approved)
41
+ # #load "#{Origen.top}/lib/origen/commands/generate.rb"
42
+ #
43
+ # if Origen.app.stats.changed_files == 0 &&
44
+ # Origen.app.stats.new_files == 0 &&
45
+ # Origen.app.stats.changed_patterns == 0 &&
46
+ # Origen.app.stats.new_patterns == 0
47
+ #
48
+ # Origen.app.stats.report_pass
49
+ # else
50
+ # Origen.app.stats.report_fail
51
+ # status = 1
52
+ # end
53
+ # puts
54
+ # if @command == "test"
55
+ # Origen.app.unload_target!
56
+ # require "rspec"
57
+ # result = RSpec::Core::Runner.run(['spec'])
58
+ # status = status == 1 ? 1 : result
59
+ # end
60
+ # exit status # Exit with a 1 on the event of a failure per std unix result codes
61
+
62
+ # Always leave an else clause to allow control to fall back through to the
63
+ # Origen command handler.
64
+ else
65
+ # You probably want to also add the your commands to the help shown via
66
+ # origen -h, you can do this be assigning the required text to @application_commands
67
+ # before handing control back to Origen. Un-comment the example below to get started.
68
+ # @application_commands = <<-EOT
69
+ # specs Run the specs (tests), -c will enable coverage
70
+ # examples Run the examples (tests), -c will enable coverage
71
+ # test Run both specs and examples, -c will enable coverage
72
+ # EOT
73
+
74
+ end
data/config/version.rb ADDED
@@ -0,0 +1,8 @@
1
+ module OrigenSVF
2
+ MAJOR = 0
3
+ MINOR = 2
4
+ BUGFIX = 0
5
+ DEV = nil
6
+
7
+ VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
+ end
data/lib/origen_svf.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'origen'
2
+ require_relative '../config/application.rb'
3
+ require 'origen_testers'
4
+ module OrigenSVF
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
+ require 'origen_svf/tester'
9
+ require 'origen_svf/origen_testers/api'
10
+ end
@@ -0,0 +1,8 @@
1
+ require 'origen_testers/api'
2
+ module OrigenTesters
3
+ module API
4
+ def svf?
5
+ is_a?(OrigenSVF::Tester)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,126 @@
1
+ module OrigenSVF
2
+ class Tester
3
+ include OrigenTesters::VectorBasedTester
4
+
5
+ def initialize
6
+ @pat_extension = 'svf'
7
+ @compress = false
8
+ @comment_char = '//'
9
+ end
10
+
11
+ def subdirectory
12
+ 'svf'
13
+ end
14
+
15
+ def pattern_header(options = {})
16
+ microcode 'PIOMAP ('
17
+ ordered_pins.each do |pin|
18
+ if pin.direction == :input
19
+ l = 'IN'
20
+ elsif pin.direction == :output
21
+ l = 'OUT'
22
+ else
23
+ l = 'INOUT'
24
+ end
25
+ microcode " #{l} #{pin.name.upcase}"
26
+ end
27
+ microcode ');'
28
+ microcode ''
29
+ microcode 'TRST ABSENT;'
30
+ microcode 'ENDIR IDLE;'
31
+ microcode 'ENDDR IDLE;'
32
+ end
33
+
34
+ def set_timeset(name, period_in_ns)
35
+ super
36
+ f = (1 / (period_in_ns / 1_000_000_000.0)).ceil
37
+ microcode "FREQUENCY #{f} HZ;"
38
+ end
39
+
40
+ def delay(cycles, options = {})
41
+ microcode "RUNTEST #{cycles} TCK;"
42
+ end
43
+
44
+ def write_ir(reg_or_val, options = {})
45
+ microcode "SIR #{size(reg_or_val, options)} TDI(#{data(reg_or_val)});"
46
+ end
47
+
48
+ def write_dr(reg_or_val, options = {})
49
+ microcode "SDR #{size(reg_or_val, options)} TDI(#{data(reg_or_val)});"
50
+ end
51
+
52
+ def read_ir(reg_or_val, options = {})
53
+ microcode "SIR #{size(reg_or_val, options)} TDO(#{data(reg_or_val)}) MASK(#{mask(reg_or_val, options)});"
54
+ end
55
+
56
+ def read_dr(reg_or_val, options = {})
57
+ microcode "SDR #{size(reg_or_val, options)} TDO(#{data(reg_or_val)}) MASK(#{mask(reg_or_val, options)});"
58
+ end
59
+
60
+ def pattern_footer(options = {})
61
+ end
62
+
63
+ def cycle(options = {})
64
+ v = ''
65
+ ordered_pins.each do |pin|
66
+ if pin.state == :dont_care
67
+ if pin.direction == :output
68
+ v += 'X'
69
+ else
70
+ v += 'Z'
71
+ end
72
+ elsif pin.state == :drive
73
+ if pin.data == 0
74
+ v += 'L'
75
+ else
76
+ v += 'H'
77
+ end
78
+ elsif pin.state == :compare
79
+ if pin.data == 0
80
+ v += 'D'
81
+ else
82
+ v += 'U'
83
+ end
84
+ else
85
+ fail "Unknown pin state: #{pin.state}"
86
+ end
87
+ end
88
+ microcode "PIO (#{v})"
89
+ delay(options[:repeat]) if options[:repeat] && options[:repeat] > 1
90
+ end
91
+
92
+ def microcode(str)
93
+ if str.length > 80
94
+ str.scan(/.{1,80}/).each do |line|
95
+ super(line)
96
+ end
97
+ else
98
+ super
99
+ end
100
+ end
101
+
102
+ private
103
+
104
+ def data(reg_or_val)
105
+ d = reg_or_val.respond_to?(:data) ? reg_or_val.data : reg_or_val
106
+ d.to_s(16).upcase
107
+ end
108
+
109
+ def mask(reg_or_val, options = {})
110
+ if reg_or_val.respond_to?(:shift_out_left)
111
+ v = 0
112
+ reg_or_val.shift_out_left do |bit|
113
+ v <<= 1
114
+ v |= 1 if bit.is_to_be_read?
115
+ end
116
+ v.to_s(16).upcase
117
+ else
118
+ ((1 << size(reg_or_val, options)) - 1).to_s(16).upcase
119
+ end
120
+ end
121
+
122
+ def size(reg_or_val, options = {})
123
+ options[:size] || reg_or_val.size
124
+ end
125
+ end
126
+ 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
@@ -0,0 +1,11 @@
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
+ % lines = File.readlines("#{Origen.root}/README.md")
8
+ % lines.shift # Lose the heading, we have our own here
9
+ <%= lines.join('') %>
10
+
11
+ % end
@@ -0,0 +1,13 @@
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
+ </div>
13
+ </div>
@@ -0,0 +1,20 @@
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] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
15
+ <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
16
+ </ul>
17
+ <%= import "origen/web/logo.html" %>
18
+ </div><!--/.nav-collapse -->
19
+ </div>
20
+ </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,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: origen_svf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen McGinty
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-10 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.36
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.36
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'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
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_svf.rb
53
+ - lib/origen_svf/origen_testers/api.rb
54
+ - lib/origen_svf/tester.rb
55
+ - lib/tasks/origen_svf.rake
56
+ - templates/web/index.md.erb
57
+ - templates/web/layouts/_basic.html.erb
58
+ - templates/web/partials/_navbar.html.erb
59
+ - templates/web/release_notes.md.erb
60
+ homepage: http://origen-sdk.org/svf
61
+ licenses: []
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '2'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.8.11
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Origen plugin to render JTAG-based patterns in Serial Vector Format (SVF)
83
+ test_files: []