request.hh (6223:3623155c0e95) | request.hh (6427:50125d42559c) |
---|---|
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; --- 118 unchanged lines hidden (view full) --- 127 static const PrivateFlagsType STICKY_PRIVATE_FLAGS = 128 VALID_CONTEXT_ID | VALID_THREAD_ID; 129 130 private: 131 /** 132 * The physical address of the request. Valid only if validPaddr 133 * is set. 134 */ | 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; --- 118 unchanged lines hidden (view full) --- 127 static const PrivateFlagsType STICKY_PRIVATE_FLAGS = 128 VALID_CONTEXT_ID | VALID_THREAD_ID; 129 130 private: 131 /** 132 * The physical address of the request. Valid only if validPaddr 133 * is set. 134 */ |
135 Addr paddr; | 135 Addr _paddr; |
136 137 /** 138 * The size of the request. This field must be set when vaddr or 139 * paddr is written via setVirt() or setPhys(), so it is always 140 * valid as long as one of the address fields is valid. 141 */ | 136 137 /** 138 * The size of the request. This field must be set when vaddr or 139 * paddr is written via setVirt() or setPhys(), so it is always 140 * valid as long as one of the address fields is valid. 141 */ |
142 int size; | 142 int _size; |
143 144 /** Flag structure for the request. */ | 143 144 /** Flag structure for the request. */ |
145 Flags flags; | 145 Flags _flags; |
146 147 /** Private flags for field validity checking. */ 148 PrivateFlags privateFlags; 149 150 /** 151 * The time this request was started. Used to calculate 152 * latencies. This field is set to curTick any time paddr or vaddr 153 * is written. 154 */ 155 Tick _time; 156 157 /** The address space ID. */ | 146 147 /** Private flags for field validity checking. */ 148 PrivateFlags privateFlags; 149 150 /** 151 * The time this request was started. Used to calculate 152 * latencies. This field is set to curTick any time paddr or vaddr 153 * is written. 154 */ 155 Tick _time; 156 157 /** The address space ID. */ |
158 int asid; | 158 int _asid; |
159 160 /** The virtual address of the request. */ | 159 160 /** The virtual address of the request. */ |
161 Addr vaddr; | 161 Addr _vaddr; |
162 163 /** 164 * Extra data for the request, such as the return value of 165 * store conditional or the compare value for a CAS. */ | 162 163 /** 164 * Extra data for the request, such as the return value of 165 * store conditional or the compare value for a CAS. */ |
166 uint64_t extraData; | 166 uint64_t _extraData; |
167 168 /** The context ID (for statistics, typically). */ 169 int _contextId; 170 /** The thread ID (id within this CPU) */ 171 int _threadId; 172 173 /** program counter of initiating access; for tracing/debugging */ | 167 168 /** The context ID (for statistics, typically). */ 169 int _contextId; 170 /** The thread ID (id within this CPU) */ 171 int _threadId; 172 173 /** program counter of initiating access; for tracing/debugging */ |
174 Addr pc; | 174 Addr _pc; |
175 176 public: | 175 176 public: |
177 /** Minimal constructor. No fields are initialized. */ | 177 /** Minimal constructor. No fields are initialized. 178 * (Note that _flags and privateFlags are cleared by Flags 179 * default constructor.) 180 */ |
178 Request() 179 {} 180 181 /** 182 * Constructor for physical (e.g. device) requests. Initializes 183 * just physical address, size, flags, and timestamp (to curTick). 184 * These fields are adequate to perform a request. 185 */ --- 27 unchanged lines hidden (view full) --- 213 privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 214 } 215 216 /** 217 * Set up a physical (e.g. device) request in a previously 218 * allocated Request object. 219 */ 220 void | 181 Request() 182 {} 183 184 /** 185 * Constructor for physical (e.g. device) requests. Initializes 186 * just physical address, size, flags, and timestamp (to curTick). 187 * These fields are adequate to perform a request. 188 */ --- 27 unchanged lines hidden (view full) --- 216 privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 217 } 218 219 /** 220 * Set up a physical (e.g. device) request in a previously 221 * allocated Request object. 222 */ 223 void |
221 setPhys(Addr _paddr, int _size, Flags _flags, Tick time) | 224 setPhys(Addr paddr, int size, Flags flags, Tick time) |
222 { | 225 { |
223 assert(_size >= 0); 224 paddr = _paddr; 225 size = _size; | 226 assert(size >= 0); 227 _paddr = paddr; 228 _size = size; |
226 _time = time; 227 | 229 _time = time; 230 |
228 flags.clear(~STICKY_FLAGS); 229 flags.set(_flags); | 231 _flags.clear(~STICKY_FLAGS); 232 _flags.set(flags); |
230 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 231 privateFlags.set(VALID_PADDR|VALID_SIZE); 232 } 233 234 void | 233 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 234 privateFlags.set(VALID_PADDR|VALID_SIZE); 235 } 236 237 void |
235 setPhys(Addr _paddr, int _size, Flags _flags) | 238 setPhys(Addr paddr, int size, Flags flags) |
236 { | 239 { |
237 setPhys(_paddr, _size, _flags, curTick); | 240 setPhys(paddr, size, flags, curTick); |
238 } 239 240 /** 241 * Set up a virtual (e.g., CPU) request in a previously 242 * allocated Request object. 243 */ 244 void | 241 } 242 243 /** 244 * Set up a virtual (e.g., CPU) request in a previously 245 * allocated Request object. 246 */ 247 void |
245 setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc) | 248 setVirt(int asid, Addr vaddr, int size, Flags flags, Addr pc) |
246 { | 249 { |
247 assert(_size >= 0); 248 asid = _asid; 249 vaddr = _vaddr; 250 size = _size; 251 flags = _flags; 252 pc = _pc; | 250 assert(size >= 0); 251 _asid = asid; 252 _vaddr = vaddr; 253 _size = size; 254 _pc = pc; |
253 _time = curTick; 254 | 255 _time = curTick; 256 |
255 flags.clear(~STICKY_FLAGS); 256 flags.set(_flags); | 257 _flags.clear(~STICKY_FLAGS); 258 _flags.set(flags); |
257 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 258 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 259 } 260 261 /** 262 * Set just the physical address. This should only be used to 263 * record the result of a translation, and thus the vaddr must be 264 * valid before this method is called. Otherwise, use setPhys() 265 * to guarantee that the size and flags are also set. 266 */ 267 void | 259 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 260 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 261 } 262 263 /** 264 * Set just the physical address. This should only be used to 265 * record the result of a translation, and thus the vaddr must be 266 * valid before this method is called. Otherwise, use setPhys() 267 * to guarantee that the size and flags are also set. 268 */ 269 void |
268 setPaddr(Addr _paddr) | 270 setPaddr(Addr paddr) |
269 { 270 assert(privateFlags.isSet(VALID_VADDR)); | 271 { 272 assert(privateFlags.isSet(VALID_VADDR)); |
271 paddr = _paddr; | 273 _paddr = paddr; |
272 privateFlags.set(VALID_PADDR); 273 } 274 275 /** 276 * Generate two requests as if this request had been split into two 277 * pieces. The original request can't have been translated already. 278 */ 279 void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 280 { 281 assert(privateFlags.isSet(VALID_VADDR)); 282 assert(privateFlags.noneSet(VALID_PADDR)); | 274 privateFlags.set(VALID_PADDR); 275 } 276 277 /** 278 * Generate two requests as if this request had been split into two 279 * pieces. The original request can't have been translated already. 280 */ 281 void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 282 { 283 assert(privateFlags.isSet(VALID_VADDR)); 284 assert(privateFlags.noneSet(VALID_PADDR)); |
283 assert(split_addr > vaddr && split_addr < vaddr + size); | 285 assert(split_addr > _vaddr && split_addr < _vaddr + _size); |
284 req1 = new Request; 285 *req1 = *this; 286 req2 = new Request; 287 *req2 = *this; | 286 req1 = new Request; 287 *req1 = *this; 288 req2 = new Request; 289 *req2 = *this; |
288 req1->size = split_addr - vaddr; 289 req2->vaddr = split_addr; 290 req2->size = size - req1->size; | 290 req1->_size = split_addr - _vaddr; 291 req2->_vaddr = split_addr; 292 req2->_size = _size - req1->_size; |
291 } 292 293 /** 294 * Accessor for paddr. 295 */ 296 bool 297 hasPaddr() 298 { 299 return privateFlags.isSet(VALID_PADDR); 300 } 301 302 Addr 303 getPaddr() 304 { 305 assert(privateFlags.isSet(VALID_PADDR)); | 293 } 294 295 /** 296 * Accessor for paddr. 297 */ 298 bool 299 hasPaddr() 300 { 301 return privateFlags.isSet(VALID_PADDR); 302 } 303 304 Addr 305 getPaddr() 306 { 307 assert(privateFlags.isSet(VALID_PADDR)); |
306 return paddr; | 308 return _paddr; |
307 } 308 309 /** 310 * Accessor for size. 311 */ 312 bool 313 hasSize() 314 { 315 return privateFlags.isSet(VALID_SIZE); 316 } 317 318 int 319 getSize() 320 { 321 assert(privateFlags.isSet(VALID_SIZE)); | 309 } 310 311 /** 312 * Accessor for size. 313 */ 314 bool 315 hasSize() 316 { 317 return privateFlags.isSet(VALID_SIZE); 318 } 319 320 int 321 getSize() 322 { 323 assert(privateFlags.isSet(VALID_SIZE)); |
322 return size; | 324 return _size; |
323 } 324 325 /** Accessor for time. */ 326 Tick 327 time() const 328 { 329 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 330 return _time; --- 6 unchanged lines hidden (view full) --- 337 _time = time; 338 } 339 340 /** Accessor for flags. */ 341 Flags 342 getFlags() 343 { 344 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); | 325 } 326 327 /** Accessor for time. */ 328 Tick 329 time() const 330 { 331 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 332 return _time; --- 6 unchanged lines hidden (view full) --- 339 _time = time; 340 } 341 342 /** Accessor for flags. */ 343 Flags 344 getFlags() 345 { 346 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); |
345 return flags; | 347 return _flags; |
346 } 347 348 void | 348 } 349 350 void |
349 setFlags(Flags _flags) | 351 setFlags(Flags flags) |
350 { 351 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); | 352 { 353 assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); |
352 flags.set(_flags); | 354 _flags.set(flags); |
353 } 354 355 /** Accessor function for vaddr.*/ 356 Addr 357 getVaddr() 358 { 359 assert(privateFlags.isSet(VALID_VADDR)); | 355 } 356 357 /** Accessor function for vaddr.*/ 358 Addr 359 getVaddr() 360 { 361 assert(privateFlags.isSet(VALID_VADDR)); |
360 return vaddr; | 362 return _vaddr; |
361 } 362 363 /** Accessor function for asid.*/ 364 int 365 getAsid() 366 { 367 assert(privateFlags.isSet(VALID_VADDR)); | 363 } 364 365 /** Accessor function for asid.*/ 366 int 367 getAsid() 368 { 369 assert(privateFlags.isSet(VALID_VADDR)); |
368 return asid; | 370 return _asid; |
369 } 370 371 /** Accessor function for asi.*/ 372 uint8_t 373 getAsi() 374 { 375 assert(privateFlags.isSet(VALID_VADDR)); | 371 } 372 373 /** Accessor function for asi.*/ 374 uint8_t 375 getAsi() 376 { 377 assert(privateFlags.isSet(VALID_VADDR)); |
376 return flags & ASI_BITS; | 378 return _flags & ASI_BITS; |
377 } 378 379 /** Accessor function for MMAPED_IPR flag. */ 380 bool 381 isMmapedIpr() 382 { 383 assert(privateFlags.isSet(VALID_PADDR)); | 379 } 380 381 /** Accessor function for MMAPED_IPR flag. */ 382 bool 383 isMmapedIpr() 384 { 385 assert(privateFlags.isSet(VALID_PADDR)); |
384 return flags.isSet(MMAPED_IPR); | 386 return _flags.isSet(MMAPED_IPR); |
385 } 386 387 void 388 setMmapedIpr(bool r) 389 { 390 assert(VALID_VADDR); | 387 } 388 389 void 390 setMmapedIpr(bool r) 391 { 392 assert(VALID_VADDR); |
391 flags.set(MMAPED_IPR); | 393 _flags.set(MMAPED_IPR); |
392 } 393 394 /** Accessor function to check if sc result is valid. */ 395 bool 396 extraDataValid() 397 { 398 return privateFlags.isSet(VALID_EXTRA_DATA); 399 } 400 401 /** Accessor function for store conditional return value.*/ 402 uint64_t 403 getExtraData() const 404 { 405 assert(privateFlags.isSet(VALID_EXTRA_DATA)); | 394 } 395 396 /** Accessor function to check if sc result is valid. */ 397 bool 398 extraDataValid() 399 { 400 return privateFlags.isSet(VALID_EXTRA_DATA); 401 } 402 403 /** Accessor function for store conditional return value.*/ 404 uint64_t 405 getExtraData() const 406 { 407 assert(privateFlags.isSet(VALID_EXTRA_DATA)); |
406 return extraData; | 408 return _extraData; |
407 } 408 409 /** Accessor function for store conditional return value.*/ 410 void | 409 } 410 411 /** Accessor function for store conditional return value.*/ 412 void |
411 setExtraData(uint64_t _extraData) | 413 setExtraData(uint64_t extraData) |
412 { | 414 { |
413 extraData = _extraData; | 415 _extraData = extraData; |
414 privateFlags.set(VALID_EXTRA_DATA); 415 } 416 417 bool 418 hasContextId() const 419 { 420 return privateFlags.isSet(VALID_CONTEXT_ID); 421 } --- 20 unchanged lines hidden (view full) --- 442 return privateFlags.isSet(VALID_PC); 443 } 444 445 /** Accessor function for pc.*/ 446 Addr 447 getPC() const 448 { 449 assert(privateFlags.isSet(VALID_PC)); | 416 privateFlags.set(VALID_EXTRA_DATA); 417 } 418 419 bool 420 hasContextId() const 421 { 422 return privateFlags.isSet(VALID_CONTEXT_ID); 423 } --- 20 unchanged lines hidden (view full) --- 444 return privateFlags.isSet(VALID_PC); 445 } 446 447 /** Accessor function for pc.*/ 448 Addr 449 getPC() const 450 { 451 assert(privateFlags.isSet(VALID_PC)); |
450 return pc; | 452 return _pc; |
451 } 452 453 /** Accessor Function to Check Cacheability. */ | 453 } 454 455 /** Accessor Function to Check Cacheability. */ |
454 bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 455 bool isInstFetch() const { return flags.isSet(INST_FETCH); } 456 bool isPrefetch() const { return flags.isSet(PREFETCH); } 457 bool isLLSC() const { return flags.isSet(LLSC); } 458 bool isLocked() const { return flags.isSet(LOCKED); } 459 bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 460 bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } | 456 bool isUncacheable() const { return _flags.isSet(UNCACHEABLE); } 457 bool isInstFetch() const { return _flags.isSet(INST_FETCH); } 458 bool isPrefetch() const { return _flags.isSet(PREFETCH); } 459 bool isLLSC() const { return _flags.isSet(LLSC); } 460 bool isLocked() const { return _flags.isSet(LOCKED); } 461 bool isSwap() const { return _flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 462 bool isCondSwap() const { return _flags.isSet(MEM_SWAP_COND); } |
461 462 bool 463 isMisaligned() const 464 { | 463 464 bool 465 isMisaligned() const 466 { |
465 if (flags.isSet(NO_ALIGN_FAULT)) | 467 if (_flags.isSet(NO_ALIGN_FAULT)) |
466 return false; 467 | 468 return false; 469 |
468 if ((vaddr & 0x1)) | 470 if ((_vaddr & 0x1)) |
469 return true; 470 | 471 return true; 472 |
471 if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) | 473 if (_flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) |
472 return false; 473 | 474 return false; 475 |
474 if ((vaddr & 0x2)) | 476 if ((_vaddr & 0x2)) |
475 return true; 476 477 return false; 478 } 479}; 480 481#endif // __MEM_REQUEST_HH__ | 477 return true; 478 479 return false; 480 } 481}; 482 483#endif // __MEM_REQUEST_HH__ |