Class UniqueMemoryBank.WordInfo

  • Enclosing class:
    UniqueMemoryBank

    public static class UniqueMemoryBank.WordInfo
    extends java.lang.Object
    A simple class representing a byte-addressable word of memory. Each byte can be either initialized to a byte value or uninitialized. It is an error to attempt to read an uninitialized byte.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      byte initialized  
      long word  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte getByte​(int index)
      Returns the byte at the given index
      void getWord​(byte[] buffer)
      Writes an entire word into buffer
      protected boolean isEntireWordInitialized()
      Returns true precisely when the entire word is initialized.
      void setByte​(byte val, int index)
      Initializes the byte at index and sets its value to val
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • initialized

        public byte initialized
      • word

        public long word
    • Method Detail

      • setByte

        public void setByte​(byte val,
                            int index)
        Initializes the byte at index and sets its value to val
        Parameters:
        val - new value
        index - index
        Throws:
        LowlevelError - if the index is invalid
      • getByte

        public byte getByte​(int index)
        Returns the byte at the given index
        Parameters:
        index - index
        Returns:
        corresponding byte value
        Throws:
        LowlevelError - if the index is invalid or the requested byte is not initialized.
      • getWord

        public void getWord​(byte[] buffer)
        Writes an entire word into buffer
        Parameters:
        buffer - buffer to write a single word to. Must have length 8.
        Throws:
        LowlevelError - if the entire word is not initialized
      • isEntireWordInitialized

        protected boolean isEntireWordInitialized()
        Returns true precisely when the entire word is initialized.
        Returns:
        true if entire work initialized