Class: Origen::Tester::J750::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/origen/tester/j750/parser.rb,
lib/origen/tester/j750/parser/flow.rb,
lib/origen/tester/j750/parser/flows.rb,
lib/origen/tester/j750/parser/dc_spec.rb,
lib/origen/tester/j750/parser/ac_spec.rb,
lib/origen/tester/j750/parser/timeset.rb,
lib/origen/tester/j750/parser/dc_specs.rb,
lib/origen/tester/j750/parser/flow_line.rb,
lib/origen/tester/j750/parser/pattern_set.rb,
lib/origen/tester/j750/parser/pattern_sets.rb,
lib/origen/tester/j750/parser/descriptions.rb,
lib/origen/tester/j750/parser/test_instance.rb,
lib/origen/tester/j750/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

- (Object) ac_specs



50
51
52
# File 'lib/origen/tester/j750/parser.rb', line 50

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

- (Object) dc_specs



46
47
48
# File 'lib/origen/tester/j750/parser.rb', line 46

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

- (Object) descriptions



26
27
28
# File 'lib/origen/tester/j750/parser.rb', line 26

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

- (Object) flows

Returns an array of test flows



31
32
33
# File 'lib/origen/tester/j750/parser.rb', line 31

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

- (Object) inspect



54
55
56
# File 'lib/origen/tester/j750/parser.rb', line 54

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

- (Object) parse(file)

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

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/origen/tester/j750/parser.rb', line 62

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

- (Object) parse_file(file)



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

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

- (Object) pattern_sets Also known as: patsets, pat_sets



40
41
42
# File 'lib/origen/tester/j750/parser.rb', line 40

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

- (Object) reset



18
19
20
21
22
23
24
# File 'lib/origen/tester/j750/parser.rb', line 18

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

- (Object) test_instances Also known as: instances



35
36
37
# File 'lib/origen/tester/j750/parser.rb', line 35

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