request.hh (5745:6b0f8306704b) | request.hh (5764:f07df23e1fc8) |
---|---|
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; --- 216 unchanged lines hidden (view full) --- 225 * Set just the physical address. This should only be used to 226 * record the result of a translation, and thus the vaddr must be 227 * valid before this method is called. Otherwise, use setPhys() 228 * to guarantee that the size and flags are also set. 229 */ 230 void 231 setPaddr(Addr _paddr) 232 { | 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; --- 216 unchanged lines hidden (view full) --- 225 * Set just the physical address. This should only be used to 226 * record the result of a translation, and thus the vaddr must be 227 * valid before this method is called. Otherwise, use setPhys() 228 * to guarantee that the size and flags are also set. 229 */ 230 void 231 setPaddr(Addr _paddr) 232 { |
233 assert(flags.any(VALID_VADDR)); | 233 assert(flags.isSet(VALID_VADDR)); |
234 paddr = _paddr; 235 flags.set(VALID_PADDR); 236 } 237 238 /** 239 * Generate two requests as if this request had been split into two 240 * pieces. The original request can't have been translated already. 241 */ 242 void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 243 { | 234 paddr = _paddr; 235 flags.set(VALID_PADDR); 236 } 237 238 /** 239 * Generate two requests as if this request had been split into two 240 * pieces. The original request can't have been translated already. 241 */ 242 void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 243 { |
244 assert(flags.any(VALID_VADDR)); 245 assert(flags.none(VALID_PADDR)); | 244 assert(flags.isSet(VALID_VADDR)); 245 assert(flags.noneSet(VALID_PADDR)); |
246 assert(split_addr > vaddr && split_addr < vaddr + size); 247 req1 = new Request; 248 *req1 = *this; 249 req2 = new Request; 250 *req2 = *this; 251 req1->size = split_addr - vaddr; 252 req2->vaddr = split_addr; 253 req2->size = size - req1->size; 254 } 255 256 /** 257 * Accessor for paddr. 258 */ 259 Addr 260 getPaddr() 261 { | 246 assert(split_addr > vaddr && split_addr < vaddr + size); 247 req1 = new Request; 248 *req1 = *this; 249 req2 = new Request; 250 *req2 = *this; 251 req1->size = split_addr - vaddr; 252 req2->vaddr = split_addr; 253 req2->size = size - req1->size; 254 } 255 256 /** 257 * Accessor for paddr. 258 */ 259 Addr 260 getPaddr() 261 { |
262 assert(flags.any(VALID_PADDR)); | 262 assert(flags.isSet(VALID_PADDR)); |
263 return paddr; 264 } 265 266 /** 267 * Accessor for size. 268 */ 269 int 270 getSize() 271 { | 263 return paddr; 264 } 265 266 /** 267 * Accessor for size. 268 */ 269 int 270 getSize() 271 { |
272 assert(flags.any(VALID_SIZE)); | 272 assert(flags.isSet(VALID_SIZE)); |
273 return size; 274 } 275 276 /** Accessor for time. */ 277 Tick 278 getTime() 279 { | 273 return size; 274 } 275 276 /** Accessor for time. */ 277 Tick 278 getTime() 279 { |
280 assert(flags.any(VALID_PADDR|VALID_VADDR)); | 280 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
281 return time; 282 } 283 284 void 285 setTime(Tick when) 286 { | 281 return time; 282 } 283 284 void 285 setTime(Tick when) 286 { |
287 assert(flags.any(VALID_PADDR|VALID_VADDR)); | 287 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
288 time = when; 289 } 290 | 288 time = when; 289 } 290 |
291 void resetTime() { setTime(curTick); } 292 | |
293 /** Accessor for flags. */ 294 Flags 295 getFlags() 296 { | 291 /** Accessor for flags. */ 292 Flags 293 getFlags() 294 { |
297 assert(flags.any(VALID_PADDR|VALID_VADDR)); | 295 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
298 return flags & PUBLIC_FLAGS; 299 } 300 301 Flags 302 anyFlags(Flags _flags) 303 { | 296 return flags & PUBLIC_FLAGS; 297 } 298 299 Flags 300 anyFlags(Flags _flags) 301 { |
304 assert(flags.any(VALID_PADDR|VALID_VADDR)); 305 assert(_flags.none(~PUBLIC_FLAGS)); 306 return flags.any(_flags); | 302 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 303 assert(_flags.noneSet(~PUBLIC_FLAGS)); 304 return flags.isSet(_flags); |
307 } 308 309 Flags 310 allFlags(Flags _flags) 311 { | 305 } 306 307 Flags 308 allFlags(Flags _flags) 309 { |
312 assert(flags.any(VALID_PADDR|VALID_VADDR)); 313 assert(_flags.none(~PUBLIC_FLAGS)); 314 return flags.all(_flags); | 310 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 311 assert(_flags.noneSet(~PUBLIC_FLAGS)); 312 return flags.allSet(_flags); |
315 } 316 317 /** Accessor for flags. */ 318 void 319 setFlags(Flags _flags) 320 { | 313 } 314 315 /** Accessor for flags. */ 316 void 317 setFlags(Flags _flags) 318 { |
321 assert(flags.any(VALID_PADDR|VALID_VADDR)); 322 assert(_flags.none(~PUBLIC_FLAGS)); | 319 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 320 assert(_flags.noneSet(~PUBLIC_FLAGS)); |
323 flags.set(_flags); 324 } 325 326 void 327 clearFlags(Flags _flags) 328 { | 321 flags.set(_flags); 322 } 323 324 void 325 clearFlags(Flags _flags) 326 { |
329 assert(flags.any(VALID_PADDR|VALID_VADDR)); 330 assert(_flags.none(~PUBLIC_FLAGS)); | 327 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 328 assert(_flags.noneSet(~PUBLIC_FLAGS)); |
331 flags.clear(_flags); 332 } 333 334 void 335 clearFlags() 336 { | 329 flags.clear(_flags); 330 } 331 332 void 333 clearFlags() 334 { |
337 assert(flags.any(VALID_PADDR|VALID_VADDR)); | 335 assert(flags.isSet(VALID_PADDR|VALID_VADDR)); |
338 flags.clear(PUBLIC_FLAGS); 339 } 340 341 /** Accessor function for vaddr.*/ 342 Addr 343 getVaddr() 344 { | 336 flags.clear(PUBLIC_FLAGS); 337 } 338 339 /** Accessor function for vaddr.*/ 340 Addr 341 getVaddr() 342 { |
345 assert(flags.any(VALID_VADDR)); | 343 assert(flags.isSet(VALID_VADDR)); |
346 return vaddr; 347 } 348 349 /** Accessor function for asid.*/ 350 int 351 getAsid() 352 { | 344 return vaddr; 345 } 346 347 /** Accessor function for asid.*/ 348 int 349 getAsid() 350 { |
353 assert(flags.any(VALID_VADDR)); | 351 assert(flags.isSet(VALID_VADDR)); |
354 return asid; 355 } 356 357 /** Accessor function for asi.*/ 358 uint8_t 359 getAsi() 360 { | 352 return asid; 353 } 354 355 /** Accessor function for asi.*/ 356 uint8_t 357 getAsi() 358 { |
361 assert(flags.any(VALID_VADDR)); | 359 assert(flags.isSet(VALID_VADDR)); |
362 return flags & ASI_BITS; 363 } 364 365 /** Accessor function for asi.*/ 366 void 367 setAsi(uint8_t a) 368 { | 360 return flags & ASI_BITS; 361 } 362 363 /** Accessor function for asi.*/ 364 void 365 setAsi(uint8_t a) 366 { |
369 assert(flags.any(VALID_VADDR)); | 367 assert(flags.isSet(VALID_VADDR)); |
370 flags.update(a, ASI_BITS); 371 } 372 373 /** Accessor function for asi.*/ 374 bool 375 isMmapedIpr() 376 { | 368 flags.update(a, ASI_BITS); 369 } 370 371 /** Accessor function for asi.*/ 372 bool 373 isMmapedIpr() 374 { |
377 assert(flags.any(VALID_PADDR)); 378 return flags.any(MMAPED_IPR); | 375 assert(flags.isSet(VALID_PADDR)); 376 return flags.isSet(MMAPED_IPR); |
379 } 380 381 /** Accessor function for asi.*/ 382 void 383 setMmapedIpr(bool r) 384 { 385 assert(VALID_VADDR); 386 flags.set(MMAPED_IPR); 387 } 388 389 /** Accessor function to check if sc result is valid. */ 390 bool 391 extraDataValid() 392 { | 377 } 378 379 /** Accessor function for asi.*/ 380 void 381 setMmapedIpr(bool r) 382 { 383 assert(VALID_VADDR); 384 flags.set(MMAPED_IPR); 385 } 386 387 /** Accessor function to check if sc result is valid. */ 388 bool 389 extraDataValid() 390 { |
393 return flags.any(VALID_EXTRA_DATA); | 391 return flags.isSet(VALID_EXTRA_DATA); |
394 } 395 396 /** Accessor function for store conditional return value.*/ 397 uint64_t 398 getExtraData() const 399 { | 392 } 393 394 /** Accessor function for store conditional return value.*/ 395 uint64_t 396 getExtraData() const 397 { |
400 assert(flags.any(VALID_EXTRA_DATA)); | 398 assert(flags.isSet(VALID_EXTRA_DATA)); |
401 return extraData; 402 } 403 404 /** Accessor function for store conditional return value.*/ 405 void 406 setExtraData(uint64_t _extraData) 407 { 408 extraData = _extraData; 409 flags.set(VALID_EXTRA_DATA); 410 } 411 412 /** Accessor function for context ID.*/ 413 int 414 contextId() const 415 { | 399 return extraData; 400 } 401 402 /** Accessor function for store conditional return value.*/ 403 void 404 setExtraData(uint64_t _extraData) 405 { 406 extraData = _extraData; 407 flags.set(VALID_EXTRA_DATA); 408 } 409 410 /** Accessor function for context ID.*/ 411 int 412 contextId() const 413 { |
416 assert(flags.any(VALID_CONTEXT_ID)); | 414 assert(flags.isSet(VALID_CONTEXT_ID)); |
417 return _contextId; 418 } 419 420 /** Accessor function for thread ID. */ 421 int 422 threadId() const 423 { | 415 return _contextId; 416 } 417 418 /** Accessor function for thread ID. */ 419 int 420 threadId() const 421 { |
424 assert(flags.any(VALID_THREAD_ID)); | 422 assert(flags.isSet(VALID_THREAD_ID)); |
425 return _threadId; 426 } 427 428 /** Accessor function for pc.*/ 429 Addr 430 getPC() const 431 { | 423 return _threadId; 424 } 425 426 /** Accessor function for pc.*/ 427 Addr 428 getPC() const 429 { |
432 assert(flags.any(VALID_PC)); | 430 assert(flags.isSet(VALID_PC)); |
433 return pc; 434 } 435 436 /** Accessor Function to Check Cacheability. */ | 431 return pc; 432 } 433 434 /** Accessor Function to Check Cacheability. */ |
437 bool isUncacheable() const { return flags.any(UNCACHEABLE); } 438 bool isInstRead() const { return flags.any(INST_READ); } 439 bool isLocked() const { return flags.any(LOCKED); } 440 bool isSwap() const { return flags.any(MEM_SWAP|MEM_SWAP_COND); } 441 bool isCondSwap() const { return flags.any(MEM_SWAP_COND); } | 435 bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 436 bool isInstRead() const { return flags.isSet(INST_READ); } 437 bool isLocked() const { return flags.isSet(LOCKED); } 438 bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 439 bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } |
442 443 bool 444 isMisaligned() const 445 { | 440 441 bool 442 isMisaligned() const 443 { |
446 if (flags.any(NO_ALIGN_FAULT)) | 444 if (flags.isSet(NO_ALIGN_FAULT)) |
447 return false; 448 449 if ((vaddr & 0x1)) 450 return true; 451 | 445 return false; 446 447 if ((vaddr & 0x1)) 448 return true; 449 |
452 if (flags.any(NO_HALF_WORD_ALIGN_FAULT)) | 450 if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) |
453 return false; 454 455 if ((vaddr & 0x2)) 456 return true; 457 458 return false; 459 } 460}; 461 462#endif // __MEM_REQUEST_HH__ | 451 return false; 452 453 if ((vaddr & 0x2)) 454 return true; 455 456 return false; 457 } 458}; 459 460#endif // __MEM_REQUEST_HH__ |