Class: OrigenTesters::CallbackHandlers

Inherits:
Object
  • Object
show all
Includes:
Origen::PersistentCallbacks
Defined in:
lib/origen_testers/callback_handlers.rb

Instance Method Summary collapse

Instance Method Details

#before_pattern_lookup(requested_pattern) ⇒ Object

Listen for a pattern with .atp or .atp.gz extension. If found then compile the fileand kill the ‘origen g’ command



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/origen_testers/callback_handlers.rb', line 17

def before_pattern_lookup(requested_pattern)
  path = Pathname.new(requested_pattern)
  patname = path.basename
  dir = path.dirname
  if patname.to_s.match(/.atp/)
    if patname.extname == '.atp' || patname.extname == '.gz'
      # Found a .atp or .atp.gz file so we should compile it
      matches = Dir.glob("#{Origen.root}/**/#{patname}")
      fail "Found multiple locations for #{patname}, exiting...\n\t#{matches}" if matches.size > 1
      pattern = matches.first.to_s
      current_compiler = select_compiler
      run_compiler(current_compiler, pattern)
      $compile = true
    end
    # Return false so the Origen generate command stops
    return false
  end
  true
end

#pattern_generated(path_to_generated_pattern, job_options = {}) ⇒ Object

Snoop the pattern path that was just created and then compile it if the compiler was passed on the command line



7
8
9
10
11
12
13
14
# File 'lib/origen_testers/callback_handlers.rb', line 7

def pattern_generated(path_to_generated_pattern, job_options = {})
  if job_options[:testers_compile_pat]
    opts = {}
    opts[:compiler_instance] = job_options[:testers_compiler_instance_name]
    opts[:pattern_generated] = true
    OrigenTesters::PatternCompilers::Runner.run_compiler(path_to_generated_pattern, opts)
  end
end