114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
314184Sgabeblack@google.com * All rights reserved.
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
614184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
714184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
814184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
914184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1114184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1214184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1314184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1414184Sgabeblack@google.com * this software without specific prior written permission.
1514184Sgabeblack@google.com *
1614184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1714184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1814184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1914184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2014184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2114184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2214184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2314184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2414184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2514184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2614184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2714184Sgabeblack@google.com */
2814184Sgabeblack@google.com
2914184Sgabeblack@google.com// CoherenceRequestType
3014184Sgabeblack@google.comenumeration(CoherenceRequestType, desc="...") {
3114184Sgabeblack@google.com  GETX,      desc="Get eXclusive";
3214184Sgabeblack@google.com  GETS,      desc="Get Shared";
3314184Sgabeblack@google.com  PUTX,      desc="Put eXclusive";
3414184Sgabeblack@google.com  WB_ACK,    desc="Writeback ack";
3514184Sgabeblack@google.com  WB_NACK,   desc="Writeback neg. ack";
3614184Sgabeblack@google.com  INV,       desc="Invalidation";
3714184Sgabeblack@google.com}
3814184Sgabeblack@google.com
3914184Sgabeblack@google.com// CoherenceResponseType
4014184Sgabeblack@google.comenumeration(CoherenceResponseType, desc="...") {
4114184Sgabeblack@google.com  ACK,               desc="ACKnowledgment, responder doesn't have a copy";
4214184Sgabeblack@google.com  DATA,              desc="Data";
4314184Sgabeblack@google.com  DATA_EXCLUSIVE_CLEAN, desc="Data, no other processor has a copy, data is clean";
4414184Sgabeblack@google.com  DATA_EXCLUSIVE_DIRTY, desc="Data, no other processor has a copy, data is dirty";
4514184Sgabeblack@google.com  UNBLOCK,           desc="Unblock";
4614184Sgabeblack@google.com  UNBLOCK_EXCLUSIVE, desc="Unblock, we're in E/M";
4714184Sgabeblack@google.com  WRITEBACK_CLEAN,   desc="Clean writeback (no data)";
4814184Sgabeblack@google.com  WRITEBACK_DIRTY,   desc="Dirty writeback (contains data)";
4914184Sgabeblack@google.com  WRITEBACK,         desc="Generic writeback (contains data)";
5014184Sgabeblack@google.com}
5114184Sgabeblack@google.com
5214184Sgabeblack@google.com// RequestMsg (and also forwarded requests)
5314184Sgabeblack@google.comstructure(RequestMsg, desc="...", interface="Message") {
5414184Sgabeblack@google.com  Addr addr,             desc="Physical address for this request";
5514184Sgabeblack@google.com  CoherenceRequestType Type,   desc="Type of request (GetS, GetX, PutX, etc)";
5614184Sgabeblack@google.com  MachineID Requestor,            desc="Node who initiated the request";
5714184Sgabeblack@google.com  NetDest Destination,             desc="Multicast destination mask";
5814184Sgabeblack@google.com  DataBlock DataBlk,           desc="data for the cache line";
5914184Sgabeblack@google.com  MessageSizeType MessageSize, desc="size category of the message";
6014184Sgabeblack@google.com
6114184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
6214184Sgabeblack@google.com    // Valid data block is only present in PUTX messages
6314184Sgabeblack@google.com    if (Type == CoherenceRequestType:PUTX) {
6414184Sgabeblack@google.com        return testAndRead(addr, DataBlk, pkt);
6514184Sgabeblack@google.com    }
6614184Sgabeblack@google.com    return false;
6714184Sgabeblack@google.com  }
6814184Sgabeblack@google.com
6914184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
7014184Sgabeblack@google.com    // No check on message type required since the protocol should read
7114184Sgabeblack@google.com    // data block from only those messages that contain valid data
7214184Sgabeblack@google.com    return testAndWrite(addr, DataBlk, pkt);
7314184Sgabeblack@google.com  }
7414184Sgabeblack@google.com}
7514184Sgabeblack@google.com
7614184Sgabeblack@google.com// ResponseMsg (and also unblock requests)
7714184Sgabeblack@google.comstructure(ResponseMsg, desc="...", interface="Message") {
7814184Sgabeblack@google.com  Addr addr,             desc="Physical address for this request";
7914184Sgabeblack@google.com  CoherenceResponseType Type,  desc="Type of response (Ack, Data, etc)";
8014184Sgabeblack@google.com  MachineID Sender,               desc="Node who sent the data";
8114184Sgabeblack@google.com  NetDest Destination,             desc="Node to whom the data is sent";
8214184Sgabeblack@google.com  DataBlock DataBlk,           desc="data for the cache line";
8314184Sgabeblack@google.com  bool Dirty,                  desc="Is the data dirty (different than memory)?";
8414184Sgabeblack@google.com  MessageSizeType MessageSize, desc="size category of the message";
8514184Sgabeblack@google.com
8614184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
8714184Sgabeblack@google.com    // A check on message type should appear here so that only those
8814184Sgabeblack@google.com    // messages that contain data
8914184Sgabeblack@google.com    return testAndRead(addr, DataBlk, pkt);
9014184Sgabeblack@google.com  }
9114184Sgabeblack@google.com
9214184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
9314184Sgabeblack@google.com    // No check on message type required since the protocol should read
9414184Sgabeblack@google.com    // data block from only those messages that contain valid data
9514184Sgabeblack@google.com    return testAndWrite(addr, DataBlk, pkt);
9614184Sgabeblack@google.com  }
9714184Sgabeblack@google.com}
9814184Sgabeblack@google.com
9914184Sgabeblack@google.comenumeration(DMARequestType, desc="...", default="DMARequestType_NULL") {
10014184Sgabeblack@google.com  READ,          desc="Memory Read";
10114184Sgabeblack@google.com  WRITE,         desc="Memory Write";
10214184Sgabeblack@google.com  NULL,          desc="Invalid";
10314184Sgabeblack@google.com}
10414184Sgabeblack@google.com
10514184Sgabeblack@google.comenumeration(DMAResponseType, desc="...", default="DMAResponseType_NULL") {
10614184Sgabeblack@google.com  DATA,          desc="DATA read";
10714184Sgabeblack@google.com  ACK,           desc="ACK write";
10814184Sgabeblack@google.com  NULL,          desc="Invalid";
10914184Sgabeblack@google.com}
11014184Sgabeblack@google.com
11114184Sgabeblack@google.comstructure(DMARequestMsg, desc="...", interface="Message") {
11214184Sgabeblack@google.com  DMARequestType Type,       desc="Request type (read/write)";
11314184Sgabeblack@google.com  Addr PhysicalAddress,   desc="Physical address for this request";
11414184Sgabeblack@google.com  Addr LineAddress,       desc="Line address for this request";
11514184Sgabeblack@google.com  MachineID Requestor,            desc="Node who initiated the request";
11614184Sgabeblack@google.com  NetDest Destination,       desc="Destination";
11714184Sgabeblack@google.com  DataBlock DataBlk,         desc="DataBlk attached to this request";
11814184Sgabeblack@google.com  int Len,                   desc="The length of the request";
11914184Sgabeblack@google.com  MessageSizeType MessageSize, desc="size category of the message";
12014184Sgabeblack@google.com
12114184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
12214184Sgabeblack@google.com    return testAndRead(LineAddress, DataBlk, pkt);
12314184Sgabeblack@google.com  }
12414184Sgabeblack@google.com
12514184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
12614184Sgabeblack@google.com    return testAndWrite(LineAddress, DataBlk, pkt);
12714184Sgabeblack@google.com  }
12814184Sgabeblack@google.com}
12914184Sgabeblack@google.com
13014184Sgabeblack@google.comstructure(DMAResponseMsg, desc="...", interface="Message") {
13114184Sgabeblack@google.com  DMAResponseType Type,      desc="Response type (DATA/ACK)";
13214184Sgabeblack@google.com  Addr PhysicalAddress,   desc="Physical address for this request";
13314184Sgabeblack@google.com  Addr LineAddress,       desc="Line address for this request";
13414184Sgabeblack@google.com  NetDest Destination,       desc="Destination";
13514184Sgabeblack@google.com  DataBlock DataBlk,         desc="DataBlk attached to this request";
13614184Sgabeblack@google.com  MessageSizeType MessageSize, desc="size category of the message";
13714184Sgabeblack@google.com
13814184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
13914184Sgabeblack@google.com    return testAndRead(LineAddress, DataBlk, pkt);
14014184Sgabeblack@google.com  }
14114184Sgabeblack@google.com
14214184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
14314184Sgabeblack@google.com    return testAndWrite(LineAddress, DataBlk, pkt);
14414184Sgabeblack@google.com  }
14514184Sgabeblack@google.com}
146