Class: OrigenTesters::IGXLBasedTester::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/igxl_based_tester/parser.rb,
lib/origen_testers/igxl_based_tester/parser/flow.rb,
lib/origen_testers/igxl_based_tester/parser/flows.rb,
lib/origen_testers/igxl_based_tester/parser/ac_spec.rb,
lib/origen_testers/igxl_based_tester/parser/dc_spec.rb,
lib/origen_testers/igxl_based_tester/parser/timeset.rb,
lib/origen_testers/igxl_based_tester/parser/dc_specs.rb,
lib/origen_testers/igxl_based_tester/parser/flow_line.rb,
lib/origen_testers/igxl_based_tester/parser/pattern_set.rb,
lib/origen_testers/igxl_based_tester/parser/descriptions.rb,
lib/origen_testers/igxl_based_tester/parser/pattern_sets.rb,
lib/origen_testers/igxl_based_tester/parser/test_instance.rb,
lib/origen_testers/igxl_based_tester/parser/test_instances.rb

Defined Under Namespace

Classes: ACSpec, DCSpec, DCSpecs, Descriptions, Flow, FlowLine, Flows, PatternSet, PatternSets, TestInstance, TestInstances, Timeset

Instance Method Summary collapse

Instance Method Details

#ac_specsObject



49
50
51
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 49

def ac_specs
  @ac_specs ||= ACSpecs.new(parser: self)
end

#dc_specsObject



45
46
47
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 45

def dc_specs
  @dc_specs ||= DCSpecs.new(parser: self)
end

#descriptionsObject



25
26
27
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 25

def descriptions
  @descriptions ||= Descriptions.new(parser: self)
end

#flowsObject

Returns an array of test flows



30
31
32
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 30

def flows
  @flows ||= Flows.new(parser: self)
end

#inspectObject



53
54
55
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 53

def inspect
  "<Parsed Program: Flows: #{flows.size}>"
end

#parse(file) ⇒ Object

Parse a file, array of files, or a directory.

This can be called multiple times to add new files to the program model.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 61

def parse(file)
  Origen.log.info ''
  Origen.log.info "Parsing J750 test program from: #{file}"
  Origen.log.info ''
  reset
  # Note use of local file handler here, this should be how it is
  # done globally, otherwise we can run into hard to debug problems
  # due to state/reference dir changes in the single Origen.file_handler
  Origen::FileHandler.new.resolve_files(file) do |f|
    parse_file(f)
  end
  Origen.log.info ''
  self
end

#parse_file(file) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 76

def parse_file(file)
  line = File.readlines(file).first
  begin
    if line =~ /Flow Table/
      flows.import(file)
    elsif line =~ /Instances/
      test_instances.import(file)
    elsif line =~ /Pattern Sets/
      patsets.import(file)
    elsif line =~ /DC Spec/
      dc_specs.import(file)
    else
      puts "Skipped (un-supported file type): #{file}"
    end
  rescue Exception => e
    if e.is_a?(ArgumentError) && e.message =~ /invalid byte sequence/
      puts "Skipped (not ASCII): #{file}"
    else
      puts e.message
      puts e.backtrace
      exit 1
    end
  end
end

#pattern_setsObject Also known as: patsets, pat_sets



39
40
41
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 39

def pattern_sets
  @pattern_sets ||= PatternSets.new(parser: self)
end

#resetObject



17
18
19
20
21
22
23
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 17

def reset
  @flows = nil
  @test_instances = nil
  @pattern_sets = nil
  @dc_specs = nil
  @ac_specs = nil
end

#test_instancesObject Also known as: instances



34
35
36
# File 'lib/origen_testers/igxl_based_tester/parser.rb', line 34

def test_instances
  @test_instances ||= TestInstances.new(parser: self)
end