Class: OrigenMemoryImage::IntelHex

Inherits:
Base
  • Object
show all
Defined in:
lib/origen_memory_image/intel_hex.rb

Instance Attribute Summary

Attributes inherited from Base

#file, #source

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#file_name, #flip_endianness, #has_start_record, #initialize, #lines, #to_a

Constructor Details

This class inherits a constructor from OrigenMemoryImage::Base

Class Method Details

.match?(snippet) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
# File 'lib/origen_memory_image/intel_hex.rb', line 3

def self.match?(snippet)
  snippet.all? do |line|
    line.empty? || line =~ /^:[0-9A-Fa-f]{6}0[0-5]/
  end
end

Instance Method Details

#start_addressObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/origen_memory_image/intel_hex.rb', line 9

def start_address
  @start_address ||= begin
    addrs = []
    lines.each do |line|
      line = line.strip
      if start_linear_address?(line)
        addrs << decode(line)[:data].to_i(16)
      end
    end
    addrs.last || 0
  end
end