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.



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

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

Instance Attribute Details

#windowsObject (readonly)

Returns the value of attribute windows.



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

def windows
  @windows
end

Instance Method Details

#_orig_writeObject



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

alias :_orig_write :write

#create_unmapped_windowObject



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

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



1211
1212
1213
1214
1215
1216
# File 'lib/adlint/cc1/object.rb', line 1211

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



1225
1226
1227
1228
1229
1230
1231
1232
1233
# File 'lib/adlint/cc1/object.rb', line 1225

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