Class: Udb::ProcCertModel

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

Overview

Holds information about a processor certificate model YAML file. The inherited “data” member is the database of extensions, instructions, CSRs, etc.

Defined Under Namespace

Classes: Requirement, RequirementGroup

Instance Method Summary collapse

Constructor Details

#initialize(obj_yaml, yaml_path, arch) ⇒ ProcCertModel

Returns a new instance of ProcCertModel.

Parameters:

  • obj_yaml (Hash<String, Object>)

    Contains contents of Certificate Model yaml file (put in @data)

  • data_path (String)

    Path to yaml file

  • arch (Architecture)

    Database of RISC-V standards



33
34
35
# File 'lib/udb/obj/certificate.rb', line 33

def initialize(obj_yaml, yaml_path, arch)
  super # Calls parent class with the same args I got
end

Instance Method Details

#all_in_scope_exts_with_param(param) ⇒ Array<Extension>

Returns Sorted list of all in-scope extensions that define this parameter in the database and the parameter is in-scope.

Parameters:

Returns:

  • (Array<Extension>)

    Sorted list of all in-scope extensions that define this parameter in the database and the parameter is in-scope.

Raises:

  • (ArgumentError)


210
211
212
213
214
215
216
217
218
# File 'lib/udb/obj/certificate.rb', line 210

def all_in_scope_exts_with_param(param)
  raise ArgumentError, "Expecting Parameter" unless param.is_a?(Parameter)

  # Iterate through all the extensions in the architecture database that define this parameter.
  in_scope_extensions.select do |potential_ext|
    param.requirements_condition.mentions?(potential_ext) &&
      (param.requirements_condition & potential_ext.to_condition)
  end.sort_by!(&:name)
end

#all_in_scope_exts_without_param(param) ⇒ Array<Extension>

Returns List of all in-scope extensions that define this parameter in the database but the parameter is out-of-scope.

Parameters:

Returns:

  • (Array<Extension>)

    List of all in-scope extensions that define this parameter in the database but the parameter is out-of-scope.

Raises:

  • (ArgumentError)


223
224
225
226
227
# File 'lib/udb/obj/certificate.rb', line 223

def all_in_scope_exts_without_param(param)
  raise ArgumentError, "Expecting Parameter" unless param.is_a?(Parameter)

  all_in_scope_exts_with_param(param)
end

#all_in_scope_paramsArray<InScopeParameter>

These are always IN-SCOPE by definition (since they are listed in the portfolio). Can have multiple array entries with the same parameter name since multiple extensions may define the same parameter.

Returns:

  • (Array<InScopeParameter>)

    Sorted list of parameters specified by any extension in portfolio.



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/udb/obj/certificate.rb', line 164

def all_in_scope_params
  return @all_in_scope_params unless @all_in_scope_params.nil?

  @all_in_scope_params = []

  @data["param_constraints"]&.each do |param_name, param_data|
    param = @arch.param(param_name)
    if param.nil?
      cond_param = ext.conditional_params.find { |p| p.param.name == param_name }
      raise "There is no param '#{param_name}' in extension '#{ext_name}" if cond_param.nil?
      param = cond_param.param
    end
    @all_in_scope_params << InScopeParameter.new(param, param_data["schema"], param_data["note"])
  # next unless param.defined_by_condition.satisfied_by_cfg_arch?(to_cfg_arch) == SatisfiedResult::Yes
  end

  @all_in_scope_params << InScopeParameter.new(@arch.param("MXLEN"), { "const" => @data["base"] }, "")
  @all_in_scope_params.sort!
end

#all_out_of_scope_paramsArray<Parameter>

Returns Sorted list of parameters out of scope across all in scope extensions (those listed as mandatory or optional in the certificate model).

Returns:

  • (Array<Parameter>)

    Sorted list of parameters out of scope across all in scope extensions (those listed as mandatory or optional in the certificate model).



186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/udb/obj/certificate.rb', line 186

def all_out_of_scope_params
  return @all_out_of_scope_params unless @all_out_of_scope_params.nil?

  @all_out_of_scope_params = []
  in_scope_ext_reqs.each do |ext_req|
    ext = @arch.extension(ext_req.name)
    ext.params.each do |param|
      next if all_in_scope_params.any? { |c| c.param.name == param.name }

      @all_out_of_scope_params << param
    end
  end
  @all_out_of_scope_params.sort!
end

#debug_manual_revisionObject



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

def debug_manual_revision = @data["debug_manual_revision"]

#in_scope_priv_modesObject



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

def in_scope_priv_modes = @data["in_scope_priv_modes"]

#out_of_scope_params(ext_name) ⇒ Array<Parameter>

Returns Sorted list of parameters that are out of scope for named extension.

Parameters:

  • ext_name (String)

    Extension name

Returns:

  • (Array<Parameter>)

    Sorted list of parameters that are out of scope for named extension.



203
204
205
# File 'lib/udb/obj/certificate.rb', line 203

def out_of_scope_params(ext_name)
  all_out_of_scope_params.select { |param| param.defined_by_condition.mentions?(@arch.extension(ext_name)) && param.defined_by_condition.satisfied_by_cfg_arch?(to_cfg_arch) == SatisfiedResult::Yes }.sort
end

#priv_isa_manual_revisionObject



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

def priv_isa_manual_revision = @data["priv_isa_manual_revision"]

#proc_cert_classProcCertClass

Returns The certification class that this model belongs to.

Returns:

  • (ProcCertClass)

    The certification class that this model belongs to.



54
55
56
57
58
59
# File 'lib/udb/obj/certificate.rb', line 54

def proc_cert_class
  proc_cert_class = @arch.ref(@data["class"]["$ref"])
  raise "No processor certificate class named '#{@data["class"]}'" if proc_cert_class.nil?

  proc_cert_class
end

#requirement_groupsArray<RequirementGroup>

Returns The list of requirement groups.

Returns:



146
147
148
149
150
151
152
153
154
# File 'lib/udb/obj/certificate.rb', line 146

def requirement_groups
  return @requirement_groups unless @requirement_groups.nil?

  @requirement_groups = []
  @data["requirement_groups"]&.each do |req_key, req_group|
    @requirement_groups << RequirementGroup.new(req_group, @arch) unless req_key == "$child_of" || req_key == "$parent_of"
  end
  @requirement_groups
end

#tsc_profile_releaseObject



41
42
43
44
45
46
47
48
49
# File 'lib/udb/obj/certificate.rb', line 41

def tsc_profile_release
  return nil if @data["tsc_profile_release"].nil?

  profile_release = @arch.ref(@data["tsc_profile_release"]["$ref"])

  raise "No profile release called '#{@data["tsc_profile_release"]}' exists" if profile_release.nil?

  profile_release
end

#unpriv_isa_manual_revisionObject



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

def unpriv_isa_manual_revision = @data["unpriv_isa_manual_revision"]