request.hh (3823:1c8f87aa103e) request.hh (4040:eb894f3fc168)
1/*
2 * Copyright (c) 2002-2005 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;

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

66/** The request should be prefetched into the exclusive state. */
67const uint32_t PF_EXCLUSIVE = 0x10000;
68/** The request should be marked as LRU. */
69const uint32_t EVICT_NEXT = 0x20000;
70/** The request should ignore unaligned access faults */
71const uint32_t NO_ALIGN_FAULT = 0x40000;
72/** The request was an instruction read. */
73const uint32_t INST_READ = 0x80000;
1/*
2 * Copyright (c) 2002-2005 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;

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

66/** The request should be prefetched into the exclusive state. */
67const uint32_t PF_EXCLUSIVE = 0x10000;
68/** The request should be marked as LRU. */
69const uint32_t EVICT_NEXT = 0x20000;
70/** The request should ignore unaligned access faults */
71const uint32_t NO_ALIGN_FAULT = 0x40000;
72/** The request was an instruction read. */
73const uint32_t INST_READ = 0x80000;
74/** This request is for a memory swap. */
75const uint32_t MEM_SWAP = 0x100000;
76const uint32_t MEM_SWAP_COND = 0x200000;
74
77
78
75class Request
76{
77 private:
78 /**
79 * The physical address of the request. Valid only if validPaddr
80 * is set. */
81 Addr paddr;
82

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

99 int asid;
100
101 /** This request is to a memory mapped register. */
102 bool mmapedIpr;
103
104 /** The virtual address of the request. */
105 Addr vaddr;
106
79class Request
80{
81 private:
82 /**
83 * The physical address of the request. Valid only if validPaddr
84 * is set. */
85 Addr paddr;
86

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

103 int asid;
104
105 /** This request is to a memory mapped register. */
106 bool mmapedIpr;
107
108 /** The virtual address of the request. */
109 Addr vaddr;
110
107 /** The return value of store conditional. */
108 uint64_t scResult;
111 /** Extra data for the request, such as the return value of
112 * store conditional or the compare value for a CAS. */
113 uint64_t extraData;
109
110 /** The cpu number (for statistics, typically). */
111 int cpuNum;
112 /** The requesting thread id (for statistics, typically). */
113 int threadNum;
114
115 /** program counter of initiating access; for tracing/debugging */
116 Addr pc;
117
118 /** Whether or not paddr is valid (has been written yet). */
119 bool validPaddr;
120 /** Whether or not the asid & vaddr are valid. */
121 bool validAsidVaddr;
122 /** Whether or not the sc result is valid. */
114
115 /** The cpu number (for statistics, typically). */
116 int cpuNum;
117 /** The requesting thread id (for statistics, typically). */
118 int threadNum;
119
120 /** program counter of initiating access; for tracing/debugging */
121 Addr pc;
122
123 /** Whether or not paddr is valid (has been written yet). */
124 bool validPaddr;
125 /** Whether or not the asid & vaddr are valid. */
126 bool validAsidVaddr;
127 /** Whether or not the sc result is valid. */
123 bool validScResult;
128 bool validExData;
124 /** Whether or not the cpu number & thread ID are valid. */
125 bool validCpuAndThreadNums;
126 /** Whether or not the pc is valid. */
127 bool validPC;
128
129 public:
130 /** Minimal constructor. No fields are initialized. */
131 Request()
132 : validPaddr(false), validAsidVaddr(false),
129 /** Whether or not the cpu number & thread ID are valid. */
130 bool validCpuAndThreadNums;
131 /** Whether or not the pc is valid. */
132 bool validPC;
133
134 public:
135 /** Minimal constructor. No fields are initialized. */
136 Request()
137 : validPaddr(false), validAsidVaddr(false),
133 validScResult(false), validCpuAndThreadNums(false), validPC(false)
138 validExData(false), validCpuAndThreadNums(false), validPC(false)
134 {}
135
136 /**
137 * Constructor for physical (e.g. device) requests. Initializes
138 * just physical address, size, flags, and timestamp (to curTick).
139 * These fields are adequate to perform a request. */
140 Request(Addr _paddr, int _size, int _flags)
141 : validCpuAndThreadNums(false)

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

164 {
165 paddr = _paddr;
166 size = _size;
167 flags = _flags;
168 time = curTick;
169 validPaddr = true;
170 validAsidVaddr = false;
171 validPC = false;
139 {}
140
141 /**
142 * Constructor for physical (e.g. device) requests. Initializes
143 * just physical address, size, flags, and timestamp (to curTick).
144 * These fields are adequate to perform a request. */
145 Request(Addr _paddr, int _size, int _flags)
146 : validCpuAndThreadNums(false)

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

169 {
170 paddr = _paddr;
171 size = _size;
172 flags = _flags;
173 time = curTick;
174 validPaddr = true;
175 validAsidVaddr = false;
176 validPC = false;
172 validScResult = false;
177 validExData = false;
173 mmapedIpr = false;
174 }
175
176 /**
177 * Set up a virtual (e.g., CPU) request in a previously
178 * allocated Request object. */
179 void setVirt(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc)
180 {
181 asid = _asid;
182 vaddr = _vaddr;
183 size = _size;
184 flags = _flags;
185 pc = _pc;
186 time = curTick;
187 validPaddr = false;
188 validAsidVaddr = true;
189 validPC = true;
178 mmapedIpr = false;
179 }
180
181 /**
182 * Set up a virtual (e.g., CPU) request in a previously
183 * allocated Request object. */
184 void setVirt(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc)
185 {
186 asid = _asid;
187 vaddr = _vaddr;
188 size = _size;
189 flags = _flags;
190 pc = _pc;
191 time = curTick;
192 validPaddr = false;
193 validAsidVaddr = true;
194 validPC = true;
190 validScResult = false;
195 validExData = false;
191 mmapedIpr = false;
192 }
193
194 /** Set just the physical address. This should only be used to
195 * record the result of a translation, and thus the vaddr must be
196 * valid before this method is called. Otherwise, use setPhys()
197 * to guarantee that the size and flags are also set.
198 */

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

232
233 /** Accessor function for asi.*/
234 bool isMmapedIpr() { assert(validPaddr); return mmapedIpr; }
235
236 /** Accessor function for asi.*/
237 void setMmapedIpr(bool r) { assert(validAsidVaddr); mmapedIpr = r; }
238
239 /** Accessor function to check if sc result is valid. */
196 mmapedIpr = false;
197 }
198
199 /** Set just the physical address. This should only be used to
200 * record the result of a translation, and thus the vaddr must be
201 * valid before this method is called. Otherwise, use setPhys()
202 * to guarantee that the size and flags are also set.
203 */

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

237
238 /** Accessor function for asi.*/
239 bool isMmapedIpr() { assert(validPaddr); return mmapedIpr; }
240
241 /** Accessor function for asi.*/
242 void setMmapedIpr(bool r) { assert(validAsidVaddr); mmapedIpr = r; }
243
244 /** Accessor function to check if sc result is valid. */
240 bool scResultValid() { return validScResult; }
245 bool extraDataValid() { return validExData; }
241 /** Accessor function for store conditional return value.*/
246 /** Accessor function for store conditional return value.*/
242 uint64_t getScResult() { assert(validScResult); return scResult; }
247 uint64_t getExtraData() { assert(validExData); return extraData; }
243 /** Accessor function for store conditional return value.*/
248 /** Accessor function for store conditional return value.*/
244 void setScResult(uint64_t _scResult)
245 { scResult = _scResult; validScResult = true; }
249 void setExtraData(uint64_t _extraData)
250 { extraData = _extraData; validExData = true; }
246
247 /** Accessor function for cpu number.*/
248 int getCpuNum() { assert(validCpuAndThreadNums); return cpuNum; }
249 /** Accessor function for thread number.*/
250 int getThreadNum() { assert(validCpuAndThreadNums); return threadNum; }
251
252 /** Accessor function for pc.*/
253 Addr getPC() { assert(validPC); return pc; }
254
255 /** Accessor Function to Check Cacheability. */
256 bool isUncacheable() { return (getFlags() & UNCACHEABLE) != 0; }
257
258 bool isInstRead() { return (getFlags() & INST_READ) != 0; }
259
260 bool isLocked() { return (getFlags() & LOCKED) != 0; }
261
251
252 /** Accessor function for cpu number.*/
253 int getCpuNum() { assert(validCpuAndThreadNums); return cpuNum; }
254 /** Accessor function for thread number.*/
255 int getThreadNum() { assert(validCpuAndThreadNums); return threadNum; }
256
257 /** Accessor function for pc.*/
258 Addr getPC() { assert(validPC); return pc; }
259
260 /** Accessor Function to Check Cacheability. */
261 bool isUncacheable() { return (getFlags() & UNCACHEABLE) != 0; }
262
263 bool isInstRead() { return (getFlags() & INST_READ) != 0; }
264
265 bool isLocked() { return (getFlags() & LOCKED) != 0; }
266
267 bool isSwap() { return (getFlags() & MEM_SWAP ||
268 getFlags() & MEM_SWAP_COND); }
269
270 bool isCondSwap() { return (getFlags() & MEM_SWAP_COND) != 0; }
271
272
262 friend class Packet;
263};
264
265#endif // __MEM_REQUEST_HH__
273 friend class Packet;
274};
275
276#endif // __MEM_REQUEST_HH__