Sha256: b7253c2395fa3fbed5c8d935d0a4b1e0fb82e949604bc2815eeaec20213b2c9c

Contents?: true

Size: 792 Bytes

Versions: 12

Compression:

Stored size: 792 Bytes

Contents

module OrigenARMDebug
  # Generic helper methods shared by the various controllers
  module Helpers
    def extract_data(reg_or_val, options = {})
      if reg_or_val.respond_to?('data')
        reg_or_val.data
      else
        reg_or_val
      end
    end

    def extract_address(reg_or_val, options = {})
      addr = options[:address] || options[:addr]
      return addr if addr
      return reg_or_val.address if reg_or_val.respond_to?('address')
      return reg_or_val.addr if reg_or_val.respond_to?('addr')
      fail 'No address given, if supplying a data value instead of a register object, you must supply an :address option'
    end

    def log(msg)
      cc "[ARM Debug] #{msg}"
      if block_given?
        yield
        cc "[ARM Debug] /#{msg}"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
origen_arm_debug-1.3.1 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.3.0 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.2.0 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.1.4 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.1.3 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.1.2 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.1.1 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.1.0 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.0.2 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.0.1 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.0.0 lib/origen_arm_debug/helpers.rb
origen_arm_debug-1.0.0.pre1 lib/origen_arm_debug/helpers.rb