origen_link 0.2.0.pre0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/start_link_server +66 -66
- data/config/application.rb +109 -109
- data/config/commands.rb +74 -74
- data/config/shared_commands.rb +40 -40
- data/config/version.rb +8 -8
- data/lib/origen_link.rb +4 -4
- data/lib/origen_link/callback_handlers.rb +13 -13
- data/lib/origen_link/capture_support.rb +94 -94
- data/lib/origen_link/configuration_commands.rb +84 -84
- data/lib/origen_link/listener.rb +78 -78
- data/lib/origen_link/server/jtag.rb +180 -180
- data/lib/origen_link/server/pin.rb +121 -121
- data/lib/origen_link/server/sequencer.rb +361 -361
- data/lib/origen_link/server_com.rb +150 -150
- data/lib/origen_link/test/top_level.rb +48 -48
- data/lib/origen_link/test/top_level_controller.rb +44 -44
- data/lib/origen_link/test/vector_based.rb +25 -25
- data/lib/origen_link/vector_based.rb +366 -365
- data/lib/tasks/origen_link.rake +6 -6
- data/pattern/example.rb +4 -4
- data/pattern/jtag_capture_id.rb +22 -22
- data/pattern/transaction_test.rb +18 -18
- data/templates/web/index.md.erb +25 -25
- data/templates/web/layouts/_basic.html.erb +13 -13
- data/templates/web/partials/_navbar.html.erb +20 -20
- data/templates/web/release_notes.md.erb +5 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1466528f6de1eb1b70731626991a685065ad6e0
|
4
|
+
data.tar.gz: 06d3028a38164e75078b9865ec5a2ff63fb0b422
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30db744c9d97bd49fe11988415c69b39ef9a71f14d54fb485209df8ca89247b7a2f52b1a917c93d74da167426d11dcb7a2a1d2da419e544e9bf1b40c94d6bcc2
|
7
|
+
data.tar.gz: cb73f596dc2fdfd691b31722a232e67c9969b0346520e142aaf511cf289eabad94a65e3e029324d5cfad6ac510bdd8ce7c86ca09e1ff4013e7c09799583b5023
|
data/bin/start_link_server
CHANGED
@@ -1,66 +1,66 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$LOAD_PATH.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib'))
|
3
|
-
require 'socket'
|
4
|
-
require 'origen_link/server/sequencer'
|
5
|
-
|
6
|
-
server = TCPServer.open('', 12_777)
|
7
|
-
puts 'server started'
|
8
|
-
pinsequencer = OrigenLink::Server::Sequencer.new
|
9
|
-
remoteuser = ''
|
10
|
-
remotehost = ''
|
11
|
-
sessionactivity = Time.now
|
12
|
-
sessionactive = false
|
13
|
-
|
14
|
-
loop do
|
15
|
-
client = server.accept
|
16
|
-
thisuser = client.gets.chomp
|
17
|
-
thisremotehost = client.peeraddr[3]
|
18
|
-
|
19
|
-
# for now assume that any session lasting longer than 20 minutes has timed out (will happen if the origen side app is killed or stopped at a breakpoint with no activity)
|
20
|
-
if (Time.now - sessionactivity) > 1200
|
21
|
-
sessionactive = false
|
22
|
-
end
|
23
|
-
|
24
|
-
change_in_user = false
|
25
|
-
|
26
|
-
# if there is no active session running allow one to start
|
27
|
-
unless sessionactive
|
28
|
-
#flag any change in host machine or user for collision detection
|
29
|
-
change_in_user = true unless (remoteuser.eql? thisuser) && (remotehost.eql? thisremotehost)
|
30
|
-
remoteuser = thisuser
|
31
|
-
remotehost = thisremotehost
|
32
|
-
end
|
33
|
-
|
34
|
-
# always return whether or not the user has been changed (for collision detection)
|
35
|
-
if change_in_user
|
36
|
-
response = "user_change:user_change\n"
|
37
|
-
else
|
38
|
-
response = "\n"
|
39
|
-
end
|
40
|
-
|
41
|
-
# if this connection is from the active user\host machine, then process the information
|
42
|
-
if (remoteuser.eql? thisuser) && (remotehost.eql? thisremotehost)
|
43
|
-
while (message = client.gets) != "\n"
|
44
|
-
# process the message
|
45
|
-
# for now only pin_ messages are accepted
|
46
|
-
if message =~ /session_end/
|
47
|
-
sessionactive = false
|
48
|
-
response = response + "session_end:session_end\n"
|
49
|
-
else
|
50
|
-
sessionactive = true
|
51
|
-
response = response + pinsequencer.processmessage(message.chomp) + "\n"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
sessionactivity = Time.now
|
55
|
-
else
|
56
|
-
checkmessage = client.gets.chomp
|
57
|
-
if checkmessage =~ /session_kill/
|
58
|
-
sessionactive = false
|
59
|
-
response = response + "Terminated: session from #{remoteuser} at IP address #{remotehost} inactive for #{Time.now - sessionactivity} seconds has been killed\n"
|
60
|
-
else
|
61
|
-
response = response + "Busy: server is in use by #{remoteuser} from IP address #{remotehost}\n"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
client.write(response)
|
65
|
-
client.close
|
66
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib'))
|
3
|
+
require 'socket'
|
4
|
+
require 'origen_link/server/sequencer'
|
5
|
+
|
6
|
+
server = TCPServer.open('', 12_777)
|
7
|
+
puts 'server started'
|
8
|
+
pinsequencer = OrigenLink::Server::Sequencer.new
|
9
|
+
remoteuser = ''
|
10
|
+
remotehost = ''
|
11
|
+
sessionactivity = Time.now
|
12
|
+
sessionactive = false
|
13
|
+
|
14
|
+
loop do
|
15
|
+
client = server.accept
|
16
|
+
thisuser = client.gets.chomp
|
17
|
+
thisremotehost = client.peeraddr[3]
|
18
|
+
|
19
|
+
# for now assume that any session lasting longer than 20 minutes has timed out (will happen if the origen side app is killed or stopped at a breakpoint with no activity)
|
20
|
+
if (Time.now - sessionactivity) > 1200
|
21
|
+
sessionactive = false
|
22
|
+
end
|
23
|
+
|
24
|
+
change_in_user = false
|
25
|
+
|
26
|
+
# if there is no active session running allow one to start
|
27
|
+
unless sessionactive
|
28
|
+
#flag any change in host machine or user for collision detection
|
29
|
+
change_in_user = true unless (remoteuser.eql? thisuser) && (remotehost.eql? thisremotehost)
|
30
|
+
remoteuser = thisuser
|
31
|
+
remotehost = thisremotehost
|
32
|
+
end
|
33
|
+
|
34
|
+
# always return whether or not the user has been changed (for collision detection)
|
35
|
+
if change_in_user
|
36
|
+
response = "user_change:user_change\n"
|
37
|
+
else
|
38
|
+
response = "\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
# if this connection is from the active user\host machine, then process the information
|
42
|
+
if (remoteuser.eql? thisuser) && (remotehost.eql? thisremotehost)
|
43
|
+
while (message = client.gets) != "\n"
|
44
|
+
# process the message
|
45
|
+
# for now only pin_ messages are accepted
|
46
|
+
if message =~ /session_end/
|
47
|
+
sessionactive = false
|
48
|
+
response = response + "session_end:session_end\n"
|
49
|
+
else
|
50
|
+
sessionactive = true
|
51
|
+
response = response + pinsequencer.processmessage(message.chomp) + "\n"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
sessionactivity = Time.now
|
55
|
+
else
|
56
|
+
checkmessage = client.gets.chomp
|
57
|
+
if checkmessage =~ /session_kill/
|
58
|
+
sessionactive = false
|
59
|
+
response = response + "Terminated: session from #{remoteuser} at IP address #{remotehost} inactive for #{Time.now - sessionactivity} seconds has been killed\n"
|
60
|
+
else
|
61
|
+
response = response + "Busy: server is in use by #{remoteuser} from IP address #{remotehost}\n"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
client.write(response)
|
65
|
+
client.close
|
66
|
+
end
|
data/config/application.rb
CHANGED
@@ -1,109 +1,109 @@
|
|
1
|
-
require 'origen'
|
2
|
-
class OrigenLinkApplication < 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_link"
|
10
|
-
self.namespace = "OrigenLink"
|
11
|
-
config.name = "origen_link"
|
12
|
-
config.initials = "OrigenLink"
|
13
|
-
# Change this to point to the revision control repository for this application
|
14
|
-
config.rc_url = "git@github.com:Origen-SDK/OrigenLink.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 = "/path/to/server/origen_link"
|
20
|
-
#config.web_domain = "http://origen.mycompany.net/origen_link"
|
21
|
-
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/OrigenLink"
|
22
|
-
config.web_domain = "http://origen-sdk.org/OrigenLink"
|
23
|
-
|
24
|
-
# When false Origen will be less strict about checking for some common coding errors,
|
25
|
-
# it is recommended that you leave this to true for better feedback and easier debug.
|
26
|
-
# This will be the default setting in Origen v3.
|
27
|
-
config.strict_errors = true
|
28
|
-
|
29
|
-
# See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
|
30
|
-
config.lint_test = {
|
31
|
-
# Require the lint tests to pass before allowing a release to proceed
|
32
|
-
run_on_tag: true,
|
33
|
-
# Auto correct violations where possible whenever 'origen lint' is run
|
34
|
-
auto_correct: true,
|
35
|
-
# Limit the testing for large legacy applications
|
36
|
-
#level: :easy,
|
37
|
-
# Run on these directories/files by default
|
38
|
-
#files: ["lib", "config/application.rb"],
|
39
|
-
}
|
40
|
-
|
41
|
-
config.semantically_version = true
|
42
|
-
|
43
|
-
config.shared = {
|
44
|
-
command_launcher: 'config/shared_commands.rb'
|
45
|
-
}
|
46
|
-
|
47
|
-
# An example of how to set application specific LSF parameters
|
48
|
-
#config.lsf.project = "msg.te"
|
49
|
-
|
50
|
-
# An example of how to specify a prefix to add to all generated patterns
|
51
|
-
#config.pattern_prefix = "nvm"
|
52
|
-
|
53
|
-
# An example of how to add header comments to all generated patterns
|
54
|
-
#config.pattern_header do
|
55
|
-
# cc "This is a pattern created by the example origen application"
|
56
|
-
#end
|
57
|
-
|
58
|
-
# By default all generated output will end up in ./output.
|
59
|
-
# Here you can specify an alternative directory entirely, or make it dynamic such that
|
60
|
-
# the output ends up in a setup specific directory.
|
61
|
-
#config.output_directory do
|
62
|
-
# "#{Origen.root}/output/#{$dut.class}"
|
63
|
-
#end
|
64
|
-
|
65
|
-
# Similarly for the reference files, generally you want to setup the reference directory
|
66
|
-
# structure to mirror that of your output directory structure.
|
67
|
-
#config.reference_directory do
|
68
|
-
# "#{Origen.root}/.ref/#{$dut.class}"
|
69
|
-
#end
|
70
|
-
|
71
|
-
# This will automatically deploy your documentation after every tag
|
72
|
-
#def after_release_email(tag, note, type, selector, options)
|
73
|
-
# command = "origen web compile --remote --api"
|
74
|
-
# Dir.chdir Origen.root do
|
75
|
-
# system command
|
76
|
-
# end
|
77
|
-
#end
|
78
|
-
|
79
|
-
# Ensure that all tests pass before allowing a release to continue
|
80
|
-
#def validate_release
|
81
|
-
# if !system("origen specs") || !system("origen examples")
|
82
|
-
# puts "Sorry but you can't release with failing tests, please fix them and try again."
|
83
|
-
# exit 1
|
84
|
-
# else
|
85
|
-
# puts "All tests passing, proceeding with release process!"
|
86
|
-
# end
|
87
|
-
#end
|
88
|
-
|
89
|
-
# To enabled source-less pattern generation create a class (for example PatternDispatcher)
|
90
|
-
# to generate the pattern. This should return false if the requested pattern has been
|
91
|
-
# dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
|
92
|
-
#def before_pattern_lookup(requested_pattern)
|
93
|
-
# PatternDispatcher.new.dispatch_or_return(requested_pattern)
|
94
|
-
#end
|
95
|
-
|
96
|
-
# If you use pattern iterators you may come across the case where you request a pattern
|
97
|
-
# like this:
|
98
|
-
# origen g example_pat_b0.atp
|
99
|
-
#
|
100
|
-
# However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
|
101
|
-
# In the case where the pattern cannot be found Origen will pass the name to this translator
|
102
|
-
# if it exists, and here you can make any substitutions to help Origen find the file you
|
103
|
-
# want. In this example any instances of _b\d, where \d means a number, are replaced by
|
104
|
-
# _bx.
|
105
|
-
#config.pattern_name_translator do |name|
|
106
|
-
# name.gsub(/_b\d/, "_bx")
|
107
|
-
#end
|
108
|
-
|
109
|
-
end
|
1
|
+
require 'origen'
|
2
|
+
class OrigenLinkApplication < 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_link"
|
10
|
+
self.namespace = "OrigenLink"
|
11
|
+
config.name = "origen_link"
|
12
|
+
config.initials = "OrigenLink"
|
13
|
+
# Change this to point to the revision control repository for this application
|
14
|
+
config.rc_url = "git@github.com:Origen-SDK/OrigenLink.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 = "/path/to/server/origen_link"
|
20
|
+
#config.web_domain = "http://origen.mycompany.net/origen_link"
|
21
|
+
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/OrigenLink"
|
22
|
+
config.web_domain = "http://origen-sdk.org/OrigenLink"
|
23
|
+
|
24
|
+
# When false Origen will be less strict about checking for some common coding errors,
|
25
|
+
# it is recommended that you leave this to true for better feedback and easier debug.
|
26
|
+
# This will be the default setting in Origen v3.
|
27
|
+
config.strict_errors = true
|
28
|
+
|
29
|
+
# See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
|
30
|
+
config.lint_test = {
|
31
|
+
# Require the lint tests to pass before allowing a release to proceed
|
32
|
+
run_on_tag: true,
|
33
|
+
# Auto correct violations where possible whenever 'origen lint' is run
|
34
|
+
auto_correct: true,
|
35
|
+
# Limit the testing for large legacy applications
|
36
|
+
#level: :easy,
|
37
|
+
# Run on these directories/files by default
|
38
|
+
#files: ["lib", "config/application.rb"],
|
39
|
+
}
|
40
|
+
|
41
|
+
config.semantically_version = true
|
42
|
+
|
43
|
+
config.shared = {
|
44
|
+
command_launcher: 'config/shared_commands.rb'
|
45
|
+
}
|
46
|
+
|
47
|
+
# An example of how to set application specific LSF parameters
|
48
|
+
#config.lsf.project = "msg.te"
|
49
|
+
|
50
|
+
# An example of how to specify a prefix to add to all generated patterns
|
51
|
+
#config.pattern_prefix = "nvm"
|
52
|
+
|
53
|
+
# An example of how to add header comments to all generated patterns
|
54
|
+
#config.pattern_header do
|
55
|
+
# cc "This is a pattern created by the example origen application"
|
56
|
+
#end
|
57
|
+
|
58
|
+
# By default all generated output will end up in ./output.
|
59
|
+
# Here you can specify an alternative directory entirely, or make it dynamic such that
|
60
|
+
# the output ends up in a setup specific directory.
|
61
|
+
#config.output_directory do
|
62
|
+
# "#{Origen.root}/output/#{$dut.class}"
|
63
|
+
#end
|
64
|
+
|
65
|
+
# Similarly for the reference files, generally you want to setup the reference directory
|
66
|
+
# structure to mirror that of your output directory structure.
|
67
|
+
#config.reference_directory do
|
68
|
+
# "#{Origen.root}/.ref/#{$dut.class}"
|
69
|
+
#end
|
70
|
+
|
71
|
+
# This will automatically deploy your documentation after every tag
|
72
|
+
#def after_release_email(tag, note, type, selector, options)
|
73
|
+
# command = "origen web compile --remote --api"
|
74
|
+
# Dir.chdir Origen.root do
|
75
|
+
# system command
|
76
|
+
# end
|
77
|
+
#end
|
78
|
+
|
79
|
+
# Ensure that all tests pass before allowing a release to continue
|
80
|
+
#def validate_release
|
81
|
+
# if !system("origen specs") || !system("origen examples")
|
82
|
+
# puts "Sorry but you can't release with failing tests, please fix them and try again."
|
83
|
+
# exit 1
|
84
|
+
# else
|
85
|
+
# puts "All tests passing, proceeding with release process!"
|
86
|
+
# end
|
87
|
+
#end
|
88
|
+
|
89
|
+
# To enabled source-less pattern generation create a class (for example PatternDispatcher)
|
90
|
+
# to generate the pattern. This should return false if the requested pattern has been
|
91
|
+
# dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
|
92
|
+
#def before_pattern_lookup(requested_pattern)
|
93
|
+
# PatternDispatcher.new.dispatch_or_return(requested_pattern)
|
94
|
+
#end
|
95
|
+
|
96
|
+
# If you use pattern iterators you may come across the case where you request a pattern
|
97
|
+
# like this:
|
98
|
+
# origen g example_pat_b0.atp
|
99
|
+
#
|
100
|
+
# However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
|
101
|
+
# In the case where the pattern cannot be found Origen will pass the name to this translator
|
102
|
+
# if it exists, and here you can make any substitutions to help Origen find the file you
|
103
|
+
# want. In this example any instances of _b\d, where \d means a number, are replaced by
|
104
|
+
# _bx.
|
105
|
+
#config.pattern_name_translator do |name|
|
106
|
+
# name.gsub(/_b\d/, "_bx")
|
107
|
+
#end
|
108
|
+
|
109
|
+
end
|
data/config/commands.rb
CHANGED
@@ -1,74 +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
|
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
|