MESI_Two_Level-msg.sm revision 14184
1955SN/A 2955SN/A/* 31762SN/A * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood 4955SN/A * All rights reserved. 5955SN/A * 6955SN/A * Redistribution and use in source and binary forms, with or without 7955SN/A * modification, are permitted provided that the following conditions are 8955SN/A * met: redistributions of source code must retain the above copyright 9955SN/A * notice, this list of conditions and the following disclaimer; 10955SN/A * redistributions in binary form must reproduce the above copyright 11955SN/A * notice, this list of conditions and the following disclaimer in the 12955SN/A * documentation and/or other materials provided with the distribution; 13955SN/A * neither the name of the copyright holders nor the names of its 14955SN/A * contributors may be used to endorse or promote products derived from 15955SN/A * this software without specific prior written permission. 16955SN/A * 17955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu */ 294762Snate@binkert.org 30955SN/A 315522Snate@binkert.org// CoherenceRequestType 326143Snate@binkert.orgenumeration(CoherenceRequestType, desc="...") { 334762Snate@binkert.org GETX, desc="Get eXclusive"; 345522Snate@binkert.org UPGRADE, desc="UPGRADE to exclusive"; 35955SN/A GETS, desc="Get Shared"; 365522Snate@binkert.org GET_INSTR, desc="Get Instruction"; 37955SN/A INV, desc="INValidate"; 385522Snate@binkert.org PUTX, desc="Replacement message"; 394202Sbinkertn@umich.edu 405742Snate@binkert.org WB_ACK, desc="Writeback ack"; 41955SN/A 424381Sbinkertn@umich.edu DMA_READ, desc="DMA Read"; 434381Sbinkertn@umich.edu DMA_WRITE, desc="DMA Write"; 448334Snate@binkert.org} 45955SN/A 46955SN/A// CoherenceResponseType 474202Sbinkertn@umich.eduenumeration(CoherenceResponseType, desc="...") { 48955SN/A MEMORY_ACK, desc="Ack from memory controller"; 494382Sbinkertn@umich.edu DATA, desc="Data block for L1 cache in S state"; 504382Sbinkertn@umich.edu DATA_EXCLUSIVE, desc="Data block for L1 cache in M/E state"; 514382Sbinkertn@umich.edu MEMORY_DATA, desc="Data block from / to main memory"; 526654Snate@binkert.org ACK, desc="Generic invalidate ack"; 535517Snate@binkert.org WB_ACK, desc="writeback ack"; 548614Sgblack@eecs.umich.edu UNBLOCK, desc="unblock"; 557674Snate@binkert.org EXCLUSIVE_UNBLOCK, desc="exclusive unblock"; 566143Snate@binkert.org INV, desc="Invalidate from directory"; 576143Snate@binkert.org} 586143Snate@binkert.org 598233Snate@binkert.org// RequestMsg 608233Snate@binkert.orgstructure(RequestMsg, desc="...", interface="Message") { 618233Snate@binkert.org Addr addr, desc="Physical address for this request"; 628233Snate@binkert.org CoherenceRequestType Type, desc="Type of request (GetS, GetX, PutX, etc)"; 638233Snate@binkert.org RubyAccessMode AccessMode, desc="user/supervisor access type"; 648334Snate@binkert.org MachineID Requestor , desc="What component request"; 658334Snate@binkert.org NetDest Destination, desc="What components receive the request, includes MachineType and num"; 668233Snate@binkert.org MessageSizeType MessageSize, desc="size category of the message"; 678233Snate@binkert.org DataBlock DataBlk, desc="Data for the cache line (if PUTX)"; 688233Snate@binkert.org int Len; 698233Snate@binkert.org bool Dirty, default="false", desc="Dirty bit"; 708233Snate@binkert.org PrefetchBit Prefetch, desc="Is this a prefetch request"; 718233Snate@binkert.org 726143Snate@binkert.org bool functionalRead(Packet *pkt) { 738233Snate@binkert.org // Only PUTX messages contains the data block 748233Snate@binkert.org if (Type == CoherenceRequestType:PUTX) { 758233Snate@binkert.org return testAndRead(addr, DataBlk, pkt); 766143Snate@binkert.org } 776143Snate@binkert.org 786143Snate@binkert.org return false; 796143Snate@binkert.org } 808233Snate@binkert.org 818233Snate@binkert.org bool functionalWrite(Packet *pkt) { 828233Snate@binkert.org // No check on message type required since the protocol should 836143Snate@binkert.org // read data from those messages that contain the block 848233Snate@binkert.org return testAndWrite(addr, DataBlk, pkt); 858233Snate@binkert.org } 868233Snate@binkert.org} 878233Snate@binkert.org 886143Snate@binkert.org// ResponseMsg 896143Snate@binkert.orgstructure(ResponseMsg, desc="...", interface="Message") { 906143Snate@binkert.org Addr addr, desc="Physical address for this request"; 914762Snate@binkert.org CoherenceResponseType Type, desc="Type of response (Ack, Data, etc)"; 926143Snate@binkert.org MachineID Sender, desc="What component sent the data"; 938233Snate@binkert.org NetDest Destination, desc="Node to whom the data is sent"; 948233Snate@binkert.org DataBlock DataBlk, desc="Data for the cache line"; 958233Snate@binkert.org bool Dirty, default="false", desc="Dirty bit"; 968233Snate@binkert.org int AckCount, default="0", desc="number of acks in this message"; 978233Snate@binkert.org MessageSizeType MessageSize, desc="size category of the message"; 986143Snate@binkert.org 998233Snate@binkert.org bool functionalRead(Packet *pkt) { 1008233Snate@binkert.org // Valid data block is only present in message with following types 1018233Snate@binkert.org if (Type == CoherenceResponseType:DATA || 1028233Snate@binkert.org Type == CoherenceResponseType:DATA_EXCLUSIVE || 1036143Snate@binkert.org Type == CoherenceResponseType:MEMORY_DATA) { 1046143Snate@binkert.org 1056143Snate@binkert.org return testAndRead(addr, DataBlk, pkt); 1066143Snate@binkert.org } 1076143Snate@binkert.org 1086143Snate@binkert.org return false; 1096143Snate@binkert.org } 1106143Snate@binkert.org 1116143Snate@binkert.org bool functionalWrite(Packet *pkt) { 1127065Snate@binkert.org // No check on message type required since the protocol should 1136143Snate@binkert.org // read data from those messages that contain the block 1148233Snate@binkert.org return testAndWrite(addr, DataBlk, pkt); 1158233Snate@binkert.org } 1168233Snate@binkert.org} 1178233Snate@binkert.org