Interface Memory.Listener

All Superinterfaces:
EventListener
All Known Implementing Classes:
AbstractMarsTool, BHTSimulator, BitmapDisplay, CacheSimulator, DataSegmentWindow, DigitalLabSimulator, FloatRepresentation, InstructionCounter, InstructionStatistics, IntroToTools, KeyboardAndDisplaySimulator, MemoryReferenceVisualization, MipsXray, TextSegmentWindow, VisualStack
Enclosing class:
Memory

public static interface Memory.Listener extends EventListener
Interface representing a listener of memory read/write operations. When attached to memory via Memory.addListener(Listener, int, int) or an overload, it is bound to a range of memory addresses. Any operations on memory outside of that range will not notify the listener. Note that a listener can be bound to multiple memory ranges simultaneously.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    memoryRead(int address, int length, int value, int wordAddress, int wordValue)
    Invoked upon any read operation which is relevant to this listener's active range.
    default void
    Invoked when memory is reset via a call to Memory.reset(), regardless of this listener's active range.
    default void
    memoryWritten(int address, int length, int value, int wordAddress, int wordValue)
    Invoked upon any write operation which is relevant to this listener's active range.
  • Method Details

    • memoryWritten

      default void memoryWritten(int address, int length, int value, int wordAddress, int wordValue)
      Invoked upon any write operation which is relevant to this listener's active range. Does nothing by default.
      Parameters:
      address - The address which was written to.
      length - The number of bytes written. Will always be 1 (single byte), Memory.BYTES_PER_HALFWORD, or Memory.BYTES_PER_WORD.
      value - The value which was written.
      wordAddress - The address of the word affected by the operation.
      wordValue - The resulting value of the word.
    • memoryRead

      default void memoryRead(int address, int length, int value, int wordAddress, int wordValue)
      Invoked upon any read operation which is relevant to this listener's active range. Does nothing by default.
      Parameters:
      address - The address which was read from.
      length - The number of bytes read. Will always be 1 (single byte), Memory.BYTES_PER_HALFWORD, or Memory.BYTES_PER_WORD.
      value - The value which was read.
      wordAddress - The address of the word affected by the operation.
      wordValue - The full value of the word.
    • memoryReset

      default void memoryReset()
      Invoked when memory is reset via a call to Memory.reset(), regardless of this listener's active range. Does nothing by default.