diff options
Diffstat (limited to 'src/mem/protocol/MI_example-dir.sm')
-rw-r--r-- | src/mem/protocol/MI_example-dir.sm | 65 |
1 files changed, 21 insertions, 44 deletions
diff --git a/src/mem/protocol/MI_example-dir.sm b/src/mem/protocol/MI_example-dir.sm index cd12e3eb7..60662080a 100644 --- a/src/mem/protocol/MI_example-dir.sm +++ b/src/mem/protocol/MI_example-dir.sm @@ -84,7 +84,6 @@ machine(Directory, "Directory protocol") // DirectoryEntry structure(Entry, desc="...", interface="AbstractEntry") { State DirectoryState, desc="Directory state"; - DataBlock DataBlk, desc="data for the block"; NetDest Sharers, desc="Sharers for this block"; NetDest Owner, desc="Owner of this block"; } @@ -151,7 +150,6 @@ machine(Directory, "Directory protocol") if (state == State:I) { assert(getDirectoryEntry(addr).Owner.count() == 0); assert(getDirectoryEntry(addr).Sharers.count() == 0); - directory.invalidateBlock(addr); } } } @@ -175,13 +173,22 @@ machine(Directory, "Directory protocol") } } - DataBlock getDataBlock(Address addr), return_by_ref="yes" { + void functionalRead(Address addr, Packet *pkt) { TBE tbe := TBEs[addr]; if(is_valid(tbe)) { - return tbe.DataBlk; + testAndRead(addr, tbe.DataBlk, pkt); + } else { + memBuffer.functionalRead(pkt); + } + } + + int functionalWrite(Address addr, Packet *pkt) { + TBE tbe := TBEs[addr]; + if(is_valid(tbe)) { + testAndWrite(addr, tbe.DataBlk, pkt); } - return getDirectoryEntry(addr).DataBlk; + return memBuffer.functionalWrite(pkt); } // ** OUT_PORTS ** @@ -326,7 +333,10 @@ machine(Directory, "Directory protocol") out_msg.PhysicalAddress := address; out_msg.LineAddress := address; out_msg.Type := DMAResponseType:DATA; - out_msg.DataBlk := in_msg.DataBlk; // we send the entire data block and rely on the dma controller to split it up if need be + + // we send the entire data block and rely on the dma controller + // to split it up if need be + out_msg.DataBlk := in_msg.DataBlk; out_msg.Destination.add(tbe.DmaRequestor); out_msg.MessageSize := MessageSizeType:Response_Data; } @@ -386,21 +396,7 @@ machine(Directory, "Directory protocol") action(p_popIncomingDMARequestQueue, "p", desc="Pop incoming DMA queue") { dmaRequestQueue_in.dequeue(); } - - action(l_writeDataToMemory, "pl", desc="Write PUTX data to memory") { - peek(requestQueue_in, RequestMsg) { - // assert(in_msg.Dirty); - // assert(in_msg.MessageSize == MessageSizeType:Writeback_Data); - getDirectoryEntry(in_msg.Addr).DataBlk := in_msg.DataBlk; - //getDirectoryEntry(in_msg.Addr).DataBlk.copyPartial(in_msg.DataBlk, addressOffset(in_msg.Addr), in_msg.Len); - } - } - action(dwt_writeDMADataFromTBE, "dwt", desc="DMA Write data to memory from TBE") { - assert(is_valid(tbe)); - getDirectoryEntry(address).DataBlk.copyPartial(tbe.DataBlk, addressOffset(tbe.PhysicalAddress), tbe.Len); - } - action(v_allocateTBE, "v", desc="Allocate TBE") { peek(dmaRequestQueue_in, DMARequestMsg) { TBEs.allocate(address); @@ -450,7 +446,6 @@ machine(Directory, "Directory protocol") out_msg.Sender := machineID; out_msg.OriginalRequestorMachId := in_msg.Requestor; out_msg.MessageSize := in_msg.MessageSize; - out_msg.DataBlk := getDirectoryEntry(in_msg.Addr).DataBlk; DPRINTF(RubySlicc,"%s\n", out_msg); } } @@ -464,7 +459,6 @@ machine(Directory, "Directory protocol") out_msg.Sender := machineID; //out_msg.OriginalRequestorMachId := machineID; out_msg.MessageSize := in_msg.MessageSize; - out_msg.DataBlk := getDirectoryEntry(address).DataBlk; DPRINTF(RubySlicc,"%s\n", out_msg); } } @@ -475,12 +469,9 @@ machine(Directory, "Directory protocol") enqueue(memQueue_out, MemoryMsg, 1) { out_msg.Addr := address; out_msg.Type := MemoryRequestType:MEMORY_WB; - //out_msg.OriginalRequestorMachId := machineID; - //out_msg.DataBlk := in_msg.DataBlk; - out_msg.DataBlk.copyPartial(in_msg.DataBlk, addressOffset(in_msg.PhysicalAddress), in_msg.Len); + out_msg.DataBlk.copyPartial( + in_msg.DataBlk, addressOffset(in_msg.PhysicalAddress), in_msg.Len); out_msg.MessageSize := in_msg.MessageSize; - //out_msg.Prefetch := in_msg.Prefetch; - DPRINTF(RubySlicc,"%s\n", out_msg); } } @@ -493,19 +484,17 @@ machine(Directory, "Directory protocol") out_msg.Addr := address; out_msg.Type := MemoryRequestType:MEMORY_WB; out_msg.OriginalRequestorMachId := in_msg.Requestor; + // get incoming data - // out_msg.DataBlk := in_msg.DataBlk; - out_msg.DataBlk.copyPartial(tbe.DataBlk, addressOffset(tbe.PhysicalAddress), tbe.Len); + out_msg.DataBlk.copyPartial( + tbe.DataBlk, addressOffset(tbe.PhysicalAddress), tbe.Len); out_msg.MessageSize := in_msg.MessageSize; - //out_msg.Prefetch := in_msg.Prefetch; - DPRINTF(RubySlicc,"%s\n", out_msg); } } } - action(l_queueMemoryWBRequest, "lq", desc="Write PUTX data to memory") { peek(requestQueue_in, RequestMsg) { enqueue(memQueue_out, MemoryMsg, 1) { @@ -525,13 +514,7 @@ machine(Directory, "Directory protocol") memQueue_in.dequeue(); } - action(w_writeDataToMemoryFromTBE, "\w", desc="Write date to directory memory from TBE") { - assert(is_valid(tbe)); - getDirectoryEntry(address).DataBlk := TBEs[address].DataBlk; - } - // TRANSITIONS - transition({M_DRD, M_DWR, M_DWRI, M_DRDI}, GETX) { z_recycleRequestQueue; } @@ -582,7 +565,6 @@ machine(Directory, "Directory protocol") } transition(ID_W, Memory_Ack, I) { - dwt_writeDMADataFromTBE; da_sendDMAAck; w_deallocateTBE; l_popMemQueue; @@ -595,7 +577,6 @@ machine(Directory, "Directory protocol") } transition(M_DRD, PUTX, M_DRDI) { - l_writeDataToMemory; drp_sendDMAData; c_clearOwner; l_queueMemoryWBRequest; @@ -616,14 +597,12 @@ machine(Directory, "Directory protocol") } transition(M_DWR, PUTX, M_DWRI) { - l_writeDataToMemory; qw_queueMemoryWBRequest_partialTBE; c_clearOwner; i_popIncomingRequestQueue; } transition(M_DWRI, Memory_Ack, I) { - w_writeDataToMemoryFromTBE; l_sendWriteBackAck; da_sendDMAAck; w_deallocateTBE; @@ -644,7 +623,6 @@ machine(Directory, "Directory protocol") } transition(MI, Memory_Ack, I) { - w_writeDataToMemoryFromTBE; l_sendWriteBackAck; w_deallocateTBE; l_popMemQueue; @@ -659,5 +637,4 @@ machine(Directory, "Directory protocol") b_sendWriteBackNack; i_popIncomingRequestQueue; } - } |