packet.hh (2811:9da12e9830ce) packet.hh (2812:8e5feae75615)
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;

--- 27 unchanged lines hidden (view full) ---

36 */
37
38#ifndef __MEM_PACKET_HH__
39#define __MEM_PACKET_HH__
40
41#include "mem/request.hh"
42#include "arch/isa_traits.hh"
43#include "sim/root.hh"
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;

--- 27 unchanged lines hidden (view full) ---

36 */
37
38#ifndef __MEM_PACKET_HH__
39#define __MEM_PACKET_HH__
40
41#include "mem/request.hh"
42#include "arch/isa_traits.hh"
43#include "sim/root.hh"
44#include <list>
44
45struct Packet;
46typedef Packet* PacketPtr;
47typedef uint8_t* PacketDataPtr;
45
46struct Packet;
47typedef Packet* PacketPtr;
48typedef uint8_t* PacketDataPtr;
49typedef std::list<PacketPtr> PacketList;
48
50
51//Coherence Flags
52#define NACKED_LINE 1 << 0
53#define SATISFIED 1 << 1
54#define SHARED_LINE 1 << 2
55
49//For statistics we need max number of commands, hard code it at
50//20 for now. @todo fix later
51#define NUM_MEM_CMDS 1 << 9
52
53/**
54 * A Packet is used to encapsulate a transfer between two objects in
55 * the memory system (e.g., the L1 and L2 cache). (In contrast, a
56 * single Request travels all the way from the requester to the

--- 111 unchanged lines hidden (view full) ---

168 WriteReq = IsWrite | IsRequest | NeedsResponse,
169 WriteReqNoAck = IsWrite | IsRequest,
170 ReadResp = IsRead | IsResponse,
171 WriteResp = IsWrite | IsResponse,
172 Writeback = IsWrite | IsRequest,
173 SoftPFReq = IsRead | IsRequest | IsSWPrefetch | NeedsResponse,
174 HardPFReq = IsRead | IsRequest | IsHWPrefetch | NeedsResponse,
175 SoftPFResp = IsRead | IsRequest | IsSWPrefetch | IsResponse,
56//For statistics we need max number of commands, hard code it at
57//20 for now. @todo fix later
58#define NUM_MEM_CMDS 1 << 9
59
60/**
61 * A Packet is used to encapsulate a transfer between two objects in
62 * the memory system (e.g., the L1 and L2 cache). (In contrast, a
63 * single Request travels all the way from the requester to the

--- 111 unchanged lines hidden (view full) ---

175 WriteReq = IsWrite | IsRequest | NeedsResponse,
176 WriteReqNoAck = IsWrite | IsRequest,
177 ReadResp = IsRead | IsResponse,
178 WriteResp = IsWrite | IsResponse,
179 Writeback = IsWrite | IsRequest,
180 SoftPFReq = IsRead | IsRequest | IsSWPrefetch | NeedsResponse,
181 HardPFReq = IsRead | IsRequest | IsHWPrefetch | NeedsResponse,
182 SoftPFResp = IsRead | IsRequest | IsSWPrefetch | IsResponse,
176 HardPFResp = IsRead | IsRequest | IsHWPrefetch | IsResponse
183 HardPFResp = IsRead | IsRequest | IsHWPrefetch | IsResponse,
184 InvalidateReq = IsInvalidate | IsRequest,
185 WriteInvalidateReq = IsWrite | IsInvalidate | IsRequest,
186 UpgradeReq = IsInvalidate | NeedsResponse
177 };
178
179 /** Return the string name of the cmd field (for debugging and
180 * tracing). */
181 const std::string &cmdString() const;
182
183 /** Reutrn the string to a cmd given by idx. */
184 const std::string &cmdIdxToString(Command idx);
185
186 /** Return the index of this command. */
187 inline int cmdToIndex() const { return (int) cmd; }
188
189 /** The command field of the packet. */
190 Command cmd;
191
192 bool isRead() { return (cmd & IsRead) != 0; }
187 };
188
189 /** Return the string name of the cmd field (for debugging and
190 * tracing). */
191 const std::string &cmdString() const;
192
193 /** Reutrn the string to a cmd given by idx. */
194 const std::string &cmdIdxToString(Command idx);
195
196 /** Return the index of this command. */
197 inline int cmdToIndex() const { return (int) cmd; }
198
199 /** The command field of the packet. */
200 Command cmd;
201
202 bool isRead() { return (cmd & IsRead) != 0; }
203 bool isWrite() { return (cmd & IsWrite) != 0; }
193 bool isRequest() { return (cmd & IsRequest) != 0; }
194 bool isResponse() { return (cmd & IsResponse) != 0; }
195 bool needsResponse() { return (cmd & NeedsResponse) != 0; }
204 bool isRequest() { return (cmd & IsRequest) != 0; }
205 bool isResponse() { return (cmd & IsResponse) != 0; }
206 bool needsResponse() { return (cmd & NeedsResponse) != 0; }
207 bool isInvalidate() { return (cmd * IsInvalidate) != 0; }
196
208
209 bool isCacheFill() { assert("Unimplemented yet\n" && 0); }
210 bool isNoAllocate() { assert("Unimplemented yet\n" && 0); }
211
197 /** Possible results of a packet's request. */
198 enum Result
199 {
200 Success,
201 BadAddress,
202 Nacked,
203 Unknown
204 };

--- 116 unchanged lines hidden ---
212 /** Possible results of a packet's request. */
213 enum Result
214 {
215 Success,
216 BadAddress,
217 Nacked,
218 Unknown
219 };

--- 116 unchanged lines hidden ---