ruby: MOESI_CMP_token updates to use the new config system
This commit is contained in:
@@ -33,14 +33,16 @@
|
||||
*/
|
||||
|
||||
machine(L1Cache, "Token protocol")
|
||||
: int l1_request_latency,
|
||||
int l1_response_latency,
|
||||
int l2_select_low_bit,
|
||||
: Sequencer * sequencer,
|
||||
CacheMemory * L1IcacheMemory,
|
||||
CacheMemory * L1DcacheMemory,
|
||||
int l2_select_num_bits,
|
||||
int N_tokens,
|
||||
int retry_threshold,
|
||||
int fixed_timeout_latency,
|
||||
bool dynamic_timeout_enabled
|
||||
int l1_request_latency = 2,
|
||||
int l1_response_latency = 2,
|
||||
int retry_threshold = 1,
|
||||
int fixed_timeout_latency = 300,
|
||||
bool dynamic_timeout_enabled = true
|
||||
{
|
||||
|
||||
// From this node's L1 cache TO the network
|
||||
@@ -147,16 +149,6 @@ machine(L1Cache, "Token protocol")
|
||||
PrefetchBit Prefetch, desc="Is this a prefetch request";
|
||||
}
|
||||
|
||||
external_type(CacheMemory) {
|
||||
bool cacheAvail(Address);
|
||||
Address cacheProbe(Address);
|
||||
void allocate(Address, Entry);
|
||||
void deallocate(Address);
|
||||
Entry lookup(Address);
|
||||
void changePermission(Address, AccessPermission);
|
||||
bool isTagPresent(Address);
|
||||
}
|
||||
|
||||
external_type(TBETable) {
|
||||
TBE lookup(Address);
|
||||
void allocate(Address);
|
||||
@@ -177,13 +169,11 @@ machine(L1Cache, "Token protocol")
|
||||
}
|
||||
|
||||
TBETable L1_TBEs, template_hack="<L1Cache_TBE>";
|
||||
CacheMemory L1IcacheMemory, factory='RubySystem::getCache(m_cfg["icache"])';
|
||||
CacheMemory L1DcacheMemory, factory='RubySystem::getCache(m_cfg["dcache"])';
|
||||
|
||||
MessageBuffer mandatoryQueue, ordered="false", abstract_chip_ptr="true";
|
||||
Sequencer sequencer, factory='RubySystem::getSequencer(m_cfg["sequencer"])';
|
||||
|
||||
bool starving, default="false";
|
||||
int l2_select_low_bit, default="RubySystem::getBlockSizeBits()";
|
||||
|
||||
PersistentTable persistentTable;
|
||||
TimerTable useTimerTable;
|
||||
@@ -218,17 +208,17 @@ machine(L1Cache, "Token protocol")
|
||||
|
||||
Entry getCacheEntry(Address addr), return_by_ref="yes" {
|
||||
if (L1DcacheMemory.isTagPresent(addr)) {
|
||||
return L1DcacheMemory[addr];
|
||||
return static_cast(Entry, L1DcacheMemory[addr]);
|
||||
} else {
|
||||
return L1IcacheMemory[addr];
|
||||
return static_cast(Entry, L1IcacheMemory[addr]);
|
||||
}
|
||||
}
|
||||
|
||||
int getTokens(Address addr) {
|
||||
if (L1DcacheMemory.isTagPresent(addr)) {
|
||||
return L1DcacheMemory[addr].Tokens;
|
||||
return static_cast(Entry, L1DcacheMemory[addr]).Tokens;
|
||||
} else if (L1IcacheMemory.isTagPresent(addr)) {
|
||||
return L1IcacheMemory[addr].Tokens;
|
||||
return static_cast(Entry, L1IcacheMemory[addr]).Tokens;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,11 @@
|
||||
*/
|
||||
|
||||
machine(L2Cache, "Token protocol")
|
||||
: int l2_request_latency,
|
||||
int l2_response_latency,
|
||||
: CacheMemory * L2cacheMemory,
|
||||
int N_tokens,
|
||||
bool filtering_enabled
|
||||
int l2_request_latency = 10,
|
||||
int l2_response_latency = 10,
|
||||
bool filtering_enabled = true
|
||||
{
|
||||
|
||||
// L2 BANK QUEUES
|
||||
@@ -125,17 +126,6 @@ machine(L2Cache, "Token protocol")
|
||||
bool exclusive, default="false", desc="if local exclusive is likely";
|
||||
}
|
||||
|
||||
external_type(CacheMemory) {
|
||||
bool cacheAvail(Address);
|
||||
Address cacheProbe(Address);
|
||||
void allocate(Address, Entry);
|
||||
void deallocate(Address);
|
||||
Entry lookup(Address);
|
||||
void changePermission(Address, AccessPermission);
|
||||
bool isTagPresent(Address);
|
||||
void setMRU(Address);
|
||||
}
|
||||
|
||||
external_type(PerfectCacheMemory) {
|
||||
void allocate(Address);
|
||||
void deallocate(Address);
|
||||
@@ -154,22 +144,20 @@ machine(L2Cache, "Token protocol")
|
||||
int countReadStarvingForAddress(Address);
|
||||
}
|
||||
|
||||
CacheMemory L2cacheMemory, factory='RubySystem::getCache(m_cfg["cache"])';
|
||||
|
||||
PersistentTable persistentTable;
|
||||
PerfectCacheMemory localDirectory, template_hack="<L2Cache_DirEntry>";
|
||||
|
||||
Entry getL2CacheEntry(Address addr), return_by_ref="yes" {
|
||||
if (L2cacheMemory.isTagPresent(addr)) {
|
||||
return L2cacheMemory[addr];
|
||||
return static_cast(Entry, L2cacheMemory[addr]);
|
||||
}
|
||||
assert(false);
|
||||
return L2cacheMemory[addr];
|
||||
return static_cast(Entry, L2cacheMemory[addr]);
|
||||
}
|
||||
|
||||
int getTokens(Address addr) {
|
||||
if (L2cacheMemory.isTagPresent(addr)) {
|
||||
return L2cacheMemory[addr].Tokens;
|
||||
return getL2CacheEntry(addr).Tokens;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
|
||||
|
||||
machine(Directory, "Token protocol")
|
||||
: int directory_latency,
|
||||
int l2_select_low_bit,
|
||||
: DirectoryMemory * directory,
|
||||
MemoryControl * memBuffer,
|
||||
int l2_select_num_bits,
|
||||
bool distributed_persistent,
|
||||
int fixed_timeout_latency
|
||||
int directory_latency = 6,
|
||||
bool distributed_persistent = true,
|
||||
int fixed_timeout_latency = 300
|
||||
{
|
||||
|
||||
MessageBuffer dmaResponseFromDir, network="To", virtual_network="0", ordered="true";
|
||||
@@ -104,7 +105,7 @@ machine(Directory, "Token protocol")
|
||||
// TYPES
|
||||
|
||||
// DirectoryEntry
|
||||
structure(Entry, desc="...") {
|
||||
structure(Entry, desc="...", interface="AbstractEntry") {
|
||||
State DirectoryState, desc="Directory state";
|
||||
DataBlock DataBlk, desc="data for the block";
|
||||
int Tokens, default="max_tokens()", desc="Number of tokens for the line we're holding";
|
||||
@@ -118,15 +119,6 @@ machine(Directory, "Token protocol")
|
||||
Set Sharers, desc="Probable sharers of the line. More accurately, the set of processors who need to see a GetX";
|
||||
}
|
||||
|
||||
external_type(DirectoryMemory) {
|
||||
Entry lookup(Address);
|
||||
bool isPresent(Address);
|
||||
}
|
||||
|
||||
external_type(MemoryControl, inport="yes", outport="yes") {
|
||||
|
||||
}
|
||||
|
||||
external_type(PersistentTable) {
|
||||
void persistentRequestLock(Address, MachineID, AccessType);
|
||||
void persistentRequestUnlock(Address, MachineID);
|
||||
@@ -159,22 +151,23 @@ machine(Directory, "Token protocol")
|
||||
|
||||
// ** OBJECTS **
|
||||
|
||||
DirectoryMemory directory, factory='RubySystem::getDirectory(m_cfg["directory_name"])';
|
||||
|
||||
MemoryControl memBuffer, factory='RubySystem::getMemoryControl(m_cfg["memory_controller_name"])';
|
||||
|
||||
PersistentTable persistentTable;
|
||||
TimerTable reissueTimerTable;
|
||||
|
||||
TBETable TBEs, template_hack="<Directory_TBE>";
|
||||
|
||||
bool starving, default="false";
|
||||
int l2_select_low_bit, default="RubySystem::getBlockSizeBits()";
|
||||
|
||||
Entry getDirectoryEntry(Address addr), return_by_ref="yes" {
|
||||
return static_cast(Entry, directory[addr]);
|
||||
}
|
||||
|
||||
State getState(Address addr) {
|
||||
if (TBEs.isPresent(addr)) {
|
||||
return TBEs[addr].TBEState;
|
||||
} else {
|
||||
return directory[addr].DirectoryState;
|
||||
return getDirectoryEntry(addr).DirectoryState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,22 +175,22 @@ machine(Directory, "Token protocol")
|
||||
if (TBEs.isPresent(addr)) {
|
||||
TBEs[addr].TBEState := state;
|
||||
}
|
||||
directory[addr].DirectoryState := state;
|
||||
getDirectoryEntry(addr).DirectoryState := state;
|
||||
|
||||
if (state == State:L) {
|
||||
assert(directory[addr].Tokens == 0);
|
||||
assert(getDirectoryEntry(addr).Tokens == 0);
|
||||
}
|
||||
|
||||
// We have one or zero owners
|
||||
assert((directory[addr].Owner.count() == 0) || (directory[addr].Owner.count() == 1));
|
||||
assert((getDirectoryEntry(addr).Owner.count() == 0) || (getDirectoryEntry(addr).Owner.count() == 1));
|
||||
|
||||
// Make sure the token count is in range
|
||||
assert(directory[addr].Tokens >= 0);
|
||||
assert(directory[addr].Tokens <= max_tokens());
|
||||
assert(getDirectoryEntry(addr).Tokens >= 0);
|
||||
assert(getDirectoryEntry(addr).Tokens <= max_tokens());
|
||||
|
||||
if (state == State:O) {
|
||||
assert(directory[addr].Tokens >= 1); // Must have at least one token
|
||||
// assert(directory[addr].Tokens >= (max_tokens() / 2)); // Only mostly true; this might not always hold
|
||||
assert(getDirectoryEntry(addr).Tokens >= 1); // Must have at least one token
|
||||
// assert(getDirectoryEntry(addr).Tokens >= (max_tokens() / 2)); // Only mostly true; this might not always hold
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +242,7 @@ machine(Directory, "Token protocol")
|
||||
if (responseNetwork_in.isReady()) {
|
||||
peek(responseNetwork_in, ResponseMsg) {
|
||||
assert(in_msg.Destination.isElement(machineID));
|
||||
if (directory[in_msg.Address].Tokens + in_msg.Tokens == max_tokens()) {
|
||||
if (getDirectoryEntry(in_msg.Address).Tokens + in_msg.Tokens == max_tokens()) {
|
||||
if ((in_msg.Type == CoherenceResponseType:DATA_OWNER) ||
|
||||
(in_msg.Type == CoherenceResponseType:DATA_SHARED)) {
|
||||
trigger(Event:Data_All_Tokens, in_msg.Address);
|
||||
@@ -338,7 +331,7 @@ machine(Directory, "Token protocol")
|
||||
if (in_msg.Type == DMARequestType:READ) {
|
||||
trigger(Event:DMA_READ, in_msg.LineAddress);
|
||||
} else if (in_msg.Type == DMARequestType:WRITE) {
|
||||
if (directory[in_msg.LineAddress].Tokens == max_tokens()) {
|
||||
if (getDirectoryEntry(in_msg.LineAddress).Tokens == max_tokens()) {
|
||||
trigger(Event:DMA_WRITE_All_Tokens, in_msg.LineAddress);
|
||||
} else {
|
||||
trigger(Event:DMA_WRITE, in_msg.LineAddress);
|
||||
@@ -354,7 +347,7 @@ machine(Directory, "Token protocol")
|
||||
|
||||
action(a_sendTokens, "a", desc="Send tokens to requestor") {
|
||||
// Only send a message if we have tokens to send
|
||||
if (directory[address].Tokens > 0) {
|
||||
if (getDirectoryEntry(address).Tokens > 0) {
|
||||
peek(requestNetwork_in, RequestMsg) {
|
||||
// enqueue(responseNetwork_out, ResponseMsg, latency="DIRECTORY_CACHE_LATENCY") {// FIXME?
|
||||
enqueue(responseNetwork_out, ResponseMsg, latency=directory_latency) {// FIXME?
|
||||
@@ -363,11 +356,11 @@ machine(Directory, "Token protocol")
|
||||
out_msg.Sender := machineID;
|
||||
out_msg.SenderMachine := MachineType:Directory;
|
||||
out_msg.Destination.add(in_msg.Requestor);
|
||||
out_msg.Tokens := directory[in_msg.Address].Tokens;
|
||||
out_msg.Tokens := getDirectoryEntry(in_msg.Address).Tokens;
|
||||
out_msg.MessageSize := MessageSizeType:Response_Control;
|
||||
}
|
||||
}
|
||||
directory[address].Tokens := 0;
|
||||
getDirectoryEntry(address).Tokens := 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +412,7 @@ machine(Directory, "Token protocol")
|
||||
//
|
||||
// Assser that we only send message if we don't already have all the tokens
|
||||
//
|
||||
assert(directory[address].Tokens != max_tokens());
|
||||
assert(getDirectoryEntry(address).Tokens != max_tokens());
|
||||
enqueue(requestNetwork_out, RequestMsg, latency = "1") {
|
||||
out_msg.Address := address;
|
||||
out_msg.Type := CoherenceRequestType:GETX;
|
||||
@@ -513,7 +506,7 @@ machine(Directory, "Token protocol")
|
||||
|
||||
action(aa_sendTokensToStarver, "\a", desc="Send tokens to starver") {
|
||||
// Only send a message if we have tokens to send
|
||||
if (directory[address].Tokens > 0) {
|
||||
if (getDirectoryEntry(address).Tokens > 0) {
|
||||
// enqueue(responseNetwork_out, ResponseMsg, latency="DIRECTORY_CACHE_LATENCY") {// FIXME?
|
||||
enqueue(responseNetwork_out, ResponseMsg, latency=directory_latency) {// FIXME?
|
||||
out_msg.Address := address;
|
||||
@@ -521,10 +514,10 @@ machine(Directory, "Token protocol")
|
||||
out_msg.Sender := machineID;
|
||||
out_msg.SenderMachine := MachineType:Directory;
|
||||
out_msg.Destination.add(persistentTable.findSmallest(address));
|
||||
out_msg.Tokens := directory[address].Tokens;
|
||||
out_msg.Tokens := getDirectoryEntry(address).Tokens;
|
||||
out_msg.MessageSize := MessageSizeType:Response_Control;
|
||||
}
|
||||
directory[address].Tokens := 0;
|
||||
getDirectoryEntry(address).Tokens := 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,14 +529,14 @@ machine(Directory, "Token protocol")
|
||||
out_msg.Sender := machineID;
|
||||
out_msg.SenderMachine := MachineType:Directory;
|
||||
out_msg.Destination.add(in_msg.OriginalRequestorMachId);
|
||||
assert(directory[address].Tokens > 0);
|
||||
out_msg.Tokens := directory[in_msg.Address].Tokens;
|
||||
out_msg.DataBlk := directory[in_msg.Address].DataBlk;
|
||||
assert(getDirectoryEntry(address).Tokens > 0);
|
||||
out_msg.Tokens := getDirectoryEntry(in_msg.Address).Tokens;
|
||||
out_msg.DataBlk := getDirectoryEntry(in_msg.Address).DataBlk;
|
||||
out_msg.Dirty := false;
|
||||
out_msg.MessageSize := MessageSizeType:Response_Data;
|
||||
}
|
||||
}
|
||||
directory[address].Tokens := 0;
|
||||
getDirectoryEntry(address).Tokens := 0;
|
||||
}
|
||||
|
||||
action(dd_sendDataWithAllTokensToStarver, "\d", desc="Send data and tokens to starver") {
|
||||
@@ -554,14 +547,14 @@ machine(Directory, "Token protocol")
|
||||
out_msg.Sender := machineID;
|
||||
out_msg.SenderMachine := MachineType:Directory;
|
||||
out_msg.Destination.add(persistentTable.findSmallest(address));
|
||||
assert(directory[address].Tokens > 0);
|
||||
out_msg.Tokens := directory[address].Tokens;
|
||||
out_msg.DataBlk := directory[address].DataBlk;
|
||||
assert(getDirectoryEntry(address).Tokens > 0);
|
||||
out_msg.Tokens := getDirectoryEntry(address).Tokens;
|
||||
out_msg.DataBlk := getDirectoryEntry(address).DataBlk;
|
||||
out_msg.Dirty := false;
|
||||
out_msg.MessageSize := MessageSizeType:Response_Data;
|
||||
}
|
||||
}
|
||||
directory[address].Tokens := 0;
|
||||
getDirectoryEntry(address).Tokens := 0;
|
||||
}
|
||||
|
||||
action(qf_queueMemoryFetchRequest, "qf", desc="Queue off-chip fetch request") {
|
||||
@@ -572,7 +565,7 @@ machine(Directory, "Token protocol")
|
||||
out_msg.Sender := machineID;
|
||||
out_msg.OriginalRequestorMachId := in_msg.Requestor;
|
||||
out_msg.MessageSize := in_msg.MessageSize;
|
||||
out_msg.DataBlk := directory[address].DataBlk;
|
||||
out_msg.DataBlk := getDirectoryEntry(address).DataBlk;
|
||||
DEBUG_EXPR(out_msg);
|
||||
}
|
||||
}
|
||||
@@ -586,7 +579,7 @@ machine(Directory, "Token protocol")
|
||||
out_msg.Sender := machineID;
|
||||
out_msg.OriginalRequestorMachId := in_msg.Requestor;
|
||||
out_msg.MessageSize := in_msg.MessageSize;
|
||||
out_msg.DataBlk := directory[address].DataBlk;
|
||||
out_msg.DataBlk := getDirectoryEntry(address).DataBlk;
|
||||
DEBUG_EXPR(out_msg);
|
||||
}
|
||||
}
|
||||
@@ -673,18 +666,18 @@ machine(Directory, "Token protocol")
|
||||
}
|
||||
|
||||
action(cd_writeCleanDataToTbe, "cd", desc="Write clean memory data to TBE") {
|
||||
TBEs[address].DataBlk := directory[address].DataBlk;
|
||||
TBEs[address].DataBlk := getDirectoryEntry(address).DataBlk;
|
||||
}
|
||||
|
||||
action(dwt_writeDmaDataFromTBE, "dwt", desc="DMA Write data to memory from TBE") {
|
||||
directory[address].DataBlk := TBEs[address].DataBlk;
|
||||
directory[address].DataBlk.copyPartial(TBEs[address].DmaDataBlk, addressOffset(TBEs[address].PhysicalAddress), TBEs[address].Len);
|
||||
getDirectoryEntry(address).DataBlk := TBEs[address].DataBlk;
|
||||
getDirectoryEntry(address).DataBlk.copyPartial(TBEs[address].DmaDataBlk, addressOffset(TBEs[address].PhysicalAddress), TBEs[address].Len);
|
||||
}
|
||||
|
||||
action(f_incrementTokens, "f", desc="Increment the number of tokens we're tracking") {
|
||||
peek(responseNetwork_in, ResponseMsg) {
|
||||
assert(in_msg.Tokens >= 1);
|
||||
directory[address].Tokens := directory[address].Tokens + in_msg.Tokens;
|
||||
getDirectoryEntry(address).Tokens := getDirectoryEntry(address).Tokens + in_msg.Tokens;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +715,7 @@ machine(Directory, "Token protocol")
|
||||
|
||||
action(m_writeDataToMemory, "m", desc="Write dirty writeback to memory") {
|
||||
peek(responseNetwork_in, ResponseMsg) {
|
||||
directory[in_msg.Address].DataBlk := in_msg.DataBlk;
|
||||
getDirectoryEntry(in_msg.Address).DataBlk := in_msg.DataBlk;
|
||||
DEBUG_EXPR(in_msg.Address);
|
||||
DEBUG_EXPR(in_msg.DataBlk);
|
||||
}
|
||||
@@ -730,7 +723,7 @@ machine(Directory, "Token protocol")
|
||||
|
||||
action(n_checkData, "n", desc="Check incoming clean data message") {
|
||||
peek(responseNetwork_in, ResponseMsg) {
|
||||
assert(directory[in_msg.Address].DataBlk == in_msg.DataBlk);
|
||||
assert(getDirectoryEntry(in_msg.Address).DataBlk == in_msg.DataBlk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,7 +766,7 @@ machine(Directory, "Token protocol")
|
||||
// implementation. We include the data in the "dataless"
|
||||
// message so we can assert the clean data matches the datablock
|
||||
// in memory
|
||||
assert(directory[in_msg.Address].DataBlk == in_msg.DataBlk);
|
||||
assert(getDirectoryEntry(in_msg.Address).DataBlk == in_msg.DataBlk);
|
||||
|
||||
// Bounce the message, but "re-associate" the data and the owner
|
||||
// token. In essence we're converting an ACK_OWNER message to a
|
||||
@@ -786,7 +779,7 @@ machine(Directory, "Token protocol")
|
||||
out_msg.DestMachine := MachineType:L1Cache;
|
||||
out_msg.Destination.add(persistentTable.findSmallest(address));
|
||||
out_msg.Tokens := in_msg.Tokens;
|
||||
out_msg.DataBlk := directory[in_msg.Address].DataBlk;
|
||||
out_msg.DataBlk := getDirectoryEntry(in_msg.Address).DataBlk;
|
||||
out_msg.Dirty := in_msg.Dirty;
|
||||
out_msg.MessageSize := MessageSizeType:Response_Data;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
|
||||
machine(DMA, "DMA Controller")
|
||||
: int request_latency
|
||||
: DMASequencer * dma_sequencer,
|
||||
int request_latency
|
||||
{
|
||||
|
||||
MessageBuffer responseFromDir, network="From", virtual_network="0", ordered="true", no_vector="true";
|
||||
@@ -53,7 +54,6 @@ machine(DMA, "DMA Controller")
|
||||
}
|
||||
|
||||
MessageBuffer mandatoryQueue, ordered="false", no_vector="true";
|
||||
DMASequencer dma_sequencer, factory='RubySystem::getDMASequencer(m_cfg["dma_sequencer"])', no_vector="true";
|
||||
State cur_state, no_vector="true";
|
||||
|
||||
State getState(Address addr) {
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
|
||||
// External Types
|
||||
|
||||
//
|
||||
// **PLEASE NOTE!** When adding objects to this file you must also add a line
|
||||
// in the src/mem/ruby/SConscript file. Otherwise the external object's .hh
|
||||
// file will not be copied to the protocol directory and you will encounter a
|
||||
// undefined declaration error.
|
||||
//
|
||||
|
||||
external_type(MessageBuffer, buffer="yes", inport="yes", outport="yes");
|
||||
|
||||
external_type(OutPort, primitive="yes");
|
||||
@@ -117,6 +124,7 @@ external_type(CacheMemory) {
|
||||
void changePermission(Address, AccessPermission);
|
||||
bool isTagPresent(Address);
|
||||
void profileMiss(CacheMsg);
|
||||
void setMRU(Address);
|
||||
}
|
||||
|
||||
external_type(MemoryControl, inport="yes", outport="yes") {
|
||||
|
||||
Reference in New Issue
Block a user