Class BufferStateTracker<A extends java.lang.Number>

  • Type Parameters:
    A - address type.

    public final class BufferStateTracker<A extends java.lang.Number>
    extends java.lang.Object
    BufferStateTracker implements a simplified buffer used to imitate data replacement logic.
    • Constructor Summary

      Constructors 
      Constructor Description
      BufferStateTracker​(long sets, long ways, AddressView<A> addressView)
      Constructs a buffer state tracker.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getSets()
      Returns the number of sets (index range).
      long getWays()
      Returns the number of ways (associativity).
      void reset()
      Resets the buffer state.
      int size()
      Returns the number of items stored in the buffer.
      int size​(int i)
      Returns the number of items stored in the i-th set of the buffer.
      A track​(A address)
      Imitates access to the buffer (updates the buffer state).
      • Methods inherited from class java.lang.Object

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

      • BufferStateTracker

        public BufferStateTracker​(long sets,
                                  long ways,
                                  AddressView<A> addressView)
        Constructs a buffer state tracker.
        Parameters:
        sets - the number of sets (index range).
        ways - the number of ways (associativity).
        addressView - the address view.
    • Method Detail

      • getSets

        public long getSets()
        Returns the number of sets (index range).
        Returns:
        the number of sets.
      • getWays

        public long getWays()
        Returns the number of ways (associativity).
        Returns:
        the number of ways.
      • reset

        public void reset()
        Resets the buffer state.
      • size

        public int size()
        Returns the number of items stored in the buffer.
        Returns:
        the number of items.
      • size

        public int size​(int i)
        Returns the number of items stored in the i-th set of the buffer.
        Parameters:
        i - the set index.
        Returns:
        the number of items.
      • track

        public A track​(A address)
        Imitates access to the buffer (updates the buffer state).
        Parameters:
        address - the address being accessed.
        Returns:
        the tag having being replaced or null.