Class: Udb::Profile
- Inherits:
-
Portfolio
- Object
- DatabaseObject
- TopLevelDatabaseObject
- Portfolio
- Udb::Profile
- Defined in:
- lib/udb/obj/profile.rb
Overview
Representation of a specific profile in a profile release.
Instance Attribute Summary
Attributes inherited from DatabaseObject
#arch, #data, #data_path, #long_name, #name
Instance Method Summary collapse
-
#base ⇒ 32, 64
The base XLEN for the profile.
- #ext_note_to_adoc(ext_name) ⇒ Array<String>
- #ext_req_to_adoc(ext_req) ⇒ Array<String>
-
#extensions_to_adoc(presence_type, heading_level) ⇒ Array<String>
Too complicated to put in profile ERB template.
-
#marketing_name ⇒ String
The marketing name of the Profile.
-
#mode ⇒ "M", ...
Privilege mode for the profile.
-
#profile_family ⇒ ProfileFamily
The profile family this profile belongs to.
-
#profile_release ⇒ ProfileRelease
The profile release this profile belongs to.
Methods inherited from Portfolio
#all_in_scope_exts_with_param, #all_in_scope_exts_without_param, #all_in_scope_params, #all_out_of_scope_params, #cfg_arch_for_config_data, #csr_presence, #csr_presence_obj, #description, #extension_note, #extension_presence, #extension_presence_obj, #extra_notes, #extra_notes_for_presence, #in_scope_csrs, #in_scope_exception_codes, #in_scope_ext_reqs, #in_scope_extensions, #in_scope_instructions, #in_scope_interrupt_codes, #in_scope_min_satisfying_extension_versions, #in_scope_params, #initialize, #instruction_presence, #instruction_presence_obj, #introduction, #mandatory_ext_reqs, #optional_ext_reqs, #out_of_scope_params, #recommendations, #requirements_condition, #revision_history, #to_cfg_arch, #to_cfg_arch_for_optional, #to_config, #to_strict_config, #uses_optional_types?, #version, #version_greatest_presence
Methods inherited from TopLevelDatabaseObject
create_json_schemer_resolver, #initialize, #key?, #keys, #validate
Methods inherited from DatabaseObject
#<=>, #__source, #cfg_arch, #cfg_arch?, #clone, #defer, #defined_by_condition, #description, #initialize, #inspect, #kind, #source_line
Constructor Details
This class inherits a constructor from Udb::Portfolio
Instance Method Details
#base ⇒ 32, 64
Returns The base XLEN for the profile.
195 196 197 |
# File 'lib/udb/obj/profile.rb', line 195 def base @data["base"] end |
#ext_note_to_adoc(ext_name) ⇒ Array<String>
266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/udb/obj/profile.rb', line 266 def ext_note_to_adoc(ext_name) ret = [] unless extension_note(ext_name).nil? ret << "+" ret << "[NOTE]" ret << "--" ret << extension_note(ext_name) ret << "--" end ret end |
#ext_req_to_adoc(ext_req) ⇒ Array<String>
253 254 255 256 257 258 259 260 261 262 |
# File 'lib/udb/obj/profile.rb', line 253 def ext_req_to_adoc(ext_req) ret = [] ext = arch.extension(ext_req.name) ret << "* *#{ext_req.name}* " + (ext.nil? ? "" : ext.long_name) ret << "+" ret << "Version #{ext_req.requirement_specs_to_s_pretty}" ret end |
#extensions_to_adoc(presence_type, heading_level) ⇒ Array<String>
Too complicated to put in profile ERB template.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/udb/obj/profile.rb', line 203 def extensions_to_adoc(presence_type, heading_level) ret = [] presence_ext_reqs = in_scope_ext_reqs(presence_type) plural = (presence_ext_reqs.size == 1) ? "" : "s" ret << "The #{marketing_name} Profile has #{presence_ext_reqs.size} #{presence_type} extension#{plural}." ret << "" unless presence_ext_reqs.empty? if (presence_type == "optional") && uses_optional_types? # Iterate through each optional type. Use object version (not string) to get # precise comparisons (i.e., presence string and optional type string). [Presence::ExpansionOption, Presence::LocalizedOption, Presence::DevelopmentOption, Presence::TransitoryOption].each do |optional_type_obj| optional_type_ext_reqs = in_scope_ext_reqs(optional_type_obj) unless optional_type_ext_reqs.empty? ret << "" ret << ("=" * heading_level) + " #{optional_type_obj.optional_type.capitalize} Options" optional_type_ext_reqs.each do |ext_req| ret << ext_req_to_adoc(ext_req) ret << ext_note_to_adoc(ext_req.name) end # each ext_req end # unless optional_type_ext_reqs empty # Add extra notes that just belong to just this optional type. extra_notes_for_presence(optional_type_obj)&.each do |extra_note| ret << "NOTE: #{extra_note.text}" ret << "" end # each extra_note end # each optional_type_obj else # don't bother with optional types presence_ext_reqs.each do |ext_req| ret << ext_req_to_adoc(ext_req) ret << ext_note_to_adoc(ext_req.name) end # each ext_req end # checking for optional types end # presence_ext_reqs isn't empty # Add extra notes that just belong to this presence. # Use object version (not string) of presence to avoid adding extra notes # already added for optional types if they are in use. extra_notes_for_presence(Presence.from_yaml(presence_type))&.each do |extra_note| ret << "NOTE: #{extra_note.text}" ret << "" end # each extra_note ret end |
#marketing_name ⇒ String
Returns The marketing name of the Profile.
176 |
# File 'lib/udb/obj/profile.rb', line 176 def marketing_name = @data["marketing_name"] |
#mode ⇒ "M", ...
Returns Privilege mode for the profile.
190 191 192 |
# File 'lib/udb/obj/profile.rb', line 190 def mode @data["mode"] end |
#profile_family ⇒ ProfileFamily
Returns The profile family this profile belongs to.
187 |
# File 'lib/udb/obj/profile.rb', line 187 def profile_family = profile_release.profile_family |
#profile_release ⇒ ProfileRelease
Returns The profile release this profile belongs to.
179 180 181 182 183 184 |
# File 'lib/udb/obj/profile.rb', line 179 def profile_release profile_release = @arch.ref(@data["release"]["$ref"]) raise "No profile release named '#{@data["release"]["$ref"]}'" if profile_release.nil? profile_release end |