Class: OrigenTesters::IGXLBasedTester::Base::Patgroup

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

Direct Known Subclasses

J750::Patgroup, UltraFLEX::Patgroup

Defined Under Namespace

Classes: Pattern

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

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

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

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

60
61
62
63
64
65
66
67
68
69
70
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 60

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 << Pattern.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/patgroup.rb', line 5

def index
  @index
end

Instance Method Details

#==(other_patgroup) ⇒ Object


72
73
74
75
76
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 72

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

#linesObject

Returns all lines in the pattern set


89
90
91
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 89

def lines
  @lines ||= []
end

#nameObject


78
79
80
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 78

def name
  @name
end

#name=(n) ⇒ Object


82
83
84
85
86
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 82

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

#sorted_pattern_filesObject

Returns all pattern files in the pattern set in alphabetical order


94
95
96
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 94

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

#to_sObject

Returns the fully formatted pattern group for insertion into a patgroups sheet


99
100
101
102
103
104
105
# File 'lib/origen_testers/igxl_based_tester/base/patgroup.rb', line 99

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