Package mars.tools

Class MemoryReferenceVisualization

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, Memory.Listener, MarsTool

public class MemoryReferenceVisualization extends AbstractMarsTool
Memory reference visualization. Pete Sanderson, verison 1.0, 14 November 2006.
See Also:
  • Constructor Details

    • MemoryReferenceVisualization

      public MemoryReferenceVisualization()
      Construct an instance of this tool. This will be used by the ToolManager.
  • Method Details

    • getName

      public String getName()
      Required MarsTool method to return Tool name.
      Specified by:
      getName in interface MarsTool
      Specified by:
      getName in class AbstractMarsTool
      Returns:
      Tool name. MARS will display this in menu item.
    • startObserving

      protected void startObserving()
      Override the inherited method, which registers us as an Observer over the static data segment (starting address 0x10010000) only. This version will register us as observer over the the memory range as selected by the base address combo box and capacity of the visualization display (number of visualization elements times the number of memory words each one represents).
      Overrides:
      startObserving in class AbstractMarsTool
      See Also:
    • stopObserving

      protected void stopObserving()
      Description copied from class: AbstractMarsTool
      Unregister this tool as a listener of memory and/or registers, if applicable. This method is called when the tool is closed by the user. Does nothing by default.
      Overrides:
      stopObserving in class AbstractMarsTool
      See Also:
    • buildMainDisplayArea

      protected JComponent buildMainDisplayArea()
      Method that constructs the main display area. It is organized vertically into two major components: the display configuration which an be modified using combo boxes, and the visualization display which is updated as the attached MIPS program executes.
      Specified by:
      buildMainDisplayArea in class AbstractMarsTool
      Returns:
      the GUI component containing these two areas
    • memoryRead

      public void memoryRead(int address, int length, int value, int wordAddress, int wordValue)
      Update display when connected MIPS program accesses memory.
      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.
    • memoryWritten

      public void memoryWritten(int address, int length, int value, int wordAddress, int wordValue)
      Update display when connected MIPS program accesses memory.
      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.
    • initializePreGUI

      protected void initializePreGUI()
      Initialize all JComboBox choice structures not already initialized at declaration. Overrides inherited method that does nothing.
      Overrides:
      initializePreGUI in class AbstractMarsTool
    • initializePostGUI

      protected void initializePostGUI()
      The only post-GUI initialization is to create the initial Grid object based on the default settings of the various combo boxes. Overrides inherited method that does nothing.
      Overrides:
      initializePostGUI in class AbstractMarsTool
    • reset

      protected void reset()
      Method to reset counters and display when the Reset button selected. Overrides inherited method that does nothing.
      Overrides:
      reset in class AbstractMarsTool
    • getHelpComponent

      protected JComponent getHelpComponent()
      Overrides default method, to provide a Help button for this tool/app.
      Overrides:
      getHelpComponent in class AbstractMarsTool