added rate control for writes issued to memory system
This commit is contained in:
parent
5a4be62352
commit
b834fdbefe
|
@ -122,6 +122,17 @@ public class Cache extends SimulationElement {
|
||||||
return mshr.isMSHRFull(addr);
|
return mshr.isMSHRFull(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int maximumNumberOfOutstandingWrites;
|
||||||
|
protected int numberOfOutstandingWrites;
|
||||||
|
public void incrementNumberOfOutstandingWrites()
|
||||||
|
{
|
||||||
|
numberOfOutstandingWrites++;
|
||||||
|
}
|
||||||
|
public boolean canCacheAcceptWriteRequest()
|
||||||
|
{
|
||||||
|
return (numberOfOutstandingWrites < maximumNumberOfOutstandingWrites);
|
||||||
|
}
|
||||||
|
|
||||||
public Cache(String cacheName, int id, CacheConfig cacheParameters,
|
public Cache(String cacheName, int id, CacheConfig cacheParameters,
|
||||||
CoreMemorySystem containingMemSys) {
|
CoreMemorySystem containingMemSys) {
|
||||||
|
|
||||||
|
@ -210,6 +221,7 @@ public class Cache extends SimulationElement {
|
||||||
makeCache(cacheParameters.isDirectory);
|
makeCache(cacheParameters.isDirectory);
|
||||||
|
|
||||||
this.mshr = new MSHR(cacheConfig.mshrSize, blockSizeBits, this);
|
this.mshr = new MSHR(cacheConfig.mshrSize, blockSizeBits, this);
|
||||||
|
maximumNumberOfOutstandingWrites = cacheConfig.mshrSize;
|
||||||
|
|
||||||
this.nucaType = cacheParameters.nucaType;
|
this.nucaType = cacheParameters.nucaType;
|
||||||
|
|
||||||
|
@ -257,6 +269,10 @@ public class Cache extends SimulationElement {
|
||||||
|
|
||||||
noOfAccesses++;
|
noOfAccesses++;
|
||||||
|
|
||||||
|
if (requestType == RequestType.Cache_Write) {
|
||||||
|
numberOfOutstandingWrites--;
|
||||||
|
}
|
||||||
|
|
||||||
if(mshr.isAddrInMSHR(addr) &&
|
if(mshr.isAddrInMSHR(addr) &&
|
||||||
(requestType==RequestType.Cache_Read || requestType==RequestType.Cache_Write || requestType==RequestType.EvictCacheLine)) {
|
(requestType==RequestType.Cache_Read || requestType==RequestType.Cache_Write || requestType==RequestType.EvictCacheLine)) {
|
||||||
if(requestType==RequestType.Cache_Read || requestType==RequestType.Cache_Write)
|
if(requestType==RequestType.Cache_Read || requestType==RequestType.Cache_Write)
|
||||||
|
@ -493,6 +509,10 @@ public class Cache extends SimulationElement {
|
||||||
event = new AddressCarryingEvent(c.getEventQueue(), 0, this, c,
|
event = new AddressCarryingEvent(c.getEventQueue(), 0, this, c,
|
||||||
requestType, addr);
|
requestType, addr);
|
||||||
addEventAtLowerCache(event, c);
|
addEventAtLowerCache(event, c);
|
||||||
|
if(requestType == RequestType.Cache_Write)
|
||||||
|
{
|
||||||
|
c.incrementNumberOfOutstandingWrites();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Core core0 = ArchitecturalComponent.getCores()[0];
|
Core core0 = ArchitecturalComponent.getCores()[0];
|
||||||
|
|
|
@ -6,6 +6,7 @@ import generic.Event;
|
||||||
import generic.EventQueue;
|
import generic.EventQueue;
|
||||||
import generic.RequestType;
|
import generic.RequestType;
|
||||||
import memorysystem.AddressCarryingEvent;
|
import memorysystem.AddressCarryingEvent;
|
||||||
|
import memorysystem.Cache;
|
||||||
import memorysystem.CoreMemorySystem;
|
import memorysystem.CoreMemorySystem;
|
||||||
|
|
||||||
public class InorderCoreMemorySystem_MII extends CoreMemorySystem {
|
public class InorderCoreMemorySystem_MII extends CoreMemorySystem {
|
||||||
|
@ -48,6 +49,18 @@ public class InorderCoreMemorySystem_MII extends CoreMemorySystem {
|
||||||
if(l1Cache.isBusy(address)) {
|
if(l1Cache.isBusy(address)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(requestType == RequestType.Cache_Write)
|
||||||
|
{
|
||||||
|
Cache c = l1Cache;
|
||||||
|
while(c != null)
|
||||||
|
{
|
||||||
|
if(c.canCacheAcceptWriteRequest() == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
c = c.nextLevel;
|
||||||
|
}
|
||||||
|
this.l1Cache.incrementNumberOfOutstandingWrites();
|
||||||
|
}
|
||||||
|
|
||||||
this.l1Cache.getPort().put(addressEvent);
|
this.l1Cache.getPort().put(addressEvent);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import generic.RequestType;
|
||||||
import generic.SimulationElement;
|
import generic.SimulationElement;
|
||||||
import main.ArchitecturalComponent;
|
import main.ArchitecturalComponent;
|
||||||
import memorysystem.AddressCarryingEvent;
|
import memorysystem.AddressCarryingEvent;
|
||||||
|
import memorysystem.Cache;
|
||||||
import memorysystem.CoreMemorySystem;
|
import memorysystem.CoreMemorySystem;
|
||||||
import memorysystem.LSQEntryContainingEvent;
|
import memorysystem.LSQEntryContainingEvent;
|
||||||
import memorysystem.coherence.Directory;
|
import memorysystem.coherence.Directory;
|
||||||
|
@ -109,6 +110,18 @@ public class OutOrderCoreMemorySystem extends CoreMemorySystem {
|
||||||
if(l1Cache.isBusy(address)) {
|
if(l1Cache.isBusy(address)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(requestType == RequestType.Cache_Write)
|
||||||
|
{
|
||||||
|
Cache c = l1Cache;
|
||||||
|
while(c != null)
|
||||||
|
{
|
||||||
|
if(c.canCacheAcceptWriteRequest() == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
c = c.nextLevel;
|
||||||
|
}
|
||||||
|
this.l1Cache.incrementNumberOfOutstandingWrites();
|
||||||
|
}
|
||||||
|
|
||||||
this.l1Cache.getPort().put(addressEvent);
|
this.l1Cache.getPort().put(addressEvent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue