Class: OrigenTesters::PatternCompilers::BasePatternCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/pattern_compilers/base.rb,
lib/origen_testers/pattern_compilers/assembler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, options = {}) ⇒ BasePatternCompiler

Returns a new instance of BasePatternCompiler.


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/origen_testers/pattern_compilers/base.rb', line 14

def initialize(id, options = {})
  unless Origen.site_config.origen_testers
    fail 'Adding a pattern compiler without site config specifying bin location not allowed'
  end

  @id = id.to_sym

  # The following are pattern compiler options that are common between all platforms, the specific platforms
  #   can add on additional options in their respective initialize methods.
  @user_options = {
    path:                nil,     # required: will be passed in or parsed from a .list file
    reference_directory: nil,     # optional: will be set to @path or Origen.app.config.pattern_output_directory
    target:              nil,     # optional: allows user to temporarily set target and run compilation
    recursive:           false,   # optional: controls whether to look for patterns in a directory recursively
  }

  @job_options = {
    id:               @id,        # required
    location:         :local,     # optional: controls whether the commands go to the LSF or run locally
    clean:            false,      # optional: controls whether compiler log files are deleted after compilation
    output_directory: nil,        # optional:
    verbose:          false,      # optional: controls whether the compiler output gets put to STDOUT
  }
  @compiler_options = {}
  @compiler_options_with_args = {}

  # Compiler jobs
  @jobs = []
  @files = []
end

Instance Attribute Details

#idObject

ID will allow users to set default configurations for the compiler for unique pattern types


9
10
11
# File 'lib/origen_testers/pattern_compilers/base.rb', line 9

def id
  @id
end

#jobs(search = nil) ⇒ Object

Allow users to search for a pattern in the job queue or default to return all jobs


12
13
14
# File 'lib/origen_testers/pattern_compilers/base.rb', line 12

def jobs
  @jobs
end

Instance Method Details

#clearObject

Clear the job queue


98
99
100
101
# File 'lib/origen_testers/pattern_compilers/base.rb', line 98

def clear
  @jobs = []
  @files = []
end

#countObject

Returns the number of jobs in the compiler


51
52
53
# File 'lib/origen_testers/pattern_compilers/base.rb', line 51

def count
  @jobs.size
end

#empty?Boolean

Checks if the compiler queue is empty

Returns:

  • (Boolean)

56
57
58
# File 'lib/origen_testers/pattern_compilers/base.rb', line 56

def empty?
  @jobs.empty?
end

#inspect_options(verbose = nil) ⇒ Object

Output the compiler options to the console


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/origen_testers/pattern_compilers/base.rb', line 127

def inspect_options(verbose = nil)
  desc = []
  # Find the longest option argument string
  my_job_options = @job_options
  my_job_options.delete(:compiler)
  all_arguments = @user_options.values + my_job_options.values + @compiler_options.values + @compiler_options_with_args.values
  min_argument_padding = 'Argument'.length + 2
  argument_padding = all_arguments.max_by { |e| e.to_s.length }.to_s.length + 3
  argument_padding = min_argument_padding if argument_padding < min_argument_padding
  puts "\n"
  header = '| Option              ' + '| Argument'.ljust(argument_padding) + '| Required |'
  desc << header
  desc << '-' * header.length
  [@user_options, my_job_options, @compiler_options, @compiler_options_with_args].each do |opt|
    opt.each_pair do |k, v|
      if k.match(/pinmap_workbook|path|id|directory|clean|location|recursive/i)
        req = 'true '
      else
        next if v.nil? || v == false
        req = 'false'
      end
      desc << "| #{k}".ljust(22) + "| #{v}".ljust(argument_padding) + "| #{req}    |"
    end
  end
  puts desc
end

#is_j750?Boolean

Check if the current tester is an J750

Returns:

  • (Boolean)

117
118
119
# File 'lib/origen_testers/pattern_compilers/base.rb', line 117

def is_j750?
  platform == :j750 ? true : false
end

#is_ultraflex?Boolean

Check if the current tester is an Ultraflex

Returns:

  • (Boolean)

112
113
114
# File 'lib/origen_testers/pattern_compilers/base.rb', line 112

def is_ultraflex?
  platform == :ultraflex ? true : false
end

#is_v93k?Boolean

Check if the current tester is an V93K

Returns:

  • (Boolean)

122
123
124
# File 'lib/origen_testers/pattern_compilers/base.rb', line 122

def is_v93k?
  platform == :v93k ? true : false
end

#nameObject

Return the id/name of the compiler instance


46
47
48
# File 'lib/origen_testers/pattern_compilers/base.rb', line 46

def name
  @id
end

#platformObject


103
104
105
106
107
108
109
# File 'lib/origen_testers/pattern_compilers/base.rb', line 103

def platform
  if tester.nil?
    fail 'No tester instantiated, $tester is set to nil'
  else
    tester.class.to_s.downcase.split('::').last.to_sym
  end
end