Class: Udb::ProcCertModel::Requirement

Inherits:
Object
  • Object
show all
Defined in:
lib/udb/obj/certificate.rb

Overview

Holds extra requirements not associated with extensions or their parameters.

Instance Method Summary collapse

Constructor Details

#initialize(data, arch) ⇒ Requirement

Returns a new instance of Requirement.

Parameters:

  • data (Hash<String, Object>)

    Data from yaml

  • arch (Architecture)

    Architecture standards

Raises:

  • (ArgumentError)


68
69
70
71
72
73
74
# File 'lib/udb/obj/certificate.rb', line 68

def initialize(data, arch)
  raise ArgumentError, "Bad data" unless data.is_a?(Hash)
  raise ArgumentError, "Need Architecture class but it's a #{arch.class}" unless arch.is_a?(Architecture)

  @data = data
  @arch = arch
end

Instance Method Details

#descriptionObject



77
# File 'lib/udb/obj/certificate.rb', line 77

def description = @data["description"]

#nameObject



76
# File 'lib/udb/obj/certificate.rb', line 76

def name = @data["name"]

#whenObject



78
# File 'lib/udb/obj/certificate.rb', line 78

def when = @data["when"]

#when_prettyObject



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/udb/obj/certificate.rb', line 80

def when_pretty
  @data["when"].keys.map do |key|
    case key
    when "xlen"
      "XLEN == #{@data["when"]["xlen"]}"
    when "param"
      @data["when"]["param"].map do |param_name, param_value|
        "Parameter #{param_name} == #{param_value}"
      end
    else
      raise "Type #{key} not implemented"
    end
  end.flatten.join(" and ")
end