Package mars.tools

Class FloatRepresentation

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Observer, Accessible, RootPaneContainer, WindowConstants, MarsTool

public class FloatRepresentation extends AbstractMarsToolAndApplication
Tool to help students learn about IEEE 754 representation of 32 bit floating point values. This representation is used by MIPS "float" directive and instructions and also the Java (and most other languages) "float" data type. As written, it can ALMOST be adapted to 64 bit by changing a few constants.
See Also:
Serialized Form
  • Constructor Details

    • FloatRepresentation

      public FloatRepresentation(String title, String heading)
      Simple constructor, likely used to run a stand-alone memory reference visualizer.
      Parameters:
      title - String containing title for title bar
      heading - String containing text for heading shown in upper part of window.
    • FloatRepresentation

      public FloatRepresentation()
      Simple constructor, likely used by the MARS Tools menu mechanism
  • Method Details

    • main

      public static void main(String[] args)
      Main provided for pure stand-alone use. Recommended stand-alone use is to write a driver program that instantiates a FloatRepresentation object then invokes its go() method. "stand-alone" means it is not invoked from the MARS Tools menu. "Pure" means there is no driver program to invoke the application.
    • getName

      public String getName()
      Fetch tool name (for display in MARS Tools menu)
      Specified by:
      getName in interface MarsTool
      Specified by:
      getName in class AbstractMarsToolAndApplication
      Returns:
      String containing tool name
    • update

      public void update(Observable register, Object accessNotice)
      Override inherited update() to update display when "attached" register is modified either by MIPS program or by user editing it on the MARS user interface. The latter is the reason for overriding the inherited update() method. The inherited method will filter out notices triggered by the MARS GUI or the user.
      Specified by:
      update in interface Observer
      Overrides:
      update in class AbstractMarsToolAndApplication
      Parameters:
      register - the attached register
      accessNotice - information provided by register in RegisterAccessNotice object