Class: AdLint::Cc1::MemoryBlock

Inherits:
Memory
  • Object
show all
Defined in:
lib/adlint/cc1/object.rb

Instance Attribute Summary collapse

Attributes inherited from Memory

#address, #byte_size

Attributes included from Bindable

#binding

Instance Method Summary collapse

Methods inherited from Memory

#_cascade_update, #dynamic?, #read, #static?

Methods included from Bindable

#be_alias_to, #bind_to

Constructor Details

#initialize(addr, byte_size) ⇒ MemoryBlock

Returns a new instance of MemoryBlock.



1195
1196
1197
1198
# File 'lib/adlint/cc1/object.rb', line 1195

def initialize(addr, byte_size)
  super
  @windows = []
end

Instance Attribute Details

#windowsObject (readonly)

Returns the value of attribute windows.



1200
1201
1202
# File 'lib/adlint/cc1/object.rb', line 1200

def windows
  @windows
end

Instance Method Details

#_orig_writeObject



1215
# File 'lib/adlint/cc1/object.rb', line 1215

alias :_orig_write :write

#create_unmapped_windowObject



1209
1210
1211
1212
1213
# File 'lib/adlint/cc1/object.rb', line 1209

def create_unmapped_window
  UnmappedMemoryWindow.new(self).tap do |win|
    win.on_written += method(:handle_written_through_window)
  end
end

#create_window(offset, byte_size) ⇒ Object



1202
1203
1204
1205
1206
1207
# File 'lib/adlint/cc1/object.rb', line 1202

def create_window(offset, byte_size)
  MemoryWindow.new(self, @address + offset, byte_size).tap do |win|
    win.on_written += method(:handle_written_through_window)
    @windows.push(win)
  end
end

#write(val, src, br) ⇒ Object



1216
1217
1218
1219
1220
1221
1222
1223
1224
# File 'lib/adlint/cc1/object.rb', line 1216

def write(val, src, br)
  super
  if !@windows.empty? and
      @value.array? && val.array? or @value.composite? && val.composite?
    @windows.zip(val.to_single_value.values).each do |win, inner_val|
      win.write(inner_val, src, br, false)
    end
  end
end