- java.lang.Object
-
- ru.ispras.microtesk.mmu.model.sim.CacheLine<E,A>
-
- Type Parameters:
E
- the entry type.A
- the address type.
- All Implemented Interfaces:
Buffer<E,A>
,ReplaceableBuffer<E,A>
,SnoopController<E,A>
public class CacheLine<E extends Struct<?>,A extends Address<?>> extends java.lang.Object implements ReplaceableBuffer<E,A>, SnoopController<E,A>
CacheLine
represents a cache line.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allocEntry(A address)
Allocates an invalid entry in the buffer and associates it w/ the given address.boolean
evictEntry(ReplaceableBuffer<?,A> initiator, A address)
Evicts the entry associated w/ the given address from the buffer.A
getAddress()
E
getEntry()
Buffer<?,A>
getNext()
Returns the next-level buffer.java.lang.Enum<?>
getState()
boolean
isHit(A address)
Checks whether the given address hits the buffer.boolean
isValid()
E
readEntry(A address)
Reads the entry associated w/ the given address from the buffer.ru.ispras.fortress.util.Pair<E,java.lang.Boolean>
readEntry(A address, boolean invalidate)
Reads the entry associated w/ the given address and, if required, invalidates it.void
resetState()
Resets the state of the buffer.void
setAddress(A address)
void
setEntry(ru.ispras.fortress.data.types.bitvector.BitVector entry)
ru.ispras.fortress.util.Pair<E,java.lang.Boolean>
snoopEvict(A address, ru.ispras.fortress.data.types.bitvector.BitVector oldEntry)
Snoops an evict transaction from another cache unit.ru.ispras.fortress.util.Pair<E,java.lang.Boolean>
snoopRead(A address, ru.ispras.fortress.data.types.bitvector.BitVector oldEntry, boolean invalidate)
Snoops a read transaction from another cache unit.ru.ispras.fortress.util.Pair<E,java.lang.Boolean>
snoopWrite(A address, ru.ispras.fortress.data.types.bitvector.BitVector newEntry)
Snoops a write transaction from another cache unit.java.lang.String
toString()
void
writeEntry(A address, int lower, int upper, ru.ispras.fortress.data.types.bitvector.BitVector newData)
Writes the data associated w/ the given address into the given field of the entry.void
writeEntry(A address, ru.ispras.fortress.data.types.bitvector.BitVector newEntry)
Writes the entry associated w/ the given address into the buffer.
-
-
-
Method Detail
-
isValid
public final boolean isValid()
-
getEntry
public final E getEntry()
-
setEntry
public final void setEntry(ru.ispras.fortress.data.types.bitvector.BitVector entry)
-
getAddress
public final A getAddress()
-
setAddress
public final void setAddress(A address)
-
getState
public final java.lang.Enum<?> getState()
-
isHit
public boolean isHit(A address)
Description copied from interface:Buffer
Checks whether the given address hits the buffer.
-
readEntry
public E readEntry(A address)
Description copied from interface:Buffer
Reads the entry associated w/ the given address from the buffer.
-
readEntry
public ru.ispras.fortress.util.Pair<E,java.lang.Boolean> readEntry(A address, boolean invalidate)
Description copied from interface:ReplaceableBuffer
Reads the entry associated w/ the given address and, if required, invalidates it.
-
writeEntry
public void writeEntry(A address, ru.ispras.fortress.data.types.bitvector.BitVector newEntry)
Description copied from interface:Buffer
Writes the entry associated w/ the given address into the buffer.Note that an incoming entry is not necessarily of the
E
type. It may be returned from the previous- or next-level cache unit (thus, be different). It is the method's responsibility to convert the entry to the specified type.
-
writeEntry
public void writeEntry(A address, int lower, int upper, ru.ispras.fortress.data.types.bitvector.BitVector newData)
Description copied from interface:Buffer
Writes the data associated w/ the given address into the given field of the entry.
-
allocEntry
public void allocEntry(A address)
Description copied from interface:ReplaceableBuffer
Allocates an invalid entry in the buffer and associates it w/ the given address.- Specified by:
allocEntry
in interfaceReplaceableBuffer<E extends Struct<?>,A extends Address<?>>
- Parameters:
address
- the address.
-
evictEntry
public boolean evictEntry(ReplaceableBuffer<?,A> initiator, A address)
Description copied from interface:ReplaceableBuffer
Evicts the entry associated w/ the given address from the buffer.- Specified by:
evictEntry
in interfaceReplaceableBuffer<E extends Struct<?>,A extends Address<?>>
- Parameters:
initiator
- the buffer that initiates the operation.address
- the address.- Returns:
true
iff the entry is not dirty or it has been synchronized w/ the storage.
-
snoopRead
public final ru.ispras.fortress.util.Pair<E,java.lang.Boolean> snoopRead(A address, ru.ispras.fortress.data.types.bitvector.BitVector oldEntry, boolean invalidate)
Description copied from interface:SnoopController
Snoops a read transaction from another cache unit.
-
snoopWrite
public final ru.ispras.fortress.util.Pair<E,java.lang.Boolean> snoopWrite(A address, ru.ispras.fortress.data.types.bitvector.BitVector newEntry)
Description copied from interface:SnoopController
Snoops a write transaction from another cache unit.- Specified by:
snoopWrite
in interfaceSnoopController<E extends Struct<?>,A extends Address<?>>
- Parameters:
address
- the address used in the transaction.newEntry
- the updated entry ornull
.- Returns:
- the local entry w/ the dirty bit or
null
.
-
snoopEvict
public final ru.ispras.fortress.util.Pair<E,java.lang.Boolean> snoopEvict(A address, ru.ispras.fortress.data.types.bitvector.BitVector oldEntry)
Description copied from interface:SnoopController
Snoops an evict transaction from another cache unit.- Specified by:
snoopEvict
in interfaceSnoopController<E extends Struct<?>,A extends Address<?>>
- Parameters:
address
- the address used in the transaction.oldEntry
- the entry being evicted.- Returns:
- the local entry w/ the dirty bit or
null
.
-
getNext
public final Buffer<?,A> getNext()
Description copied from interface:ReplaceableBuffer
Returns the next-level buffer.
-
resetState
public void resetState()
Description copied from interface:Buffer
Resets the state of the buffer.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-