cse378.cache
Class Cache

java.lang.Object
  extended by cse378.AbstractCache
      extended by cse378.cache.Cache

public class Cache
extends AbstractCache

Cache for CSE 378 lab 5


Field Summary
 
Fields inherited from class cse378.AbstractCache
blockBits, blockSize, cachelines, cleanMisses, dirtyMisses, hits, lineBits, numLines, numSets, stat
 
Constructor Summary
Cache(Component c, int lines, int sets, int blockSize)
           
 
Method Summary
protected  BitField computeIndex(cse378.address.PhysicalAddress location)
          Compute the index of a particular location
protected  BitField computeTag(cse378.address.PhysicalAddress location)
          Compute the tag for a particular location.
protected  CacheLine getLine(BitField index)
          Get the line addressed by the index
private  void initStatus(cse378.address.PhysicalAddress addr)
           
 void load(cse378.address.PhysicalAddress addr)
          Signal a read from the cache
 void store(cse378.address.PhysicalAddress addr)
          Signal a write to Cache
 
Methods inherited from class cse378.AbstractCache
getCleanMisses, getCounts, getDirtyMisses, getHits, getInfo, getStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(Component c,
             int lines,
             int sets,
             int blockSize)
Method Detail

getLine

protected CacheLine getLine(BitField index)
Get the line addressed by the index

Specified by:
getLine in class AbstractCache
Parameters:
index - a BitField specifying the index
Returns:
AbstractLine addressed by the index

initStatus

private void initStatus(cse378.address.PhysicalAddress addr)

load

public void load(cse378.address.PhysicalAddress addr)
Signal a read from the cache

Specified by:
load in class AbstractCache
Parameters:
addr - Physical Address of the load

store

public void store(cse378.address.PhysicalAddress addr)
Signal a write to Cache

Specified by:
store in class AbstractCache
Parameters:
addr - physical address of the load target

computeIndex

protected BitField computeIndex(cse378.address.PhysicalAddress location)
Compute the index of a particular location

Specified by:
computeIndex in class AbstractCache
Parameters:
location - location in memory to be wrote to
Returns:
integer that indexes into the lines in the cache

computeTag

protected BitField computeTag(cse378.address.PhysicalAddress location)
Compute the tag for a particular location. The tag uniquely identifies the location given a line ( and set )

Specified by:
computeTag in class AbstractCache
Parameters:
location - location in memory to be wrote to
Returns:
tag that uniquely identifies a memory location