1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Ali Saidi 29 * Steve Reinhardt 30 */ 31 32/** 33 * @file 34 * Definition of the Packet Class, a packet is a transaction occuring 35 * between a single level of the memory heirarchy (ie L1->L2). 36 */ 37 38#include <iostream> 39#include <cstring> 40#include "base/misc.hh" 41#include "base/trace.hh" 42#include "mem/packet.hh" 43 44// The one downside to bitsets is that static initializers can get ugly. 45#define SET1(a1) (1 << (a1)) 46#define SET2(a1, a2) (SET1(a1) | SET1(a2)) 47#define SET3(a1, a2, a3) (SET2(a1, a2) | SET1(a3)) 48#define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4)) 49#define SET5(a1, a2, a3, a4, a5) (SET4(a1, a2, a3, a4) | SET1(a5)) 50#define SET6(a1, a2, a3, a4, a5, a6) (SET5(a1, a2, a3, a4, a5) | SET1(a6)) 51 52const MemCmd::CommandInfo 53MemCmd::commandInfo[] = 54{ 55 /* InvalidCmd */ 56 { 0, InvalidCmd, "InvalidCmd" }, 57 /* ReadReq */ 58 { SET3(IsRead, IsRequest, NeedsResponse), ReadResp, "ReadReq" }, 59 /* WriteReq */ 60 { SET4(IsWrite, IsRequest, NeedsResponse, HasData), 61 WriteResp, "WriteReq" }, 62 /* WriteReqNoAck */ 63 { SET3(IsWrite, IsRequest, HasData), InvalidCmd, "WriteReqNoAck" }, 64 /* ReadResp */ 65 { SET3(IsRead, IsResponse, HasData), InvalidCmd, "ReadResp" }, 66 /* WriteResp */ 67 { SET2(IsWrite, IsResponse), InvalidCmd, "WriteResp" }, 68 /* Writeback */ 69 { SET3(IsWrite, IsRequest, HasData), InvalidCmd, "Writeback" }, 70 /* SoftPFReq */ 71 { SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse), 72 SoftPFResp, "SoftPFReq" }, 73 /* HardPFReq */ 74 { SET4(IsRead, IsRequest, IsHWPrefetch, NeedsResponse), 75 HardPFResp, "HardPFReq" }, 76 /* SoftPFResp */ 77 { SET4(IsRead, IsResponse, IsSWPrefetch, HasData), 78 InvalidCmd, "SoftPFResp" }, 79 /* HardPFResp */ 80 { SET4(IsRead, IsResponse, IsHWPrefetch, HasData), 81 InvalidCmd, "HardPFResp" }, 82 /* InvalidateReq */ 83 { SET2(IsInvalidate, IsRequest), InvalidCmd, "InvalidateReq" }, 84 /* WriteInvalidateReq */ 85 { SET5(IsWrite, IsInvalidate, IsRequest, HasData, NeedsResponse), 86 WriteInvalidateResp, "WriteInvalidateReq" }, 87 /* WriteInvalidateResp */ 88 { SET5(IsWrite, IsInvalidate, IsRequest, NeedsResponse, IsResponse), 89 InvalidCmd, "WriteInvalidateResp" }, 90 /* UpgradeReq */ 91 { SET3(IsInvalidate, IsRequest, IsUpgrade), InvalidCmd, "UpgradeReq" }, 92 /* ReadExReq */ 93 { SET4(IsRead, IsInvalidate, IsRequest, NeedsResponse), 94 ReadExResp, "ReadExReq" }, 95 /* ReadExResp */ 96 { SET4(IsRead, IsInvalidate, IsResponse, HasData),
| 1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Ali Saidi 29 * Steve Reinhardt 30 */ 31 32/** 33 * @file 34 * Definition of the Packet Class, a packet is a transaction occuring 35 * between a single level of the memory heirarchy (ie L1->L2). 36 */ 37 38#include <iostream> 39#include <cstring> 40#include "base/misc.hh" 41#include "base/trace.hh" 42#include "mem/packet.hh" 43 44// The one downside to bitsets is that static initializers can get ugly. 45#define SET1(a1) (1 << (a1)) 46#define SET2(a1, a2) (SET1(a1) | SET1(a2)) 47#define SET3(a1, a2, a3) (SET2(a1, a2) | SET1(a3)) 48#define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4)) 49#define SET5(a1, a2, a3, a4, a5) (SET4(a1, a2, a3, a4) | SET1(a5)) 50#define SET6(a1, a2, a3, a4, a5, a6) (SET5(a1, a2, a3, a4, a5) | SET1(a6)) 51 52const MemCmd::CommandInfo 53MemCmd::commandInfo[] = 54{ 55 /* InvalidCmd */ 56 { 0, InvalidCmd, "InvalidCmd" }, 57 /* ReadReq */ 58 { SET3(IsRead, IsRequest, NeedsResponse), ReadResp, "ReadReq" }, 59 /* WriteReq */ 60 { SET4(IsWrite, IsRequest, NeedsResponse, HasData), 61 WriteResp, "WriteReq" }, 62 /* WriteReqNoAck */ 63 { SET3(IsWrite, IsRequest, HasData), InvalidCmd, "WriteReqNoAck" }, 64 /* ReadResp */ 65 { SET3(IsRead, IsResponse, HasData), InvalidCmd, "ReadResp" }, 66 /* WriteResp */ 67 { SET2(IsWrite, IsResponse), InvalidCmd, "WriteResp" }, 68 /* Writeback */ 69 { SET3(IsWrite, IsRequest, HasData), InvalidCmd, "Writeback" }, 70 /* SoftPFReq */ 71 { SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse), 72 SoftPFResp, "SoftPFReq" }, 73 /* HardPFReq */ 74 { SET4(IsRead, IsRequest, IsHWPrefetch, NeedsResponse), 75 HardPFResp, "HardPFReq" }, 76 /* SoftPFResp */ 77 { SET4(IsRead, IsResponse, IsSWPrefetch, HasData), 78 InvalidCmd, "SoftPFResp" }, 79 /* HardPFResp */ 80 { SET4(IsRead, IsResponse, IsHWPrefetch, HasData), 81 InvalidCmd, "HardPFResp" }, 82 /* InvalidateReq */ 83 { SET2(IsInvalidate, IsRequest), InvalidCmd, "InvalidateReq" }, 84 /* WriteInvalidateReq */ 85 { SET5(IsWrite, IsInvalidate, IsRequest, HasData, NeedsResponse), 86 WriteInvalidateResp, "WriteInvalidateReq" }, 87 /* WriteInvalidateResp */ 88 { SET5(IsWrite, IsInvalidate, IsRequest, NeedsResponse, IsResponse), 89 InvalidCmd, "WriteInvalidateResp" }, 90 /* UpgradeReq */ 91 { SET3(IsInvalidate, IsRequest, IsUpgrade), InvalidCmd, "UpgradeReq" }, 92 /* ReadExReq */ 93 { SET4(IsRead, IsInvalidate, IsRequest, NeedsResponse), 94 ReadExResp, "ReadExReq" }, 95 /* ReadExResp */ 96 { SET4(IsRead, IsInvalidate, IsResponse, HasData),
|