lib/origen/registers/reg.rb
# Returns the register address added to its current base_address value (if any).
#
# @param [Hash] options
# @option options [Boolean] :relative (false) Return the address without adding the base address (if present)
Returns the register address added to its current base_address value (if any).
Returns the register address added to its current base_address value ( if any ) .
def address(options = {})
        options = {
          relative: false
        }.merge(options)
        address = @address
        domain_option = options[:domains] || options[:domain]
        @domain_option ||= domain_option unless frozen?
        @base_address_applied = nil unless @domain_option == domain_option
        unless @base_address_applied
          if (writer && writer.methods.include?(:base_address) && writer.method(:base_address).arity != 0) ||
             (reader && reader.methods.include?(:base_address) && reader.method(:base_address).arity != 0)
            if writer && writer.respond_to?(:base_address) && writer.method(:base_address).arity != 0
              self.base_address = writer.base_address(self)
            elsif reader && reader.respond_to?(:base_address) && reader.method(:base_address).arity != 0
              self.base_address = reader.base_address(self)
            end
          else
            o = owner.is_a?(Container) ? owner.owner : owner
            d = domain_option || domains
            if o && o.reg_base_address(domain: d)
              self.base_address = o.reg_base_address(domain: d)
            end
          end
          @base_address_applied = true
        end
        unless options[:relative]
          address += base_address if base_address
        end
        if options[:address_type]
          Origen.deprecate 'Specifying the address_type of a register address will be removed from Origen 3'
          case options[:address_type]
            when :byte
              address = address * 2
            when :word
              address = address
            when :longword
              address = address / 2
            else
              fail 'Unknown address type requested!'
          end
        end
        address
      end
def address ( options = { } ) options = { relative : false } . merge ( options ) address = @address domain_option = options [ :domains ] || options [ :domain ] @domain_option ||= domain_option unless frozen? @base_address_applied = nil unless @domain_option == domain_option unless @base_address_applied if ( writer && writer . methods . include? ( :base_address ) && writer . method ( :base_address ) . arity != 0 ) || ( reader && reader . methods . include? ( :base_address ) && reader . method ( :base_address ) . arity != 0 ) if writer && writer . respond_to? ( :base_address ) && writer . method ( :base_address ) . arity != 0 self . base_address = writer . base_address ( self ) elsif reader && reader . respond_to? ( :base_address ) && reader . method ( :base_address ) . arity != 0 self . base_address = reader . base_address ( self ) end else o = owner . is_a? ( Container ) ? owner . owner : owner d = domain_option || domains if o && o . reg_base_address ( domain : d ) self . base_address = o . reg_base_address ( domain : d ) end end @base_address_applied = true end unless options [ :relative ] address += base_address if base_address end if options [ :address_type ] Origen . deprecate 'Specifying the address_type of a register address will be removed from Origen 3' case options [ :address_type ] when :byte address = address * 2 when :word address = address when :longword address = address / 2 else fail 'Unknown address type requested!' end end address end
Returns the register address added to its current base_address value (if any).
Returns the register address added to its current base_address value ( if any ) .
# Blow the cache when the domain option changes # Give highest priority to the original API which allowed the object # doing register read/write to define a base_address method # This currently assumes that the base address is always the same # for reading and writing
options
:relative (false) Return the address without adding the base address (if present)
: relative ( false ) Return the address without adding the base address ( if present )
<not_specific>
None