Class: OrigenTesters::IGXLBasedTester::Base::Patset

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/igxl_based_tester/base/patset.rb

Direct Known Subclasses

J750::Patset, UltraFLEX::Patset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attrs = {}) ⇒ Patset

Specify multiple patterns by passing an array of attributes as the 2nd argument:

Patset.new("mrd1_pset", :pattern => "nvm_mrd1.PAT")

Patset.new("mrd1_pset", [{:pattern => "nvm_mrd1.PAT"},
                         {:pattern => "nvm_global_subs.PAT, :start_label => "subr"}
                        ])

15
16
17
18
19
20
21
22
23
24
25
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 15

def initialize(name, attrs = {})
  attrs = [attrs] unless attrs.is_a? Array
  attrs.each do |pattrs|
    if pattrs[:pattern]
      pat = Pathname.new(pattrs[:pattern].gsub('\\', '/')).basename('.*').to_s
      Origen.interface.referenced_patterns << pat
    end
    lines << platform::PatsetPattern.new(name, pattrs)
  end
  self.name = name
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.


5
6
7
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 5

def index
  @index
end

Instance Method Details

#==(other_patset) ⇒ Object


27
28
29
30
31
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 27

def ==(other_patset)
  self.class == other_patset.class &&
    name.to_s == other_patset.name.to_s &&
    sorted_pattern_files == other_patset.sorted_pattern_files
end

#linesObject

Returns all lines in the pattern set


44
45
46
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 44

def lines
  @lines ||= []
end

#nameObject


33
34
35
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 33

def name
  @name
end

#name=(n) ⇒ Object


37
38
39
40
41
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 37

def name=(n)
  @name = n
  lines.each { |l| l.pattern_set = n }
  n
end

#platformObject


62
63
64
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 62

def platform
  Origen.interface.platform
end

#sorted_pattern_filesObject

Returns all pattern files in the pattern set in alphabetical order


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

def sorted_pattern_files
  @lines.map(&:file_name).sort
end

#to_sObject

Returns the fully formatted pattern set for insertion into a patset sheet


54
55
56
57
58
59
60
# File 'lib/origen_testers/igxl_based_tester/base/patset.rb', line 54

def to_s
  l = ''
  lines.each do |line|
    l += "#{line}\r\n"
  end
  l.chomp
end