Deleted Added
sdiff udiff text old ( 3647:8121d4503cbc ) new ( 3867:807483cfab77 )
full compact
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 std::list<unsigned>::iterator threads = (*activeThreads).begin();
250 std::list<unsigned>::iterator list_end = (*activeThreads).end();
251
252 int maxEntries;
253
254 if (lsqPolicy == Partitioned) {
255 maxEntries = LQEntries / active_threads;
256 } else if (lsqPolicy == Threshold && active_threads == 1) {
257 maxEntries = LQEntries;
258 } else {
259 maxEntries = LQEntries;
260 }
261
262 while (threads != list_end) {
263 resizeEntries(maxEntries,*threads++);
264 }
265 }
266}
267
268template<class Impl>
269void
270LSQ<Impl>::removeEntries(unsigned tid)
271{

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

280 thread[tid].resizeLQ(size);
281 thread[tid].resizeSQ(size);
282}
283
284template<class Impl>
285void
286LSQ<Impl>::tick()
287{
288 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
289
290 while (active_threads != (*activeThreads).end()) {
291 unsigned tid = *active_threads++;
292
293 thread[tid].tick();
294 }
295}
296
297template<class Impl>
298void
299LSQ<Impl>::insertLoad(DynInstPtr &load_inst)

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

329
330 return thread[tid].executeStore(inst);
331}
332
333template<class Impl>
334void
335LSQ<Impl>::writebackStores()
336{
337 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
338
339 while (active_threads != (*activeThreads).end()) {
340 unsigned tid = *active_threads++;
341
342 if (numStoresToWB(tid) > 0) {
343 DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores "
344 "available for Writeback.\n", tid, numStoresToWB(tid));
345 }
346
347 thread[tid].writebackStores();
348 }
349}
350
351template<class Impl>
352bool
353LSQ<Impl>::violation()
354{
355 /* Answers: Does Anybody Have a Violation?*/
356 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
357
358 while (active_threads != (*activeThreads).end()) {
359 unsigned tid = *active_threads++;
360 if (thread[tid].violation())
361 return true;
362 }
363
364 return false;
365}
366
367template<class Impl>
368int
369LSQ<Impl>::getCount()
370{
371 unsigned total = 0;
372
373 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
374
375 while (active_threads != (*activeThreads).end()) {
376 unsigned tid = *active_threads++;
377 total += getCount(tid);
378 }
379
380 return total;
381}
382
383template<class Impl>
384int
385LSQ<Impl>::numLoads()
386{
387 unsigned total = 0;
388
389 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
390
391 while (active_threads != (*activeThreads).end()) {
392 unsigned tid = *active_threads++;
393 total += numLoads(tid);
394 }
395
396 return total;
397}
398
399template<class Impl>
400int
401LSQ<Impl>::numStores()
402{
403 unsigned total = 0;
404
405 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
406
407 while (active_threads != (*activeThreads).end()) {
408 unsigned tid = *active_threads++;
409 total += thread[tid].numStores();
410 }
411
412 return total;
413}
414
415template<class Impl>
416int
417LSQ<Impl>::numLoadsReady()
418{
419 unsigned total = 0;
420
421 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
422
423 while (active_threads != (*activeThreads).end()) {
424 unsigned tid = *active_threads++;
425 total += thread[tid].numLoadsReady();
426 }
427
428 return total;
429}
430
431template<class Impl>
432unsigned
433LSQ<Impl>::numFreeEntries()
434{
435 unsigned total = 0;
436
437 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
438
439 while (active_threads != (*activeThreads).end()) {
440 unsigned tid = *active_threads++;
441 total += thread[tid].numFreeEntries();
442 }
443
444 return total;
445}
446
447template<class Impl>
448unsigned

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

453 //else
454 return thread[tid].numFreeEntries();
455}
456
457template<class Impl>
458bool
459LSQ<Impl>::isFull()
460{
461 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
462
463 while (active_threads != (*activeThreads).end()) {
464 unsigned tid = *active_threads++;
465 if (! (thread[tid].lqFull() || thread[tid].sqFull()) )
466 return false;
467 }
468
469 return true;
470}
471
472template<class Impl>
473bool
474LSQ<Impl>::isFull(unsigned tid)
475{
476 //@todo: Change to Calculate All Entries for
477 //Dynamic Policy
478 if( lsqPolicy == Dynamic )
479 return isFull();
480 else
481 return thread[tid].lqFull() || thread[tid].sqFull();
482}
483
484template<class Impl>
485bool
486LSQ<Impl>::lqFull()
487{
488 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
489
490 while (active_threads != (*activeThreads).end()) {
491 unsigned tid = *active_threads++;
492 if (!thread[tid].lqFull())
493 return false;
494 }
495
496 return true;
497}
498
499template<class Impl>

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

507 else
508 return thread[tid].lqFull();
509}
510
511template<class Impl>
512bool
513LSQ<Impl>::sqFull()
514{
515 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
516
517 while (active_threads != (*activeThreads).end()) {
518 unsigned tid = *active_threads++;
519 if (!sqFull(tid))
520 return false;
521 }
522
523 return true;
524}
525
526template<class Impl>

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

534 else
535 return thread[tid].sqFull();
536}
537
538template<class Impl>
539bool
540LSQ<Impl>::isStalled()
541{
542 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
543
544 while (active_threads != (*activeThreads).end()) {
545 unsigned tid = *active_threads++;
546 if (!thread[tid].isStalled())
547 return false;
548 }
549
550 return true;
551}
552
553template<class Impl>

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

559 else
560 return thread[tid].isStalled();
561}
562
563template<class Impl>
564bool
565LSQ<Impl>::hasStoresToWB()
566{
567 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
568
569 if ((*activeThreads).empty())
570 return false;
571
572 while (active_threads != (*activeThreads).end()) {
573 unsigned tid = *active_threads++;
574 if (!hasStoresToWB(tid))
575 return false;
576 }
577
578 return true;
579}
580
581template<class Impl>
582bool
583LSQ<Impl>::willWB()
584{
585 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
586
587 while (active_threads != (*activeThreads).end()) {
588 unsigned tid = *active_threads++;
589 if (!willWB(tid))
590 return false;
591 }
592
593 return true;
594}
595
596template<class Impl>
597void
598LSQ<Impl>::dumpInsts()
599{
600 std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
601
602 while (active_threads != (*activeThreads).end()) {
603 unsigned tid = *active_threads++;
604 thread[tid].dumpInsts();
605 }
606}