origen_testers 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/shared_commands.rb +11 -19
- data/config/version.rb +1 -1
- data/lib/origen_testers.rb +2 -0
- data/lib/origen_testers/callback_handlers.rb +7 -25
- data/lib/origen_testers/origen_ext/generator.rb +1 -1
- data/lib/origen_testers/pattern_compilers.rb +120 -66
- data/lib/origen_testers/pattern_compilers/assembler.rb +7 -3
- data/lib/origen_testers/pattern_compilers/base.rb +266 -0
- data/lib/origen_testers/pattern_compilers/igxl_based.rb +348 -0
- data/lib/origen_testers/pattern_compilers/j750.rb +80 -0
- data/lib/origen_testers/pattern_compilers/job.rb +49 -9
- data/lib/origen_testers/pattern_compilers/runner.rb +40 -0
- data/lib/origen_testers/pattern_compilers/templates/template.aiv.erb +31 -0
- data/lib/origen_testers/pattern_compilers/ultraflex.rb +92 -0
- data/lib/origen_testers/pattern_compilers/v93k.rb +455 -0
- data/lib/origen_testers/pattern_compilers/v93k/digcap.rb +107 -0
- data/lib/origen_testers/pattern_compilers/v93k/multiport.rb +80 -0
- metadata +14 -6
- data/lib/origen_testers/pattern_compilers/ultraflex_pattern_compiler.rb +0 -599
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 432b93c069da178e789ff6d40afa25e4ba34eb02
|
4
|
+
data.tar.gz: 080a839243c3058dfb450dccbf5c63f06172dd9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5e2ed553068517cb0ceb2ac5caef371083adb5db690922e4ae9826f7ea077116dfe3eda974d263ad7c45f6551942ece6cbc00b043cd8b2928a5f64a7c4b294
|
7
|
+
data.tar.gz: 71d64f91fcd9eb494155dbc426de044db5fc1e3b27edd0f7687cc954bc74be50b1a4aef22414ae5e21ab5045439341a7428c576470cb4ae7ce1ba4f70c79d78d
|
data/config/shared_commands.rb
CHANGED
@@ -23,32 +23,24 @@ case @command
|
|
23
23
|
# require "#{Origen.root(:testers)}/lib/commands/latpc"
|
24
24
|
# Need to see if --compile is included and setup compiler
|
25
25
|
when "generate"
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
ARGV.delete(compiler_instance_name)
|
34
|
-
$compiler = compiler_instance_name.to_sym
|
35
|
-
end
|
36
|
-
ARGV.delete("--compile")
|
37
|
-
end
|
38
|
-
$_testers_enable_vector_comments = ARGV.delete("-v") || ARGV.delete("--vector_comments")
|
39
|
-
$_testers_no_inline_comments = ARGV.delete("--no_inline_comments")
|
26
|
+
@application_options << ['--compile', 'Compile the current pattern or the list', ->(options) { options[:testers_compile_pat] = true }]
|
27
|
+
@application_options << ['--compiler NAME', String, 'Override the default application pattern compiler', ->(options, compiler) { options[:testers_compiler_instance_name] = compiler.to_sym }]
|
28
|
+
@application_options << ['--no_inline_comments', 'Disable the duplication of comments inline (V93k patterns)', ->(options) { options[:testers_no_inline_comments] = true }]
|
29
|
+
@application_options << ['-v', '--vector_comments', 'Add the vector and cycle number to the vector comments', lambda { |options| options[:testers_enable_vector_comments] = true }]
|
30
|
+
|
31
|
+
$_testers_enable_vector_comments = ARGV.delete("-v") || ARGV.delete("--vector_comments")
|
32
|
+
$_testers_no_inline_comments = ARGV.delete("--no_inline_comments")
|
40
33
|
|
41
34
|
when "testers:build"
|
42
|
-
|
35
|
+
require "#{Origen.root!}/lib/commands/build"
|
43
36
|
exit 0
|
44
37
|
|
45
38
|
when "testers:run"
|
46
|
-
|
39
|
+
require "#{Origen.root!}/lib/commands/run"
|
47
40
|
exit 0
|
48
41
|
|
49
|
-
|
50
42
|
else
|
51
|
-
|
52
|
-
|
43
|
+
@plugin_commands << " testers:build Build a test program from a collection of sub-programs"
|
44
|
+
@plugin_commands << " testers:run Run the last test program generated for the current target"
|
53
45
|
|
54
46
|
end
|
data/config/version.rb
CHANGED
data/lib/origen_testers.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative '../config/application.rb'
|
|
4
4
|
require 'active_support/concern'
|
5
5
|
require 'require_all'
|
6
6
|
require 'atp'
|
7
|
+
require 'pathname'
|
7
8
|
require 'origen_testers/origen_ext/generator/flow'
|
8
9
|
require 'origen_testers/origen_ext/generator/resources'
|
9
10
|
require 'origen_testers/origen_ext/application/runner'
|
@@ -42,6 +43,7 @@ require 'origen_testers/igxl_based_tester'
|
|
42
43
|
require 'origen_testers/smartest_based_tester'
|
43
44
|
require 'origen_testers/labview_based_tester'
|
44
45
|
require 'origen_testers/pattern_compilers'
|
46
|
+
require 'origen_testers/pattern_compilers/runner'
|
45
47
|
|
46
48
|
require 'origen_testers/callback_handlers'
|
47
49
|
require 'origen_testers/origen_ext/pins/pin'
|
@@ -4,9 +4,13 @@ module OrigenTesters
|
|
4
4
|
|
5
5
|
# Snoop the pattern path that was just created and then compile it
|
6
6
|
# if the compiler was passed on the command line
|
7
|
-
def pattern_generated(path_to_generated_pattern)
|
8
|
-
|
9
|
-
|
7
|
+
def pattern_generated(path_to_generated_pattern, job_options = {})
|
8
|
+
if job_options[:testers_compile_pat]
|
9
|
+
opts = {}
|
10
|
+
opts[:compiler_instance] = job_options[:testers_compiler_instance_name]
|
11
|
+
opts[:pattern_generated] = true
|
12
|
+
OrigenTesters::PatternCompilers::Runner.run_compiler(path_to_generated_pattern, opts)
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
# Listen for a pattern with .atp or .atp.gz extension. If found then compile the fileand kill the 'origen g' command
|
@@ -29,28 +33,6 @@ module OrigenTesters
|
|
29
33
|
end
|
30
34
|
true
|
31
35
|
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def select_compiler
|
36
|
-
current_compiler = nil
|
37
|
-
if $compiler == :use_app_default
|
38
|
-
current_compiler = $dut.compiler
|
39
|
-
fail "DUT compiler '#{current_compiler}' is not instantiated" if $dut.pattern_compilers[current_compiler].nil?
|
40
|
-
elsif $compiler.is_a? Symbol
|
41
|
-
current_compiler = $compiler
|
42
|
-
fail "Command line compiler '#{current_compiler}' is not instantiated" if $dut.pattern_compilers[current_compiler].nil?
|
43
|
-
end
|
44
|
-
current_compiler
|
45
|
-
end
|
46
|
-
|
47
|
-
def run_compiler(current_compiler, pattern)
|
48
|
-
unless current_compiler.nil?
|
49
|
-
debug "Compiling pattern #{pattern} with compiler '#{current_compiler}'..."
|
50
|
-
$dut.pattern_compilers[current_compiler].find_jobs(pattern)
|
51
|
-
$dut.pattern_compilers[current_compiler].run
|
52
|
-
end
|
53
|
-
end
|
54
36
|
end
|
55
37
|
|
56
38
|
# Instantiate an instance of this class immediately when this file is required, this object will
|
@@ -24,7 +24,7 @@ module Origen
|
|
24
24
|
else
|
25
25
|
file = Origen.config.referenced_pattern_list
|
26
26
|
end
|
27
|
-
|
27
|
+
Origen.log.info "Referenced pattern list written to: #{Pathname.new(file).relative_path_from(Pathname.pwd)}"
|
28
28
|
dir = Pathname.new(file).dirname
|
29
29
|
FileUtils.mkdir_p(dir) unless dir.exist?
|
30
30
|
File.open(file, 'w') do |f|
|
@@ -1,116 +1,170 @@
|
|
1
1
|
module OrigenTesters
|
2
2
|
module PatternCompilers
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
3
|
+
require 'origen_testers/pattern_compilers/base'
|
4
|
+
require 'origen_testers/pattern_compilers/igxl_based'
|
5
|
+
require 'origen_testers/pattern_compilers/ultraflex'
|
6
|
+
require 'origen_testers/pattern_compilers/j750'
|
7
|
+
require 'origen_testers/pattern_compilers/v93k'
|
8
|
+
|
9
|
+
PLATFORMS = {
|
10
|
+
ultraflex: 'UltraFLEX',
|
11
|
+
j750: 'J750',
|
12
|
+
v93k: 'V93K'
|
13
|
+
}
|
14
|
+
|
15
|
+
# Hash wrapper for compiler instances, defaults to display currently enabled tester platform.
|
16
|
+
# If no tester is set then user must supply a valid tester platform argument
|
17
|
+
# User can also supply alternate tester platform (i.e. not the current tester target)
|
18
|
+
# pattern_compilers() => hash of compilers for current tester platform
|
19
|
+
# pattern_compilers(id1) => inspect options of compiler 'id1' for current tester platfrom
|
20
|
+
# pattern_compiler(platform: :v93k) => hash of compilers for specified tester platfrom (v93k)
|
21
|
+
# pattern_compiler(id2, platform: :v93k) => inspect options of compiler 'id2' for specified tester platfrom (v93k)
|
22
|
+
def pattern_compilers(id = nil, options = {})
|
23
|
+
id, options = nil, id if id.is_a? Hash
|
24
|
+
plat = options[:platform] || platform # use platform option or current tester platform
|
25
|
+
|
26
|
+
# Build up empty hash structure for all supported plaforms
|
17
27
|
@pattern_compilers ||= begin
|
18
28
|
hash = {}
|
19
|
-
PLATFORMS.each { |
|
29
|
+
PLATFORMS.keys.each { |p| hash[p] = {} }
|
20
30
|
hash
|
21
31
|
end
|
32
|
+
|
33
|
+
@default_pattern_compiler ||= begin
|
34
|
+
hash = {}
|
35
|
+
PLATFORMS.keys.each { |p| hash[p] = nil }
|
36
|
+
hash
|
37
|
+
end
|
38
|
+
|
22
39
|
if id.nil?
|
23
|
-
@pattern_compilers[
|
40
|
+
@pattern_compilers[plat]
|
24
41
|
else
|
25
|
-
@pattern_compilers[
|
42
|
+
@pattern_compilers[plat][id].inspect_options
|
26
43
|
end
|
27
44
|
end
|
28
|
-
alias_method :compilers, :pattern_compilers
|
45
|
+
# alias_method :compilers, :pattern_compilers # DEPRECATING
|
46
|
+
|
47
|
+
# Add a compiler for a particular tester platform and pattern type
|
48
|
+
def add_pattern_compiler(id, plat, options = {})
|
49
|
+
pattern_compilers
|
50
|
+
id = id.to_sym
|
51
|
+
plat = plat.to_sym
|
52
|
+
options[:location] = options[:location].to_sym unless options[:location].nil?
|
53
|
+
|
54
|
+
verify_unique_platform_id(id, plat) # do not allow duplicate ids for a given platform
|
55
|
+
@pattern_compilers[plat][id] = platform_compiler(plat).new(id, options)
|
56
|
+
|
57
|
+
default = options[:default] || false
|
58
|
+
@default_pattern_compiler[plat] = id if default
|
59
|
+
end
|
60
|
+
# alias_method :add_compiler, :add_pattern_compiler # DEPRECATING
|
61
|
+
|
62
|
+
# Get the default pattern compiler for the current of speficied platform
|
63
|
+
def default_pattern_compiler(p = platform)
|
64
|
+
@default_pattern_compiler[p.to_sym]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Set a (already created) pattern compiler as the default for current or specified platform
|
68
|
+
def set_default_pattern_compiler(id, p = platform)
|
69
|
+
@default_pattern_compiler[p.to_sym] = id
|
70
|
+
end
|
29
71
|
|
72
|
+
# All platforms that have supported pattern compilers (returns Array)
|
30
73
|
def pattern_compiler_platforms
|
31
|
-
PLATFORMS
|
74
|
+
PLATFORMS.keys.sort
|
32
75
|
end
|
33
|
-
alias_method :compiler_platforms, :pattern_compiler_platforms
|
76
|
+
# alias_method :compiler_platforms, :pattern_compiler_platforms # DEPRECATING
|
34
77
|
|
35
|
-
# Delete pattern compiler instances. If no
|
78
|
+
# Delete all pattern compiler instances for a given platform. If no
|
79
|
+
# argument default to current platform
|
36
80
|
def delete_pattern_compilers(p = platform)
|
37
81
|
@pattern_compilers[p].delete_if { |k, v| true }
|
38
82
|
end
|
39
|
-
alias_method :delete_compilers, :delete_pattern_compilers
|
83
|
+
# alias_method :delete_compilers, :delete_pattern_compilers # DEPRECATING
|
40
84
|
|
41
85
|
# Delete a pattern compiler instance.
|
42
|
-
def delete_pattern_compiler(id)
|
43
|
-
@pattern_compilers[
|
86
|
+
def delete_pattern_compiler(id, p = platform)
|
87
|
+
@pattern_compilers[p].delete(id)
|
44
88
|
end
|
45
|
-
alias_method :delete_compiler, :delete_pattern_compiler
|
46
|
-
|
47
|
-
#
|
48
|
-
def
|
49
|
-
pattern_compilers
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
case platform
|
54
|
-
when :ultraflex
|
55
|
-
fail "Compiler ID #{id} for platform #{platform} already exists! Pick another name, delete the compiler, or clear all compilers" if @pattern_compilers[platform].keys.include? id
|
56
|
-
@pattern_compilers[platform][id] = UltraFlexPatternCompiler.new(id, options)
|
57
|
-
else
|
58
|
-
fail "Platform #{platform} is not valid, please choose from #{PLATFORMS.join(', ')}"
|
89
|
+
# alias_method :delete_compiler, :delete_pattern_compiler # DEPRECATING
|
90
|
+
|
91
|
+
# Check compiler instance name is unique for given platform
|
92
|
+
def verify_unique_platform_id(id, platform, options = {})
|
93
|
+
if @pattern_compilers[platform].keys.include? id
|
94
|
+
fail_msg = "Compiler ID #{id} for platform #{platform} already exists! "
|
95
|
+
fail_msg += 'Pick another name, delete the compiler, or clear all compilers'
|
96
|
+
fail fail_msg
|
59
97
|
end
|
60
98
|
end
|
61
|
-
alias_method :add_compiler, :add_pattern_compiler
|
62
99
|
|
63
100
|
# Returns an array of the pattern compiler instance ids
|
64
101
|
# for the currently selected tester platform.
|
65
102
|
def pattern_compiler_instances(p = platform)
|
66
103
|
# Check if nil which means no tester is defined so ask user to supply it
|
67
|
-
|
104
|
+
if p.nil?
|
105
|
+
fail "No tester platform defined, supply one of the following as an argument: #{PLATFORMS.keys.sort.join(', ')}"
|
106
|
+
end
|
68
107
|
p = p.to_sym
|
69
108
|
@pattern_compilers[p].keys
|
70
109
|
end
|
71
|
-
alias_method :compiler_instances, :pattern_compiler_instances
|
110
|
+
# alias_method :compiler_instances, :pattern_compiler_instances # DEPRECATING
|
111
|
+
|
112
|
+
# Return the Compiler Class of the current or specified platform
|
113
|
+
def platform_compiler(p = platform)
|
114
|
+
if pattern_compiler_supported?(p)
|
115
|
+
"OrigenTesters::PatternCompilers::#{PLATFORMS[p]}PatternCompiler".constantize
|
116
|
+
else
|
117
|
+
fail "Platform #{platform} is not valid, please choose from #{PLATFORMS.keys.sort.join(', ')}"
|
118
|
+
end
|
119
|
+
end
|
72
120
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
system cmd
|
121
|
+
# Execute the compiler with 'help' switch
|
122
|
+
def pattern_compiler_options(p = platform)
|
123
|
+
system("#{platform_compiler(p).compiler_options}")
|
77
124
|
end
|
78
|
-
alias_method :compiler_options, :pattern_compiler_options
|
125
|
+
# alias_method :compiler_options, :pattern_compiler_options # DEPRECATING
|
79
126
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
system cmd
|
127
|
+
# Execute the compiler with 'version' swtich
|
128
|
+
def pattern_compiler_version(p = platform)
|
129
|
+
system("#{platform_compiler(p).compiler_version}")
|
84
130
|
end
|
85
|
-
alias_method :compiler_version, :pattern_compiler_version
|
131
|
+
# alias_method :compiler_version, :pattern_compiler_version # DEPRECATING
|
86
132
|
|
87
133
|
# Check if the current tester is supported
|
88
|
-
def pattern_compiler_supported?
|
89
|
-
PLATFORMS.include?
|
134
|
+
def pattern_compiler_supported?(p = platform)
|
135
|
+
PLATFORMS.keys.include?(p) ? true : false
|
90
136
|
end
|
91
|
-
alias_method :compiler_supported?, :pattern_compiler_supported?
|
137
|
+
# alias_method :compiler_supported?, :pattern_compiler_supported? # DEPRECATING
|
92
138
|
|
93
139
|
private
|
94
140
|
|
95
|
-
|
96
|
-
|
97
|
-
|
141
|
+
# # Check if the current tester is an Ultraflex
|
142
|
+
# def is_ultraflex?
|
143
|
+
# platform == :ultraflex ? true : false
|
144
|
+
# end
|
98
145
|
|
99
|
-
# Check if the current tester is an Ultraflex
|
100
|
-
def
|
101
|
-
|
102
|
-
end
|
146
|
+
# # Check if the current tester is an Ultraflex
|
147
|
+
# def is_j750?
|
148
|
+
# platform == :j750 ? true : false
|
149
|
+
# end
|
103
150
|
|
151
|
+
# # Check if the current tester is an Ultraflex
|
152
|
+
# def is_v93k?
|
153
|
+
# platform == :v93k ? true : false
|
154
|
+
# end
|
155
|
+
|
156
|
+
# Return the current tester target
|
104
157
|
def platform
|
105
|
-
if
|
158
|
+
if tester.nil?
|
106
159
|
fail 'No tester instantiated, $tester is set to nil'
|
107
160
|
else
|
108
|
-
|
161
|
+
tester.class.to_s.downcase.split('::').last.to_sym
|
109
162
|
end
|
110
163
|
end
|
111
164
|
|
112
|
-
|
113
|
-
|
114
|
-
|
165
|
+
# # Check if a target has been set
|
166
|
+
# def target_enabled?
|
167
|
+
# Origen.target.name.nil? ? true : false
|
168
|
+
# end
|
115
169
|
end
|
116
170
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module OrigenTesters
|
2
2
|
module PatternCompilers
|
3
|
-
class
|
3
|
+
class BasePatternCompiler
|
4
4
|
private
|
5
5
|
|
6
|
-
# Check the file extension of a file, return status can be 'atp', 'list', or nil
|
6
|
+
# Check the file extension of a file, return status can be 'atp', 'avc', 'list', or nil
|
7
7
|
def check_file_ext(file)
|
8
8
|
status = nil
|
9
9
|
ext = file.extname
|
10
10
|
name = file.basename
|
11
11
|
if ext == '.atp'
|
12
12
|
status = 'atp'
|
13
|
+
elsif ext == '.avc'
|
14
|
+
status = 'avc'
|
13
15
|
elsif ext == '.gz'
|
14
|
-
# Ensure we have a .atp.gz
|
16
|
+
# Ensure we have a .atp.gz or .avc.gz
|
15
17
|
sub_ext = name.to_s.split('.')[-2]
|
16
18
|
if sub_ext == 'atp'
|
17
19
|
status = 'atp'
|
@@ -52,6 +54,8 @@ module OrigenTesters
|
|
52
54
|
case check_file_ext(file)
|
53
55
|
when 'atp'
|
54
56
|
files << file unless files.include?(file)
|
57
|
+
when 'avc'
|
58
|
+
files << file unless files.include?(file)
|
55
59
|
when 'list'
|
56
60
|
parse_list(file, files)
|
57
61
|
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
module OrigenTesters
|
3
|
+
module PatternCompilers
|
4
|
+
class BasePatternCompiler
|
5
|
+
require 'origen_testers/pattern_compilers/assembler'
|
6
|
+
require 'origen_testers/pattern_compilers/job'
|
7
|
+
|
8
|
+
# ID will allow users to set default configurations for the compiler for unique pattern types
|
9
|
+
attr_accessor :id
|
10
|
+
|
11
|
+
# Compiler commands array
|
12
|
+
attr_accessor :jobs
|
13
|
+
|
14
|
+
def initialize(id, options = {})
|
15
|
+
unless Origen.site_config.origen_testers
|
16
|
+
fail 'Adding a pattern compiler without site config specifying bin location not allowed'
|
17
|
+
end
|
18
|
+
|
19
|
+
@id = id.to_sym
|
20
|
+
|
21
|
+
# The following are pattern compiler options that are common between all platforms, the specific platforms
|
22
|
+
# can add on additional options in their respective initialize methods.
|
23
|
+
@user_options = {
|
24
|
+
path: nil, # required: will be passed in or parsed from a .list file
|
25
|
+
reference_directory: nil, # optional: will be set to @path or Origen.app.config.pattern_output_directory
|
26
|
+
target: nil, # optional: allows user to temporarily set target and run compilation
|
27
|
+
recursive: false, # optional: controls whether to look for patterns in a directory recursively
|
28
|
+
}
|
29
|
+
|
30
|
+
@job_options = {
|
31
|
+
id: @id, # required
|
32
|
+
location: :local, # optional: controls whether the commands go to the LSF or run locally
|
33
|
+
clean: false, # optional: controls whether compiler log files are deleted after compilation
|
34
|
+
output_directory: nil, # optional:
|
35
|
+
verbose: false, # optional: controls whether the compiler output gets put to STDOUT
|
36
|
+
}
|
37
|
+
@compiler_options = {}
|
38
|
+
@compiler_options_with_args = {}
|
39
|
+
|
40
|
+
# Compiler jobs
|
41
|
+
@jobs = []
|
42
|
+
@files = []
|
43
|
+
end
|
44
|
+
|
45
|
+
# Return the id/name of the compiler instance
|
46
|
+
def name
|
47
|
+
@id
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the number of jobs in the compiler
|
51
|
+
def count
|
52
|
+
@jobs.size
|
53
|
+
end
|
54
|
+
|
55
|
+
# Checks if the compiler queue is empty
|
56
|
+
def empty?
|
57
|
+
@jobs.empty?
|
58
|
+
end
|
59
|
+
|
60
|
+
# Allow users to search for a pattern in the job queue or default to return all jobs
|
61
|
+
def jobs(search = nil)
|
62
|
+
found = false
|
63
|
+
if search.nil?
|
64
|
+
inspect_jobs
|
65
|
+
found = true
|
66
|
+
elsif search.is_a? String
|
67
|
+
@jobs.each_with_index do |job, index|
|
68
|
+
if job.pattern.to_s.match(search)
|
69
|
+
inspect_jobs(index)
|
70
|
+
found = true
|
71
|
+
else
|
72
|
+
puts "No match found for #{search}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
elsif search.is_a? Regexp
|
76
|
+
@jobs.each_with_index do |job, index|
|
77
|
+
if search.match(job.pattern.to_s)
|
78
|
+
inspect_jobs(index)
|
79
|
+
found = true
|
80
|
+
else
|
81
|
+
puts "No match found for #{search}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
elsif search.is_a? Integer
|
85
|
+
if @jobs[search].nil?
|
86
|
+
puts "The compiler queue does not contain a job at index #{search}"
|
87
|
+
else
|
88
|
+
inspect_jobs(search)
|
89
|
+
found = true
|
90
|
+
end
|
91
|
+
else
|
92
|
+
fail 'Search argument must be of type String, Regexp, or Integer'
|
93
|
+
end
|
94
|
+
found
|
95
|
+
end
|
96
|
+
|
97
|
+
# Clear the job queue
|
98
|
+
def clear
|
99
|
+
@jobs = []
|
100
|
+
@files = []
|
101
|
+
end
|
102
|
+
|
103
|
+
def platform
|
104
|
+
if tester.nil?
|
105
|
+
fail 'No tester instantiated, $tester is set to nil'
|
106
|
+
else
|
107
|
+
tester.class.to_s.downcase.split('::').last.to_sym
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check if the current tester is an Ultraflex
|
112
|
+
def is_ultraflex?
|
113
|
+
platform == :ultraflex ? true : false
|
114
|
+
end
|
115
|
+
|
116
|
+
# Check if the current tester is an J750
|
117
|
+
def is_j750?
|
118
|
+
platform == :j750 ? true : false
|
119
|
+
end
|
120
|
+
|
121
|
+
# Check if the current tester is an V93K
|
122
|
+
def is_v93k?
|
123
|
+
platform == :v93k ? true : false
|
124
|
+
end
|
125
|
+
|
126
|
+
# Output the compiler options to the console
|
127
|
+
def inspect_options(verbose = nil)
|
128
|
+
desc = []
|
129
|
+
# Find the longest option argument string
|
130
|
+
my_job_options = @job_options
|
131
|
+
my_job_options.delete(:compiler)
|
132
|
+
all_arguments = @user_options.values + my_job_options.values + @compiler_options.values + @compiler_options_with_args.values
|
133
|
+
min_argument_padding = 'Argument'.length + 2
|
134
|
+
argument_padding = all_arguments.max_by { |e| e.to_s.length }.to_s.length + 3
|
135
|
+
argument_padding = min_argument_padding if argument_padding < min_argument_padding
|
136
|
+
puts "\n"
|
137
|
+
header = '| Option ' + '| Argument'.ljust(argument_padding) + '| Required |'
|
138
|
+
desc << header
|
139
|
+
desc << '-' * header.length
|
140
|
+
[@user_options, my_job_options, @compiler_options, @compiler_options_with_args].each do |opt|
|
141
|
+
opt.each_pair do |k, v|
|
142
|
+
if k.match(/pinmap_workbook|path|id|directory|clean|location|recursive/i)
|
143
|
+
req = 'true '
|
144
|
+
else
|
145
|
+
next if v.nil? || v == false
|
146
|
+
req = 'false'
|
147
|
+
end
|
148
|
+
desc << "| #{k}".ljust(22) + "| #{v}".ljust(argument_padding) + "| #{req} |"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
puts desc
|
152
|
+
end
|
153
|
+
|
154
|
+
private
|
155
|
+
|
156
|
+
def update_common_options(options = {})
|
157
|
+
@user_options.update_common(options)
|
158
|
+
@job_options.update_common(options)
|
159
|
+
@compiler_options.update_common(options)
|
160
|
+
@compiler_options_with_args.update_common(options)
|
161
|
+
end
|
162
|
+
|
163
|
+
def clean_and_verify_options
|
164
|
+
verify_exclusive_compiler_options
|
165
|
+
clean_path_options
|
166
|
+
set_reference_directory
|
167
|
+
create_output_directory
|
168
|
+
|
169
|
+
# Logfile is optional
|
170
|
+
unless @compiler_options[:logfile].nil?
|
171
|
+
@compiler_options[:logfile] = convert_to_pathname(@compiler_options[:logfile])
|
172
|
+
end
|
173
|
+
|
174
|
+
# Check if the LSF is setup in the application
|
175
|
+
if Origen.app.config.lsf.project.nil? || Origen.app.config.lsf.project.empty?
|
176
|
+
msg = 'LSF is not set at Origen.app.config.lsf.project, changing to local compilation'
|
177
|
+
Origen.log.warn msg
|
178
|
+
@job_options[:location] = :local
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Check to make sure @compiler_options and @compiler_options_with_args do not have any keys in common
|
183
|
+
def verify_exclusive_compiler_options
|
184
|
+
if @compiler_options.intersect? @compiler_options_with_args
|
185
|
+
fail_msg = 'Error: @compiler_options and @compiler_options_with_args share keys '
|
186
|
+
fail_msg += "#{@compiler_options.intersections(@compiler_options_with_args)}. "
|
187
|
+
fail_msg += 'They should be mutually exclusive, exiting...'
|
188
|
+
fail fail_msg
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def clean_path_options
|
193
|
+
unless @user_options[:path].nil?
|
194
|
+
if @user_options[:path].is_a? Pathname
|
195
|
+
@path = @user_options[:path]
|
196
|
+
else
|
197
|
+
@path = Pathname.new(@user_options[:path])
|
198
|
+
end
|
199
|
+
@path = @path.expand_path
|
200
|
+
# path is set but output_directory is not so set output_directory to path
|
201
|
+
@job_options[:output_directory] = @path if @job_options[:output_directory].nil?
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def set_reference_directory
|
206
|
+
if @user_options[:reference_directory].nil?
|
207
|
+
# Nothing passed for reference directory so set it to Origen.app.config.pattern_output_directory if valid
|
208
|
+
if File.directory? Origen.app.config.pattern_output_directory
|
209
|
+
@user_options[:reference_directory] = Pathname.new(Origen.app.config.pattern_output_directory)
|
210
|
+
elsif @path
|
211
|
+
if @path.directory?
|
212
|
+
@user_options[:reference_directory] = @path
|
213
|
+
else
|
214
|
+
@user_options[:reference_directory] = @path.dirname
|
215
|
+
end
|
216
|
+
end
|
217
|
+
elsif File.directory?(@user_options[:reference_directory])
|
218
|
+
@user_options[:reference_directory] = Pathname.new(@user_options[:reference_directory])
|
219
|
+
else
|
220
|
+
debug 'Reference directory not set, creating it...'
|
221
|
+
@user_options[:reference_directory] = Pathname.new(@user_options[:reference_directory])
|
222
|
+
FileUtils.mkdir_p(@user_options[:reference_directory])
|
223
|
+
end
|
224
|
+
@user_options[:reference_directory] = @user_options[:reference_directory].expand_path
|
225
|
+
# reference_directory must be a subset of @path. if it is not then set to @path if @path exists
|
226
|
+
unless @path.nil?
|
227
|
+
if @path.directory?
|
228
|
+
@user_options[:reference_directory] = @path unless @path.to_s.include? @user_options[:reference_directory].to_s
|
229
|
+
elsif @path.file?
|
230
|
+
@user_options[:reference_directory] = @path.dirname
|
231
|
+
else
|
232
|
+
fail "Path is set to #{@path} which is not a valid directory or file!"
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def create_output_directory
|
238
|
+
# if output directory given, create it now, otherwise it will be created on the fly later
|
239
|
+
unless @job_options[:output_directory].nil?
|
240
|
+
@job_options[:output_directory] = convert_to_pathname(@job_options[:output_directory])
|
241
|
+
# output_directory can not exist, will create for user
|
242
|
+
unless @job_options[:output_directory].directory?
|
243
|
+
puts "Output directory #{@job_options[:output_directory]} does not exist, creating it..."
|
244
|
+
FileUtils.mkdir_p(@job_options[:output_directory])
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def empty_msg
|
250
|
+
puts "No compiler jobs created, check the compiler options\n" if self.empty?
|
251
|
+
end
|
252
|
+
|
253
|
+
def convert_to_pathname(opt)
|
254
|
+
if opt.is_a? String
|
255
|
+
opt = Pathname.new(opt)
|
256
|
+
opt = opt.expand_path
|
257
|
+
elsif opt.is_a? Pathname
|
258
|
+
opt = opt.expand_path
|
259
|
+
else
|
260
|
+
fail "Option #{opt} is not a String, cannot convert to Pathname"
|
261
|
+
end
|
262
|
+
opt
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|