origen_core_support 0.1.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: 450f254bcce1cbb983a3e312dfcbe9bf8d987cbc
4
+ data.tar.gz: dd5d7cd86dbde165b06ad48550e47c23d4662947
5
+ SHA512:
6
+ metadata.gz: 6a9104bff352b49212e88736de8b1bde67872ab75d17d6f63fc6566ec4a6a7d148eab62d54e59cd99a41bd938575c5f13d0c49b1f8c4f4da8464058bf27671f9
7
+ data.tar.gz: 7c04b014230c5e038d50d1180cda80975cf14e8a3c7bf8d8fa38a13237a5f19e5ef10fc78224fc78bf76e370d7f60a4a0e2914d07de101509628f4b7eb2739cc
@@ -0,0 +1,55 @@
1
+ class OrigenCoreSupportApplication < Origen::Application
2
+ config.semantically_version = true
3
+
4
+ # This information is used in headers and email templates, set it specific
5
+ # to your application
6
+ config.name = "Origen Core Support"
7
+ config.initials = "OrigenCoreSupport"
8
+ config.rc_url = "ssh://git@github.com:Origen-SDK/origen_core_support.git"
9
+ config.shared = {
10
+ :patterns => "pattern/shared",
11
+ :command_launcher => "config/shared_commands.rb",
12
+ #:templates => "templates",
13
+ #:programs => "program"
14
+ }
15
+
16
+ # Versioning is based on a timestamp by default, if you would rather use semantic
17
+ # versioning, i.e. v1.0.0 format, then set this to true.
18
+ # In parallel go and edit config/version.rb to enable the semantic version code.
19
+ #config.semantically_version = true
20
+
21
+ # You can map moo numbers to targets here, this allows targets to be selected via
22
+ # origen t <moo>
23
+ #config.production_targets = {
24
+ # "1m79x" => "pioneer_1_production",
25
+ #}
26
+
27
+ # Specify a specific version of origen that must be used with this application, origen
28
+ # will then enforce that every user's origen version is correct at runtime
29
+ #config.required_origen_version = "v2.0.0"
30
+
31
+ # An example of how to set application specific LSF parameters
32
+ #config.lsf.project = "msg.te"
33
+
34
+ # An example of how to specify a prefix to add to all generated patterns
35
+ #config.pattern_prefix = "nvm"
36
+
37
+ # An example of how to add header comments to all generated patterns
38
+ #config.pattern_header do
39
+ # cc "This is a pattern created by the example origen application"
40
+ #end
41
+
42
+ # By default all generated output will end up in ./output.
43
+ # Here you can specify an alternative directory entirely, or make it dynamic such that
44
+ # the output ends up in a setup specific directory.
45
+ #config.output_directory do
46
+ # "#{Origen.root}/output/#{$dut.class}"
47
+ #end
48
+
49
+ # Similarly for the reference files, generally you want to setup the reference directory
50
+ # structure to mirror that of your output directory structure.
51
+ #config.reference_directory do
52
+ # "#{Origen.root}/.ref/#{$dut.class}"
53
+ #end
54
+
55
+ end
@@ -0,0 +1,39 @@
1
+ # This file should be used to extend the origen command line tool with tasks
2
+ # specific to your application.
3
+ # The comments below should help to get started and you can also refer to
4
+ # lib/origen/commands.rb in your Origen core workspace for more examples and
5
+ # inspiration.
6
+
7
+ # Map any command aliases here, for example to allow origen -x to refer to a
8
+ # command called execute you would add a reference as shown below:
9
+ aliases ={
10
+ # "-x" => "execute",
11
+ }
12
+
13
+ # The requested command is passed in here as @command, this checks it against
14
+ # the above alias table and should not be removed.
15
+ @command = aliases[@command] || @command
16
+
17
+ # Now branch to the specific task code
18
+ case @command
19
+
20
+ # Here is an example of how to implement a command, the logic can go straight
21
+ # in here or you can require an external file if preferred.
22
+ when "execute"
23
+ puts "Executing something..."
24
+ require "commands/execute" # Would load file lib/commands/execute.rb
25
+ # You must always exit upon successfully capturing a command to prevent
26
+ # control flowing back to Origen
27
+ exit 0
28
+
29
+ # Always leave an else clause to allow control to fall back through to the
30
+ # Origen command handler.
31
+ # You probably want to also add the command details to the help shown via
32
+ # origen -h, you can do this be assigning the required text to @application_commands
33
+ # before handing control back to Origen. Un-comment the example below to get started.
34
+ else
35
+ # @application_commands = <<-EOT
36
+ # execute Execute something I guess
37
+ # EOT
38
+ require "#{Origen.app_root}/config/shared_commands"
39
+ end
@@ -0,0 +1,19 @@
1
+ # This file will be required by Origen before your target is loaded, you
2
+ # can use this to require all of your files, which is the easiest way
3
+ # to get started. As your experience grows you may wish to require only the
4
+ # minimum files required to allow the target to be initialized and let
5
+ # each class require its own dependencies.
6
+ #
7
+ # It is recommended that you keep all of your application logic in lib/
8
+ # The lib directory has already been added to the search path and so any files
9
+ # in there can be referenced from here with a relative path.
10
+ #
11
+ # Note that pattern files do not need to be referenced from here and these
12
+ # will be located automatically by origen.
13
+
14
+ #autoload :Pioneer, "pioneer" # Only loads the file whenever Pioneer is referenced
15
+ #require "pioneer" # Loads the file always
16
+
17
+ require "c99/soc"
18
+ require "c99/nvm"
19
+ require "c99/block"
@@ -0,0 +1,32 @@
1
+ # This file is created to share commands of this plugin to any app that imports it.
2
+
3
+ # Map any command aliases here, for example to allow origen -x to refer to a
4
+ # command called execute you would add a reference as shown below:
5
+ aliases ={
6
+
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
+ # in here or you can require an external file if preferred.
16
+ when "test"
17
+ require "commands/test_command"
18
+ exit 0
19
+
20
+ # Always leave an else clause to allow control to fall back through to the
21
+ # Origen command handler.
22
+ # You probably want to also add the command details to the help shown via
23
+ # origen -h, you can do this be assigning the required text to @application_commands
24
+ # before handing control back to Origen. Un-comment the example below to get started.
25
+ else
26
+ @plugin_commands ||= []
27
+ @plugin_commands = @plugin_commands +
28
+ [
29
+ " test Test command from plugin core_support plugin"
30
+ ]
31
+ end
32
+
data/config/users.rb ADDED
@@ -0,0 +1,22 @@
1
+ # This file defines the users associated with your project, it is basically the
2
+ # mailing list for release notes.
3
+ #
4
+ # You can split your users into "admin" and "user" groups, the main difference
5
+ # between the two is that admin users will get all tag emails, users will get
6
+ # emails on external/official releases only.
7
+ #
8
+ # Users are also prohibited from running the "origen tag" task, but this is
9
+ # really just to prevent a casual user from executing it inadvertently and is
10
+ # not intended to be a serious security gate.
11
+ module Origen
12
+ module Users
13
+ def users
14
+ @users ||= [
15
+
16
+ # Admins
17
+ User.new("Stephen McGinty", "r49409", :admin),
18
+
19
+ ]
20
+ end
21
+ end
22
+ end
data/config/version.rb ADDED
@@ -0,0 +1,8 @@
1
+ module OrigenCoreSupport
2
+ MAJOR = 0
3
+ MINOR = 1
4
+ BUGFIX = 0
5
+ DEV = nil
6
+
7
+ VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
+ end
data/lib/c99/block.rb ADDED
@@ -0,0 +1,19 @@
1
+ module C99
2
+ class Block
3
+ attr_accessor :id, :selected
4
+
5
+ def initialize(id, owner)
6
+ @id = id
7
+ @selected = false
8
+ @owner = owner
9
+ end
10
+
11
+ def select
12
+ @selected = true
13
+ end
14
+
15
+ def owner
16
+ @owner
17
+ end
18
+ end
19
+ end
data/lib/c99/nvm.rb ADDED
@@ -0,0 +1,37 @@
1
+ module C99
2
+ class NVM
3
+
4
+ attr_accessor :blocks
5
+
6
+ include Origen::Pins
7
+ include Origen::Registers
8
+
9
+ def initialize
10
+
11
+ add_reg :mclkdiv, 0x03, 16, :osch => { :pos => 15 },
12
+ :asel => { :pos => 14 },
13
+ :failctl => { :pos => 13 },
14
+ :parsel => { :pos => 12 },
15
+ :eccen => { :pos => 11 },
16
+ :cmdloc => { :pos => 8, :bits => 3, :res => 0b001 },
17
+ :clkdiv => { :pos => 0, :bits => 8, :res => 0x18 }
18
+
19
+ add_reg :data, 0x4, 16, :d => { :pos => 0, :bits => 16 }
20
+
21
+ @blocks = [Block.new(0, self), Block.new(1, self), Block.new(2, self)]
22
+ end
23
+
24
+ def find_block_by_id(id)
25
+ @blocks.select{ |block| block.id == id }.first
26
+ end
27
+
28
+ def override_method
29
+ :original
30
+ end
31
+
32
+ def reg_owner_alias
33
+ ["flash", "fmu"]
34
+ end
35
+
36
+ end
37
+ end
data/lib/c99/soc.rb ADDED
@@ -0,0 +1,80 @@
1
+ module C99
2
+ class SOC
3
+ include Origen::Callbacks
4
+ include Origen::Pins
5
+ include Origen::TopLevel
6
+
7
+ def initialize
8
+
9
+ add_pin :reset, :reset => :drive_hi, :name => "nvm_reset"
10
+ add_pin :clk, :reset => :drive_hi, :name => "nvm_clk"
11
+ add_pin :clk_mux, :reset => :drive_hi, :name => "nvm_clk_mux"
12
+ add_port :porta, :reset => :drive_lo, :size => 8
13
+ add_port :portb, :reset => :drive_lo, :size => 8, :endian => :little
14
+ add_pin :invoke, :reset => :drive_lo, :name => "nvm_invoke"
15
+ add_pin :done, :reset => :expect_hi, :name => "nvm_done"
16
+ add_pin :fail, :reset => :expect_lo, :name => "nvm_fail"
17
+ add_pin :alvtst, :reset => :dont_care, :name => "nvm_alvtst"
18
+ add_pin :ahvtst, :reset => :dont_care, :name => "nvm_ahvtst"
19
+ add_pin :dtst, :reset => :dont_care, :name => "nvm_dtst"
20
+
21
+ add_pin :tclk, :reset => :drive_lo
22
+ add_pin :trst, :reset => :drive_hi
23
+
24
+ add_pin_alias :extal, :clk
25
+ add_pin_alias :extal_mux, :clk_mux
26
+ add_pin_alias :tms, :done
27
+ add_pin_alias :tdo, :fail
28
+ add_pin_alias :tdi, :invoke
29
+ add_pin_alias :resetb, :ahvtst
30
+
31
+ add_pin_alias :pa5, :porta, :pin => 5
32
+ add_pin_alias :pa_lower, :porta, :pins => [3..0]
33
+ add_pin_alias :pa_upper, :porta, :pins => [7,6,5,4]
34
+ add_port_alias :porta_alias, :porta
35
+
36
+ @a = 2
37
+ end
38
+
39
+ def startup(options)
40
+ if options[:add_additional_pins]
41
+ add_pin :late_added_pin, :reset => :drive_hi
42
+ else
43
+ # Test that rendering some vectors from a template works...
44
+ if $tester.is_a?(Origen::Tester::J750) || $tester.is_a?(Testers::J750)
45
+ $tester.render("#{Origen.root}/pattern/j750/_mode_entry.atp.erb", :hold_cycles => 5)
46
+ end
47
+ end
48
+ $tester.set_timeset("nvmbist", 40) if $tester.is_vector_based?
49
+ end
50
+
51
+ def has_margin0_bug?
52
+ false
53
+ end
54
+
55
+ def write_register(reg, options={})
56
+ reg
57
+ end
58
+
59
+ def read_register(reg, options={})
60
+ reg
61
+ end
62
+
63
+ def base_address(reg, options={})
64
+ if reg.owned_by?(:nvm)
65
+ 0x4000_0000
66
+ else
67
+ 0
68
+ end
69
+ end
70
+
71
+ def origen_dot_root
72
+ Origen.root
73
+ end
74
+
75
+ def origen_dot_root!
76
+ Origen.root!
77
+ end
78
+
79
+ end
80
+ end
@@ -0,0 +1,18 @@
1
+ puts <<-EOT
2
+ This is a test command to test the command sharing capability of plugins.
3
+
4
+ You can now write commands in plugins which can be called from any app that
5
+ includes the plugin.
6
+
7
+ For the app to add your command in it's own command list, share your shared_commands.rb file in
8
+ config.shared hash as follows:
9
+
10
+ config.shared = {
11
+
12
+ :command_launcher => "config/shared_commands.rb"
13
+
14
+ }
15
+
16
+ EOT
17
+
18
+
@@ -0,0 +1,2 @@
1
+ require_relative "../config/application.rb"
2
+ require_relative "../config/environment.rb"
@@ -0,0 +1,159 @@
1
+ # This pattern exercises the methods in the Origen::Tester::J750 class
2
+ Pattern.create(:end_with_halt => true) do
3
+
4
+ ss "Test that basic cycling works"
5
+ $tester.cycle
6
+ 10.times do
7
+ $nvm.pin(:invoke).drive(1)
8
+ $tester.cycle
9
+ end
10
+ 10.times do |i|
11
+ $nvm.pin(:invoke).drive(i.even? ? 0 : 1)
12
+ $tester.cycle
13
+ end
14
+
15
+ ss "Test that basic port manipulation works"
16
+ if !$tester.respond_to?('hpt_mode')
17
+ $nvm.port(:porta).drive(0x55)
18
+ $tester.cycle
19
+ $nvm.port(:porta).expect(0xAA)
20
+ $tester.cycle
21
+ $nvm.port(:porta)[1].dont_care
22
+ $tester.cycle
23
+ end
24
+
25
+ ss "Test that the store method works"
26
+ cc "This vector should be stored"
27
+ $tester.cycle
28
+ $tester.store
29
+ $tester.cycle
30
+ cc "This vector should be stored"
31
+ $tester.cycle
32
+ $tester.cycle
33
+ $tester.cycle
34
+ $tester.store(:offset => -2)
35
+
36
+ ss "Test calling a subroutine"
37
+ cc "This vector should call subroutine 'sub1'"
38
+ $tester.cycle
39
+ $tester.call_subroutine("sub1")
40
+ cc "This vector should call subroutine 'sub2'"
41
+ $tester.cycle
42
+ $tester.cycle
43
+ $tester.call_subroutine("sub2", :offset => -1)
44
+ cc "This vector should call subroutine 'sub3', however because"
45
+ cc "it is local it should not appear in the imports in the header"
46
+ $tester.cycle
47
+ $tester.call_subroutine("sub3")
48
+
49
+ ss "Test generating a handshake inside a subroutine"
50
+ cc "The next line should have a global label 'sub3', but no vector"
51
+ $tester.start_subroutine("sub3")
52
+ $tester.handshake
53
+ cc "This vector should have a return statement"
54
+ $tester.cycle
55
+ $tester.end_subroutine
56
+
57
+ ss "Test generating a handshake with a readcode"
58
+ $tester.handshake(:readcode => 10)
59
+
60
+ ss "Test frequency counter"
61
+ $tester.freq_count($nvm.pin(:dtst), :readcode => 33)
62
+
63
+ ss "Test a single pin match loop"
64
+ $tester.wait(:match => true, :time_in_us => 5000, :pin => $nvm.pin(:done), :state => :high)
65
+
66
+ ss "Test a two pin match loop"
67
+ $tester.wait(:match => true, :time_in_us => 5000,
68
+ :pin => $nvm.pin(:done), :state => :high,
69
+ :pin2 => $nvm.pin(:fail), :state2 => :low)
70
+
71
+ ss "Test adding an arbitrary label"
72
+ $tester.cycle
73
+ $tester.label "a_test_label"
74
+ $tester.cycle
75
+
76
+ ss "Test calling a match loop"
77
+ $tester.cycle
78
+ $tester.call_match
79
+ $tester.cycle
80
+ $tester.call_match
81
+
82
+ ss "Test setting the readcode to 100"
83
+ $tester.set_code(100)
84
+
85
+ ss "Test explicit branching"
86
+ $tester.branch_to("somewhere")
87
+
88
+ if !$tester.respond_to?('hpt_mode')
89
+ ss "Test looping, these vectors should be executed once"
90
+ $tester.loop_vector("test_loop_1", 1) do
91
+ $nvm.port(:porta).drive(0xAA)
92
+ $tester.cycle
93
+ $nvm.port(:porta).drive(0x55)
94
+ $tester.cycle
95
+ end
96
+
97
+ ss "Test looping, these vectors should be executed 3 times"
98
+ $tester.loop_vector("test_loop_2", 3) do
99
+ $nvm.port(:porta).drive(0xAA)
100
+ $tester.cycle
101
+ $nvm.port(:porta).drive(0x55)
102
+ $tester.cycle
103
+ end
104
+ else
105
+ ss "Test looping, these vectors should be executed once"
106
+ $tester.loop_vector("test_loop_1", 1) do
107
+ $nvm.pin(:clk).drive(1)
108
+ $tester.cycle
109
+ $nvm.pin(:clk).drive(0)
110
+ $tester.cycle
111
+ end
112
+
113
+ ss "Test looping, these vectors should be executed 3 times"
114
+ $tester.loop_vector("test_loop_2", 3) do
115
+ $nvm.pin(:clk).drive(1)
116
+ $tester.cycle
117
+ $nvm.pin(:clk).drive(0)
118
+ $tester.cycle
119
+ end
120
+ end
121
+
122
+ ss "Test repeat_previous"
123
+ $tester.cycle
124
+ cc "Invoke should repeat previous for 10 cycles"
125
+ $nvm.pin(:invoke).repeat_previous = true
126
+ 10.cycles
127
+ $nvm.pin(:invoke).repeat_previous = false
128
+ cc "All pins should repeat previous for 10 cycles, except the clk pin"
129
+ $tester.repeat_previous do
130
+ $nvm.pin(:clk).drive(1)
131
+ 10.cycles
132
+ end
133
+ cc "All should return to the original state"
134
+ $tester.cycle
135
+
136
+ ss "Test suspend compares"
137
+ $nvm.pin(:fail).assert!(1)
138
+ cc "The fail pin should not be compared on these vectors"
139
+ $tester.ignore_fails($nvm.pin(:fail)) do
140
+ 10.cycles
141
+ end
142
+ cc "And now it should"
143
+ $tester.cycle
144
+
145
+ ss "Test inhibit vectors and comments"
146
+ cc "The invoke pin should be driving high on this cycle"
147
+ $nvm.pin(:invoke).drive!(1)
148
+ cc "This should be the last thing you see until 'Inhibit complete!'"
149
+ $tester.inhibit_vectors_and_comments do
150
+ cc "This should not be in the output file, or the following vectors"
151
+ $tester.cycle
152
+ $nvm.pin(:invoke).drive!(0)
153
+ 10.cycles
154
+ end
155
+ cc "Inhibit complete!"
156
+ cc "The invoke pin should be driving low on this cycle"
157
+ $tester.cycle
158
+
159
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: origen_core_support
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen McGinty
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-22 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'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ - stephen.f.mcginty@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - config/application.rb
35
+ - config/commands.rb
36
+ - config/environment.rb
37
+ - config/shared_commands.rb
38
+ - config/users.rb
39
+ - config/version.rb
40
+ - lib/c99/block.rb
41
+ - lib/c99/nvm.rb
42
+ - lib/c99/soc.rb
43
+ - lib/commands/test_command.rb
44
+ - lib/origen_core_support.rb
45
+ - pattern/shared/j750/j750_halt.rb
46
+ homepage:
47
+ licenses:
48
+ - LGPL-3
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 1.9.3
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.8.11
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.2.2
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: A simple plugin that is used to test the Origen SDK plugin system
70
+ test_files: []