Package ru.ispras.microtesk.mmu.basis
Class BufferStateTracker<A extends java.lang.Number>
- java.lang.Object
-
- ru.ispras.microtesk.mmu.basis.BufferStateTracker<A>
-
- 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).
-
-
-
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.
-
-