lsq_impl.hh (9440:fdc91cab5760) lsq_impl.hh (9444:ab47fe7f03f0)
1/*
2 * Copyright (c) 2011-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

40 * Authors: Korey Sewell
41 */
42
43#include <algorithm>
44#include <list>
45#include <string>
46
47#include "cpu/o3/lsq.hh"
1/*
2 * Copyright (c) 2011-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

40 * Authors: Korey Sewell
41 */
42
43#include <algorithm>
44#include <list>
45#include <string>
46
47#include "cpu/o3/lsq.hh"
48#include "debug/Drain.hh"
48#include "debug/Fetch.hh"
49#include "debug/LSQ.hh"
50#include "debug/Writeback.hh"
51#include "params/DerivO3CPU.hh"
52
53using namespace std;
54
55template <class Impl>

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

138LSQ<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
139{
140 activeThreads = at_ptr;
141 assert(activeThreads != 0);
142}
143
144template <class Impl>
145void
49#include "debug/Fetch.hh"
50#include "debug/LSQ.hh"
51#include "debug/Writeback.hh"
52#include "params/DerivO3CPU.hh"
53
54using namespace std;
55
56template <class Impl>

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

139LSQ<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
140{
141 activeThreads = at_ptr;
142 assert(activeThreads != 0);
143}
144
145template <class Impl>
146void
146LSQ<Impl>::switchOut()
147LSQ<Impl>::drainSanityCheck() const
147{
148{
148 for (ThreadID tid = 0; tid < numThreads; tid++) {
149 thread[tid].switchOut();
149 assert(isDrained());
150
151 for (ThreadID tid = 0; tid < numThreads; tid++)
152 thread[tid].drainSanityCheck();
153}
154
155template <class Impl>
156bool
157LSQ<Impl>::isDrained() const
158{
159 bool drained(true);
160
161 if (!lqEmpty()) {
162 DPRINTF(Drain, "Not drained, LQ not empty.\n");
163 drained = false;
150 }
164 }
165
166 if (!sqEmpty()) {
167 DPRINTF(Drain, "Not drained, SQ not empty.\n");
168 drained = false;
169 }
170
171 if (retryTid != InvalidThreadID) {
172 DPRINTF(Drain, "Not drained, the LSQ has blocked the caches.\n");
173 drained = false;
174 }
175
176 return drained;
151}
152
153template <class Impl>
154void
155LSQ<Impl>::takeOverFrom()
156{
157 for (ThreadID tid = 0; tid < numThreads; tid++) {
158 thread[tid].takeOverFrom();

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

453 if (lsqPolicy == Dynamic)
454 return isFull();
455 else
456 return thread[tid].lqFull() || thread[tid].sqFull();
457}
458
459template<class Impl>
460bool
177}
178
179template <class Impl>
180void
181LSQ<Impl>::takeOverFrom()
182{
183 for (ThreadID tid = 0; tid < numThreads; tid++) {
184 thread[tid].takeOverFrom();

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

479 if (lsqPolicy == Dynamic)
480 return isFull();
481 else
482 return thread[tid].lqFull() || thread[tid].sqFull();
483}
484
485template<class Impl>
486bool
487LSQ<Impl>::isEmpty() const
488{
489 return lqEmpty() && sqEmpty();
490}
491
492template<class Impl>
493bool
494LSQ<Impl>::lqEmpty() const
495{
496 list<ThreadID>::const_iterator threads = activeThreads->begin();
497 list<ThreadID>::const_iterator end = activeThreads->end();
498
499 while (threads != end) {
500 ThreadID tid = *threads++;
501
502 if (!thread[tid].lqEmpty())
503 return false;
504 }
505
506 return true;
507}
508
509template<class Impl>
510bool
511LSQ<Impl>::sqEmpty() const
512{
513 list<ThreadID>::const_iterator threads = activeThreads->begin();
514 list<ThreadID>::const_iterator end = activeThreads->end();
515
516 while (threads != end) {
517 ThreadID tid = *threads++;
518
519 if (!thread[tid].sqEmpty())
520 return false;
521 }
522
523 return true;
524}
525
526template<class Impl>
527bool
461LSQ<Impl>::lqFull()
462{
463 list<ThreadID>::iterator threads = activeThreads->begin();
464 list<ThreadID>::iterator end = activeThreads->end();
465
466 while (threads != end) {
467 ThreadID tid = *threads++;
468

--- 122 unchanged lines hidden ---
528LSQ<Impl>::lqFull()
529{
530 list<ThreadID>::iterator threads = activeThreads->begin();
531 list<ThreadID>::iterator end = activeThreads->end();
532
533 while (threads != end) {
534 ThreadID tid = *threads++;
535

--- 122 unchanged lines hidden ---