Class: OrigenTesters::IGXLBasedTester::Parser::DCSpecs

Inherits:
Parser::SearchableHash show all
Defined in:
lib/origen_testers/igxl_based_tester/parser/dc_specs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Parser::SearchableHash

#where

Constructor Details

#initialize(options = {}) ⇒ DCSpecs

Returns a new instance of DCSpecs.



7
8
9
# File 'lib/origen_testers/igxl_based_tester/parser/dc_specs.rb', line 7

def initialize(options = {})
  @parser = options[:parser]
end

Instance Attribute Details

#parserObject

Returns the value of attribute parser.



5
6
7
# File 'lib/origen_testers/igxl_based_tester/parser/dc_specs.rb', line 5

def parser
  @parser
end

Instance Method Details

#extract_categories(components) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/origen_testers/igxl_based_tester/parser/dc_specs.rb', line 31

def extract_categories(components)
  components.each_with_index do |val, i|
    if i > 4
      @categories << val unless val.strip.empty?
    end
  end
  @categories.uniq!
end

#extract_spec(components) ⇒ Object



40
41
42
43
44
# File 'lib/origen_testers/igxl_based_tester/parser/dc_specs.rb', line 40

def extract_spec(components)
  name = components[1]
  self[name] ||= DCSpec.new(name, @categories, parser: parser)
  self[name].add_values(components)
end

#import(file) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/origen_testers/igxl_based_tester/parser/dc_specs.rb', line 11

def import(file)
  @categories = []
  File.readlines(file).each do |line|
    unless line.strip.empty?
      components = line.split("\t")
      if components[3] == 'Selector'
        extract_categories(components)
      else
        unless components[1] == 'DC Specs' || components[1] == 'Symbol'
          extract_spec(components)
        end
      end
    end
  end
end

#inspectObject



27
28
29
# File 'lib/origen_testers/igxl_based_tester/parser/dc_specs.rb', line 27

def inspect
  "<DCSpecs: #{size}>"
end