Class: OrigenTesters::ATP::Processors::FlagOptimizer::ExtractRunFlagTable

Inherits:
OrigenTesters::ATP::Processor show all
Defined in:
lib/origen_testers/atp/processors/flag_optimizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OrigenTesters::ATP::Processor

#clean_flag, #extract_volatiles, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags

Constructor Details

#initializeExtractRunFlagTable

Reset hash table



35
36
37
# File 'lib/origen_testers/atp/processors/flag_optimizer.rb', line 35

def initialize
  @run_flag_table = {}.with_indifferent_access
end

Instance Attribute Details

#run_flag_tableObject (readonly)

Hash table of run_flag name with number of times used



32
33
34
# File 'lib/origen_testers/atp/processors/flag_optimizer.rb', line 32

def run_flag_table
  @run_flag_table
end

Instance Method Details

#on_if_flag(node) ⇒ Object Also known as: on_unless_flag

For run_flag nodes, increment # of occurrences for specified flag



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/origen_testers/atp/processors/flag_optimizer.rb', line 40

def on_if_flag(node)
  children = node.children.dup
  names = children.shift
  state = node.type == :if_flag
  Array(names).each do |name|
    if @run_flag_table[name.to_sym].nil?
      @run_flag_table[name.to_sym] = 1
    else
      @run_flag_table[name.to_sym] += 1
    end
  end
  process_all(node.children)
end