Class: Udb::Mmr
- Inherits:
-
TopLevelDatabaseObject
- Object
- DatabaseObject
- TopLevelDatabaseObject
- Udb::Mmr
- Includes:
- HasFields
- Defined in:
- lib/udb/obj/mmr.rb
Overview
Memory-Mapped Register (MMR) definition
MMRs are registers accessed via physical memory addresses rather than the CSR address space. They reuse the same field definitions as CSRs but have a physical address instead of a 12-bit CSR address, and no privilege mode or IDL sw_read/sw_write integration.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from DatabaseObject
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#base ⇒ nil
MMRs have no base restriction.
- #bitfield_type(cfg_arch, effective_xlen = nil) ⇒ Object
-
#defined_in_all_bases? ⇒ Boolean
True if this MMR is defined regardless of the effective XLEN.
-
#defined_in_base32? ⇒ Boolean
True if this MMR is defined when XLEN is 32.
-
#defined_in_base64? ⇒ Boolean
True if this MMR is defined when XLEN is 64.
-
#defined_in_base?(xlen) ⇒ Boolean
True if this MMR is defined when XLEN is xlen.
-
#dynamic_length? ⇒ Boolean
False – MMR lengths are always static.
- #exists_in_cfg?(cfg_arch) ⇒ Boolean
-
#format_changes_with_xlen? ⇒ Boolean
Whether or not the format changes with XLEN (always false for MMR).
-
#length(_effective_xlen = nil) ⇒ Integer
Length in bits of the register.
-
#length_pretty(_effective_xlen = nil) ⇒ String
Pretty-printed length string.
- #long_name ⇒ Object
- #max_length ⇒ Object
-
#min_length ⇒ Integer
Smallest length of the MMR (same as length since it’s always fixed).
-
#physical_address ⇒ Integer
Physical memory address of the register.
- #priv_mode ⇒ Object
Methods included from HasFields
#affected_by?, #field, #field?, #field_hash, #fields, #fields_for, #optional_in_cfg?, #possible_fields, #possible_fields_for, #wavedrom_desc, #writable
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::TopLevelDatabaseObject
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/udb/obj/mmr.rb', line 23 def name @name end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/udb/obj/mmr.rb', line 25 def ==(other) if other.is_a?(Mmr) name == other.name else raise ArgumentError, "Mmr is not comparable to #{other.class.name}" end end |
#base ⇒ nil
Returns MMRs have no base restriction.
81 |
# File 'lib/udb/obj/mmr.rb', line 81 def base = nil |
#bitfield_type(cfg_arch, effective_xlen = nil) ⇒ Object
101 |
# File 'lib/udb/obj/mmr.rb', line 101 def bitfield_type(cfg_arch, effective_xlen = nil) = raise NotImplementedError, "MMR does not have a bitfield type" |
#defined_in_all_bases? ⇒ Boolean
Returns true if this MMR is defined regardless of the effective XLEN.
75 |
# File 'lib/udb/obj/mmr.rb', line 75 def defined_in_all_bases? = true |
#defined_in_base32? ⇒ Boolean
Returns true if this MMR is defined when XLEN is 32.
69 |
# File 'lib/udb/obj/mmr.rb', line 69 def defined_in_base32? = true |
#defined_in_base64? ⇒ Boolean
Returns true if this MMR is defined when XLEN is 64.
72 |
# File 'lib/udb/obj/mmr.rb', line 72 def defined_in_base64? = true |
#defined_in_base?(xlen) ⇒ Boolean
Returns true if this MMR is defined when XLEN is xlen.
78 |
# File 'lib/udb/obj/mmr.rb', line 78 def defined_in_base?(xlen) = true |
#dynamic_length? ⇒ Boolean
Returns false – MMR lengths are always static.
64 65 66 |
# File 'lib/udb/obj/mmr.rb', line 64 def dynamic_length? false end |
#exists_in_cfg?(cfg_arch) ⇒ Boolean
91 92 93 |
# File 'lib/udb/obj/mmr.rb', line 91 def exists_in_cfg?(cfg_arch) @exists_in_cfg ||= defined_by_condition.could_be_satisfied_by_cfg_arch?(cfg_arch) end |
#format_changes_with_xlen? ⇒ Boolean
Returns Whether or not the format changes with XLEN (always false for MMR).
84 85 86 |
# File 'lib/udb/obj/mmr.rb', line 84 def format_changes_with_xlen? false end |
#length(_effective_xlen = nil) ⇒ Integer
Returns Length in bits of the register.
43 44 45 |
# File 'lib/udb/obj/mmr.rb', line 43 def length(_effective_xlen = nil) @data["length"] end |
#length_pretty(_effective_xlen = nil) ⇒ String
Returns Pretty-printed length string.
59 60 61 |
# File 'lib/udb/obj/mmr.rb', line 59 def length_pretty(_effective_xlen = nil) "#{@data['length']}-bit" end |
#long_name ⇒ Object
38 39 40 |
# File 'lib/udb/obj/mmr.rb', line 38 def long_name @data["long_name"] end |
#max_length ⇒ Object
49 50 51 |
# File 'lib/udb/obj/mmr.rb', line 49 def max_length @data["length"] end |
#min_length ⇒ Integer
Returns Smallest length of the MMR (same as length since it’s always fixed).
54 55 56 |
# File 'lib/udb/obj/mmr.rb', line 54 def min_length @data["length"] end |
#physical_address ⇒ Integer
Returns Physical memory address of the register.
34 35 36 |
# File 'lib/udb/obj/mmr.rb', line 34 def physical_address @data["physical_address"] end |
#priv_mode ⇒ Object
98 |
# File 'lib/udb/obj/mmr.rb', line 98 def priv_mode = raise NotImplementedError, "MMR does not have a privilege mode" |