Module: OrigenTesters::PatternCompilers

Defined in:
lib/origen_testers/pattern_compilers.rb,
lib/origen_testers/pattern_compilers/job.rb,
lib/origen_testers/pattern_compilers/base.rb,
lib/origen_testers/pattern_compilers/j750.rb,
lib/origen_testers/pattern_compilers/v93k.rb,
lib/origen_testers/pattern_compilers/runner.rb,
lib/origen_testers/pattern_compilers/assembler.rb,
lib/origen_testers/pattern_compilers/ultraflex.rb,
lib/origen_testers/pattern_compilers/igxl_based.rb,
lib/origen_testers/pattern_compilers/v93k/digcap.rb,
lib/origen_testers/pattern_compilers/v93k/multiport.rb

Defined Under Namespace

Modules: Runner Classes: BasePatternCompiler, IGXLBasedPatternCompiler, J750PatternCompiler, Job, UltraFLEXPatternCompiler, V93KPatternCompiler

Constant Summary collapse

PLATFORMS =
{
  ultraflex: 'UltraFLEX',
  j750:      'J750',
  v93k:      'V93K'
}

Instance Method Summary collapse

Instance Method Details

#add_pattern_compiler(id, plat, options = {}) ⇒ Object

Add a compiler for a particular tester platform and pattern type



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/origen_testers/pattern_compilers.rb', line 48

def add_pattern_compiler(id, plat, options = {})
  pattern_compilers
  id = id.to_sym
  plat = plat.to_sym
  options[:location] = options[:location].to_sym unless options[:location].nil?

  verify_unique_platform_id(id, plat)    # do not allow duplicate ids for a given platform
  @pattern_compilers[plat][id] = platform_compiler(plat).new(id, options)

  default = options[:default] || false
  @default_pattern_compiler[plat] = id if default
end

#default_pattern_compiler(p = platform) ⇒ Object

Get the default pattern compiler for the current of speficied platform



63
64
65
# File 'lib/origen_testers/pattern_compilers.rb', line 63

def default_pattern_compiler(p = platform)
  @default_pattern_compiler[p.to_sym]
end

#delete_pattern_compiler(id, p = platform) ⇒ Object

Delete a pattern compiler instance.



86
87
88
# File 'lib/origen_testers/pattern_compilers.rb', line 86

def delete_pattern_compiler(id, p = platform)
  @pattern_compilers[p].delete(id)
end

#delete_pattern_compilers(p = platform) ⇒ Object

Delete all pattern compiler instances for a given platform. If no

argument default to current platform


80
81
82
# File 'lib/origen_testers/pattern_compilers.rb', line 80

def delete_pattern_compilers(p = platform)
  @pattern_compilers[p].delete_if { |k, v| true }
end

#pattern_compiler_instances(p = platform) ⇒ Object

Returns an array of the pattern compiler instance ids for the currently selected tester platform.



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

def pattern_compiler_instances(p = platform)
  # Check if nil which means no tester is defined so ask user to supply it
  if p.nil?
    fail "No tester platform defined, supply one of the following as an argument: #{PLATFORMS.keys.sort.join(', ')}"
  end
  p = p.to_sym
  @pattern_compilers[p].keys
end

#pattern_compiler_options(p = platform) ⇒ Object

Execute the compiler with 'help' switch



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

def pattern_compiler_options(p = platform)
  system("#{platform_compiler(p).compiler_options}")
end

#pattern_compiler_platformsObject

All platforms that have supported pattern compilers (returns Array)



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

def pattern_compiler_platforms
  PLATFORMS.keys.sort
end

#pattern_compiler_supported?(p = platform) ⇒ Boolean

Check if the current tester is supported

Returns:

  • (Boolean)


134
135
136
# File 'lib/origen_testers/pattern_compilers.rb', line 134

def pattern_compiler_supported?(p = platform)
  PLATFORMS.keys.include?(p) ? true : false
end

#pattern_compiler_version(p = platform) ⇒ Object

Execute the compiler with 'version' swtich



128
129
130
# File 'lib/origen_testers/pattern_compilers.rb', line 128

def pattern_compiler_version(p = platform)
  system("#{platform_compiler(p).compiler_version}")
end

#pattern_compilers(id = nil, options = {}) ⇒ Object

Hash wrapper for compiler instances, defaults to display currently enabled tester platform. If no tester is set then user must supply a valid tester platform argument User can also supply alternate tester platform (i.e. not the current tester target)

pattern_compilers()                    => hash of compilers for current tester platform
pattern_compilers(id1)                 => inspect options of compiler 'id1' for current tester platfrom
pattern_compiler(platform: :v93k)      => hash of compilers for specified tester platfrom (v93k)
pattern_compiler(id2, platform: :v93k) => inspect options of compiler 'id2' for specified tester platfrom (v93k)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/origen_testers/pattern_compilers.rb', line 22

def pattern_compilers(id = nil, options = {})
  id, options = nil, id if id.is_a? Hash
  plat = options[:platform] || platform     # use platform option or current tester platform

  # Build up empty hash structure for all supported plaforms
  @pattern_compilers ||= begin
    hash = {}
    PLATFORMS.keys.each { |p| hash[p] = {} }
    hash
  end

  @default_pattern_compiler ||= begin
    hash = {}
    PLATFORMS.keys.each { |p| hash[p] = nil }
    hash
  end

  if id.nil?
    @pattern_compilers[plat]
  else
    @pattern_compilers[plat][id].inspect_options
  end
end

#platform_compiler(p = platform) ⇒ Object

Return the Compiler Class of the current or specified platform



113
114
115
116
117
118
119
# File 'lib/origen_testers/pattern_compilers.rb', line 113

def platform_compiler(p = platform)
  if pattern_compiler_supported?(p)
    "OrigenTesters::PatternCompilers::#{PLATFORMS[p]}PatternCompiler".constantize
  else
    fail "Platform #{platform} is not valid, please choose from #{PLATFORMS.keys.sort.join(', ')}"
  end
end

#set_default_pattern_compiler(id, p = platform) ⇒ Object

Set a (already created) pattern compiler as the default for current or specified platform



68
69
70
# File 'lib/origen_testers/pattern_compilers.rb', line 68

def set_default_pattern_compiler(id, p = platform)
  @default_pattern_compiler[p.to_sym] = id
end

#verify_unique_platform_id(id, platform, options = {}) ⇒ Object

Check compiler instance name is unique for given platform



92
93
94
95
96
97
98
# File 'lib/origen_testers/pattern_compilers.rb', line 92

def verify_unique_platform_id(id, platform, options = {})
  if @pattern_compilers[platform].keys.include? id
    fail_msg = "Compiler ID #{id} for platform #{platform} already exists! "
    fail_msg += 'Pick another name, delete the compiler, or clear all compilers'
    fail fail_msg
  end
end