Module: Origen::Errata

Defined in:
lib/origen/errata.rb,
lib/origen/errata/hw_erratum.rb,
lib/origen/errata/sw_erratum_workaround.rb

Defined Under Namespace

Classes: HwErratum, SwErratumWorkaround

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_errata=(value) ⇒ Object

Sets the attribute _errata

Parameters:

  • value

    the value to set the attribute _errata to.


6
7
8
# File 'lib/origen/errata.rb', line 6

def _errata=(value)
  @_errata = value
end

#_sw_workarounds=(value) ⇒ Object

Sets the attribute _sw_workarounds

Parameters:

  • value

    the value to set the attribute _sw_workarounds to.


8
9
10
# File 'lib/origen/errata.rb', line 8

def _sw_workarounds=(value)
  @_sw_workarounds = value
end

Instance Method Details

#errata(options = {}) ⇒ Object

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


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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?
    return 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
    return errata_found
  end
end

#erratum(id, ip_block, overview = {}, status = {}, sw_workaround = {}) ⇒ Object

Define and instantiate an erratum object


11
12
13
14
# 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 = {}) ⇒ Object

Define and instantiate a sw_workaround object


53
54
55
56
# 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 = {}) ⇒ Object

Returns a sw_workaround object with a specific id


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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?
    return nil
  elsif sw_workarounds_found.size == 1
    sw_workarounds_found.values.first # .values.first
  else
    return sw_workarounds_found
  end
end