Class MemoryBank

    • Constructor Detail

      • MemoryBank

        public MemoryBank​(AddressSpace spc,
                          boolean isBigEndian,
                          int ps,
                          MemoryFaultHandler faultHandler)
        A MemoryBank must be associated with a specific address space, have a preferred or natural pagesize. The pagesize must be a power of 2.
        Parameters:
        spc - is the associated address space
        isBigEndian - memory endianess
        ps - ps is the number of bytes in a page (must be a power of 2)
        faultHandler - memory fault handler
    • Method Detail

      • getMemoryFaultHandler

        public MemoryFaultHandler getMemoryFaultHandler()
        Returns:
        memory fault handler (may be null)
      • isBigEndian

        public boolean isBigEndian()
        Returns:
        true if memory bank is big endian
      • getPageSize

        public int getPageSize()
        A MemoryBank is instantiated with a \e natural page size. Requests for large chunks of data may be broken down into units of this size.
        Returns:
        the number of bytes in a page.
      • getInitializedMaskSize

        public int getInitializedMaskSize()
        Returns:
        the size of a page initialized mask in bytes. Each bit within the mask corresponds to a data byte within a page.
      • getSpace

        public AddressSpace getSpace()
        Returns:
        the AddressSpace associated with this bank.
      • getPage

        protected abstract MemoryPage getPage​(long addr)
      • setPage

        protected abstract void setPage​(long addr,
                                        byte[] val,
                                        int skip,
                                        int size,
                                        int bufOffset)
      • setPageInitialized

        protected abstract void setPageInitialized​(long addr,
                                                   boolean initialized,
                                                   int skip,
                                                   int size,
                                                   int bufOffset)
      • setChunk

        public void setChunk​(long offset,
                             int size,
                             byte[] val)
      • setInitialized

        public void setInitialized​(long offset,
                                   int size,
                                   boolean initialized)
      • getChunk

        public int getChunk​(long addrOffset,
                            int size,
                            byte[] res,
                            boolean stopOnUnintialized)
      • constructValue

        public static long constructValue​(byte[] ptr,
                                          int offset,
                                          int size,
                                          boolean bigendian)
      • deconstructValue

        public static void deconstructValue​(byte[] ptr,
                                            int offset,
                                            long val,
                                            int size,
                                            boolean bigendian)