Class: OrigenTesters::PatternCompilers::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/pattern_compilers/job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, options_with_args, options) ⇒ Job

Returns a new instance of Job.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/origen_testers/pattern_compilers/job.rb', line 52

def initialize(pattern, options_with_args, options)
  @pattern = pattern
  @tester = options_with_args.delete(:tester)
  @compiler = options_with_args.delete(:compiler)
  @id = options_with_args.delete(:id)
  @location = options_with_args.delete(:location)
  @clean = options_with_args.delete(:clean)
  @verbose = options_with_args.delete(:verbose)
  @output_directory = options_with_args.delete(:output_directory)
  @pinmap_workbook = options_with_args.delete(:pinmap_workbook)
  @pinconfig = options_with_args.delete(:pinconfig)
  @avc_dir = options_with_args.delete(:avc_dir)
  @binl_dir = options_with_args.delete(:binl_dir)
  @count = options_with_args.delete(:count) || 1
  @tmf = options_with_args.delete(:tmf)
  @aiv2b_opts = options_with_args.delete(:aiv2b_opts)
  @compiler_options_with_args = options_with_args.delete_if { |k, v| v.nil? }  # Whatever's left has to be valid compiler options
  @compiler_options = options.delete_if { |k, v| v == false }
end

Instance Attribute Details

#aiv2b_optsObject

aiv2b options (Smartest-Based)



41
42
43
# File 'lib/origen_testers/pattern_compilers/job.rb', line 41

def aiv2b_opts
  @aiv2b_opts
end

#avc_dirObject

Pattern input dir (Smartest-Based)



29
30
31
# File 'lib/origen_testers/pattern_compilers/job.rb', line 29

def avc_dir
  @avc_dir
end

#binl_dirObject

Pattern output dir (Smartest-Based)



32
33
34
# File 'lib/origen_testers/pattern_compilers/job.rb', line 32

def binl_dir
  @binl_dir
end

#cleanObject

Controls whether the compiler log files are kept: true/false



14
15
16
# File 'lib/origen_testers/pattern_compilers/job.rb', line 14

def clean
  @clean
end

#compilerObject (readonly)

linux compiler full path



50
51
52
# File 'lib/origen_testers/pattern_compilers/job.rb', line 50

def compiler
  @compiler
end

#compiler_optionsObject

Compiler options where only the opt has to be passed as '-opt'



44
45
46
# File 'lib/origen_testers/pattern_compilers/job.rb', line 44

def compiler_options
  @compiler_options
end

#compiler_options_with_argsObject

Compiler options where an opt and an arg have to be passed '-opt:arg'



47
48
49
# File 'lib/origen_testers/pattern_compilers/job.rb', line 47

def compiler_options_with_args
  @compiler_options_with_args
end

#countObject

Pattern count - should be 1 for IGXL; number of AVC files listed in AIV file for Smartest



35
36
37
# File 'lib/origen_testers/pattern_compilers/job.rb', line 35

def count
  @count
end

#idObject

Type of pattern as designated by the LinuxPatternCompiler



8
9
10
# File 'lib/origen_testers/pattern_compilers/job.rb', line 8

def id
  @id
end

#locationObject

Where the job is to be executed, either locally ('local') or on Linux Server Farm ('lsf')



11
12
13
# File 'lib/origen_testers/pattern_compilers/job.rb', line 11

def location
  @location
end

#output_directoryObject

Output directory for the .PAT file



20
21
22
# File 'lib/origen_testers/pattern_compilers/job.rb', line 20

def output_directory
  @output_directory
end

#patternObject

Pattern to be compiled, is Pathname class. Will use full path



5
6
7
# File 'lib/origen_testers/pattern_compilers/job.rb', line 5

def pattern
  @pattern
end

#pinconfigObject

Pin Config file (Smartest-Based)



26
27
28
# File 'lib/origen_testers/pattern_compilers/job.rb', line 26

def pinconfig
  @pinconfig
end

#pinmap_workbookObject

Pinmap file (IGXL-Based)



23
24
25
# File 'lib/origen_testers/pattern_compilers/job.rb', line 23

def pinmap_workbook
  @pinmap_workbook
end

#tmfObject

tmf file (Smartest-Based)



38
39
40
# File 'lib/origen_testers/pattern_compilers/job.rb', line 38

def tmf
  @tmf
end

#verboseObject

Controls whether the compiler STDOUT is displayed



17
18
19
# File 'lib/origen_testers/pattern_compilers/job.rb', line 17

def verbose
  @verbose
end

Instance Method Details

#cmdObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/origen_testers/pattern_compilers/job.rb', line 76

def cmd
  cmd = ''
  case @tester
    when :v93k
      cmd = "#{resolve_compiler_location} #{@pattern} "
    when :ultraflex, :j750
      cmd = "#{resolve_compiler_location} -pinmap_workbook:#{@pinmap_workbook} -output:#{@output_directory}/#{@pattern.basename.to_s.split('.').first}.PAT #{@pattern} "
      # add in any remaining compiler options
      compiler_options.each_key { |k| cmd += "-#{k} " }
      compiler_options_with_args.each_pair { |k, v| cmd += "-#{k}:#{v} " }
    else
      fail 'Unsupported tester'
  end
  if @verbose
    cmd += ';'
  else
    cmd += '2>&1 > /dev/null;'
  end
  # If the job is to be run on the LSF add in the clean .log and mv the files if necessary
  if @location == 'lsf'
    cmd += clean_lsf if @clean == true
  end
  cmd
end

#nameObject



72
73
74
# File 'lib/origen_testers/pattern_compilers/job.rb', line 72

def name
  @pattern.basename
end

#ready?Boolean

Returns:

  • (Boolean)


105
106
107
108
109
110
111
112
113
114
115
# File 'lib/origen_testers/pattern_compilers/job.rb', line 105

def ready?
  ready = true
  ready &= @output_directory.directory?
  ready &= @pattern.file?
  ready &= @pinmap_workbook.file? if @tester == :ultraflex || @tester == :j750
  ready &= @pinconfig.file? if @tester == :v93k
  ready &= @tmf.file? if @tester == :v93k
  ready &= [true, false].include?(@clean)
  ready &= [:local, :lsf].include?(@location)
  ready
end

#resolve_compiler_locationObject



101
102
103
# File 'lib/origen_testers/pattern_compilers/job.rb', line 101

def resolve_compiler_location
  Pathname.new(@compiler).absolute? ? @compiler : eval('"' + @compiler + '"')
end