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 Method Summary collapse
- #all_in_scope_params ⇒ Object
-
#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.
Constructor Details
This class inherits a constructor from Udb::Portfolio
Instance Method Details
#all_in_scope_params ⇒ Object
199 200 201 |
# File 'lib/udb/obj/profile.rb', line 199 def all_in_scope_params [Portfolio::InScopeParameter.new(@cfg_arch.param("MXLEN"), { "const" => @data["base"] }, "")] end |
#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>
270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/udb/obj/profile.rb', line 270 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>
257 258 259 260 261 262 263 264 265 266 |
# File 'lib/udb/obj/profile.rb', line 257 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.
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 250 251 252 253 |
# File 'lib/udb/obj/profile.rb', line 207 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 |