Class: OrigenMemoryImage::Hex
- Defined in:
- lib/origen_memory_image/hex.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#start_address ⇒ Object
The first in the file will be taken as the start address.
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
3 4 5 6 7 8 9 |
# File 'lib/origen_memory_image/hex.rb', line 3 def self.match?(snippet) snippet.any? do |line| # Match a line like: # @180000F0 line =~ /^@[0-9a-fA-F]+\s?$/ end end |
Instance Method Details
#start_address ⇒ Object
The first in the file will be taken as the start address
12 13 14 15 16 17 18 19 20 |
# File 'lib/origen_memory_image/hex.rb', line 12 def start_address @start_address ||= begin lines.each do |line| if line =~ /^@([0-9a-fA-F]+)\s?$/ return Regexp.last_match[1].to_i(16) end end end end |