module Origen::Errata

Attributes

_errata[W]
_sw_workarounds[W]

Public Instance Methods

errata(options = {}) click to toggle source

Returns an erratum or list of erratum that meet a specific criteria

# File lib/origen/errata.rb, line 17
def errata(options = {})
  options = {
    id:          nil,
    ip_block:    nil,
    disposition: nil
  }.update(options)
  return nil if @_errata.nil?
  return nil if @_errata.empty?

  errata_found = Hash.new do |h, k|
    h[k] = Hash.new do |hh, kk|
      hh[kk] = {}
    end
  end

  # First filter on id, then ip_block, then disposition
  filter_hash(@_errata, options[:id]).each do |id, hash|
    filter_hash(hash, options[:ip_block]).each do |ip_block, hash1|
      filter_hash(hash1, options[:disposition]).each do |disposition, errata|
        errata_found[id][ip_block][disposition] = errata
      end
    end
  end

  # Return nil if there are no errata that meet criteria
  if errata_found.empty?
    nil
  # If only one errata meets criteria, return that HwErratum object
  elsif errata_found.size == 1
    errata_found.values.first.values.first.values.first
  else
    errata_found
  end
end
erratum(id, ip_block, overview = {}, status = {}, sw_workaround = {}) click to toggle source

Define and instantiate an erratum object

# File lib/origen/errata.rb, line 11
def erratum(id, ip_block, overview = {}, status = {}, sw_workaround = {})
  _errata
  @_errata[id][ip_block][status[:disposition]] = HwErratum.new(id, ip_block, overview, status, sw_workaround)
end
sw_workaround(id, overview = {}, resolution = {}) click to toggle source

Define and instantiate a sw_workaround object

# File lib/origen/errata.rb, line 53
def sw_workaround(id, overview = {}, resolution = {})
  _sw_workarounds
  @_sw_workarounds[id] = SwErratumWorkaround.new(id, overview, resolution)
end
sw_workarounds(options = {}) click to toggle source

Returns a sw_workaround object with a specific id

# File lib/origen/errata.rb, line 59
def sw_workarounds(options = {})
  options = {
    id: nil
  }.update(options)
  return nil if @_sw_workarounds.nil?
  return nil if @_sw_workarounds.empty?

  sw_workarounds_found = Hash.new do |h, k|
    h[k] = {}
  end

  # filter on id
  filter_hash(@_sw_workarounds, options[:id]).each do |id, workarounds|
    sw_workarounds_found[id] = workarounds
  end
  if sw_workarounds_found.empty?
    nil
  elsif sw_workarounds_found.size == 1
    sw_workarounds_found.values.first # .values.first
  else
    sw_workarounds_found
  end
end

Private Instance Methods

_errata() click to toggle source
# File lib/origen/errata.rb, line 85
def _errata
  @_errata ||= Hash.new do |h, k|
    h[k] = Hash.new do |hh, kk|
      hh[kk] = {}
    end
  end
end
_sw_workarounds() click to toggle source
# File lib/origen/errata.rb, line 93
def _sw_workarounds
  @_sw_workarounds ||= {}
end