1/* 2 * Copyright (c) 2005-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; --- 230 unchanged lines hidden (view full) --- 239 } 240} 241 242template <class Impl> 243void 244LSQ<Impl>::resetEntries() 245{ 246 if (lsqPolicy != Dynamic || numThreads > 1) { |
247 int active_threads = activeThreads->size(); |
248 |
249 int maxEntries; 250 251 if (lsqPolicy == Partitioned) { 252 maxEntries = LQEntries / active_threads; 253 } else if (lsqPolicy == Threshold && active_threads == 1) { 254 maxEntries = LQEntries; 255 } else { 256 maxEntries = LQEntries; 257 } 258 |
259 std::list<unsigned>::iterator threads = activeThreads->begin(); 260 std::list<unsigned>::iterator end = activeThreads->end(); 261 262 while (threads != end) { 263 unsigned tid = *threads++; 264 265 resizeEntries(maxEntries, tid); |
266 } 267 } 268} 269 270template<class Impl> 271void 272LSQ<Impl>::removeEntries(unsigned tid) 273{ --- 8 unchanged lines hidden (view full) --- 282 thread[tid].resizeLQ(size); 283 thread[tid].resizeSQ(size); 284} 285 286template<class Impl> 287void 288LSQ<Impl>::tick() 289{ |
290 std::list<unsigned>::iterator threads = activeThreads->begin(); 291 std::list<unsigned>::iterator end = activeThreads->end(); |
292 |
293 while (threads != end) { 294 unsigned tid = *threads++; |
295 296 thread[tid].tick(); 297 } 298} 299 300template<class Impl> 301void 302LSQ<Impl>::insertLoad(DynInstPtr &load_inst) --- 29 unchanged lines hidden (view full) --- 332 333 return thread[tid].executeStore(inst); 334} 335 336template<class Impl> 337void 338LSQ<Impl>::writebackStores() 339{ |
340 std::list<unsigned>::iterator threads = activeThreads->begin(); 341 std::list<unsigned>::iterator end = activeThreads->end(); |
342 |
343 while (threads != end) { 344 unsigned tid = *threads++; |
345 346 if (numStoresToWB(tid) > 0) { 347 DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 348 "available for Writeback.\n", tid, numStoresToWB(tid)); 349 } 350 351 thread[tid].writebackStores(); 352 } 353} 354 355template<class Impl> 356bool 357LSQ<Impl>::violation() 358{ 359 /* Answers: Does Anybody Have a Violation?*/ |
360 std::list<unsigned>::iterator threads = activeThreads->begin(); 361 std::list<unsigned>::iterator end = activeThreads->end(); |
362 |
363 while (threads != end) { 364 unsigned tid = *threads++; 365 |
366 if (thread[tid].violation()) 367 return true; 368 } 369 370 return false; 371} 372 373template<class Impl> 374int 375LSQ<Impl>::getCount() 376{ 377 unsigned total = 0; 378 |
379 std::list<unsigned>::iterator threads = activeThreads->begin(); 380 std::list<unsigned>::iterator end = activeThreads->end(); |
381 |
382 while (threads != end) { 383 unsigned tid = *threads++; 384 |
385 total += getCount(tid); 386 } 387 388 return total; 389} 390 391template<class Impl> 392int 393LSQ<Impl>::numLoads() 394{ 395 unsigned total = 0; 396 |
397 std::list<unsigned>::iterator threads = activeThreads->begin(); 398 std::list<unsigned>::iterator end = activeThreads->end(); |
399 |
400 while (threads != end) { 401 unsigned tid = *threads++; 402 |
403 total += numLoads(tid); 404 } 405 406 return total; 407} 408 409template<class Impl> 410int 411LSQ<Impl>::numStores() 412{ 413 unsigned total = 0; 414 |
415 std::list<unsigned>::iterator threads = activeThreads->begin(); 416 std::list<unsigned>::iterator end = activeThreads->end(); |
417 |
418 while (threads != end) { 419 unsigned tid = *threads++; 420 |
421 total += thread[tid].numStores(); 422 } 423 424 return total; 425} 426 427template<class Impl> 428int 429LSQ<Impl>::numLoadsReady() 430{ 431 unsigned total = 0; 432 |
433 std::list<unsigned>::iterator threads = activeThreads->begin(); 434 std::list<unsigned>::iterator end = activeThreads->end(); |
435 |
436 while (threads != end) { 437 unsigned tid = *threads++; 438 |
439 total += thread[tid].numLoadsReady(); 440 } 441 442 return total; 443} 444 445template<class Impl> 446unsigned 447LSQ<Impl>::numFreeEntries() 448{ 449 unsigned total = 0; 450 |
451 std::list<unsigned>::iterator threads = activeThreads->begin(); 452 std::list<unsigned>::iterator end = activeThreads->end(); |
453 |
454 while (threads != end) { 455 unsigned tid = *threads++; 456 |
457 total += thread[tid].numFreeEntries(); 458 } 459 460 return total; 461} 462 463template<class Impl> 464unsigned --- 4 unchanged lines hidden (view full) --- 469 //else 470 return thread[tid].numFreeEntries(); 471} 472 473template<class Impl> 474bool 475LSQ<Impl>::isFull() 476{ |
477 std::list<unsigned>::iterator threads = activeThreads->begin(); 478 std::list<unsigned>::iterator end = activeThreads->end(); |
479 |
480 while (threads != end) { 481 unsigned tid = *threads++; 482 483 if (!(thread[tid].lqFull() || thread[tid].sqFull())) |
484 return false; 485 } 486 487 return true; 488} 489 490template<class Impl> 491bool 492LSQ<Impl>::isFull(unsigned tid) 493{ 494 //@todo: Change to Calculate All Entries for 495 //Dynamic Policy |
496 if (lsqPolicy == Dynamic) |
497 return isFull(); 498 else 499 return thread[tid].lqFull() || thread[tid].sqFull(); 500} 501 502template<class Impl> 503bool 504LSQ<Impl>::lqFull() 505{ |
506 std::list<unsigned>::iterator threads = activeThreads->begin(); 507 std::list<unsigned>::iterator end = activeThreads->end(); |
508 |
509 while (threads != end) { 510 unsigned tid = *threads++; 511 |
512 if (!thread[tid].lqFull()) 513 return false; 514 } 515 516 return true; 517} 518 519template<class Impl> --- 7 unchanged lines hidden (view full) --- 527 else 528 return thread[tid].lqFull(); 529} 530 531template<class Impl> 532bool 533LSQ<Impl>::sqFull() 534{ |
535 std::list<unsigned>::iterator threads = activeThreads->begin(); 536 std::list<unsigned>::iterator end = activeThreads->end(); |
537 |
538 while (threads != end) { 539 unsigned tid = *threads++; 540 |
541 if (!sqFull(tid)) 542 return false; 543 } 544 545 return true; 546} 547 548template<class Impl> --- 7 unchanged lines hidden (view full) --- 556 else 557 return thread[tid].sqFull(); 558} 559 560template<class Impl> 561bool 562LSQ<Impl>::isStalled() 563{ |
564 std::list<unsigned>::iterator threads = activeThreads->begin(); 565 std::list<unsigned>::iterator end = activeThreads->end(); |
566 |
567 while (threads != end) { 568 unsigned tid = *threads++; 569 |
570 if (!thread[tid].isStalled()) 571 return false; 572 } 573 574 return true; 575} 576 577template<class Impl> --- 5 unchanged lines hidden (view full) --- 583 else 584 return thread[tid].isStalled(); 585} 586 587template<class Impl> 588bool 589LSQ<Impl>::hasStoresToWB() 590{ |
591 std::list<unsigned>::iterator threads = activeThreads->begin(); 592 std::list<unsigned>::iterator end = activeThreads->end(); |
593 |
594 if (threads == end) |
595 return false; 596 |
597 while (threads != end) { 598 unsigned tid = *threads++; 599 |
600 if (!hasStoresToWB(tid)) 601 return false; 602 } 603 604 return true; 605} 606 607template<class Impl> 608bool 609LSQ<Impl>::willWB() 610{ |
611 std::list<unsigned>::iterator threads = activeThreads->begin(); 612 std::list<unsigned>::iterator end = activeThreads->end(); |
613 |
614 while (threads != end) { 615 unsigned tid = *threads++; 616 |
617 if (!willWB(tid)) 618 return false; 619 } 620 621 return true; 622} 623 624template<class Impl> 625void 626LSQ<Impl>::dumpInsts() 627{ |
628 std::list<unsigned>::iterator threads = activeThreads->begin(); 629 std::list<unsigned>::iterator end = activeThreads->end(); |
630 |
631 while (threads != end) { 632 unsigned tid = *threads++; 633 |
634 thread[tid].dumpInsts(); 635 } 636} |