lsq_impl.hh (13472:7ceacede4f1e) lsq_impl.hh (13560:f8732494c155)
1/*
2 * Copyright (c) 2011-2012, 2014 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

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

56#include "debug/Writeback.hh"
57#include "params/DerivO3CPU.hh"
58
59using namespace std;
60
61template <class Impl>
62LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params)
63 : cpu(cpu_ptr), iewStage(iew_ptr),
1/*
2 * Copyright (c) 2011-2012, 2014 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

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

56#include "debug/Writeback.hh"
57#include "params/DerivO3CPU.hh"
58
59using namespace std;
60
61template <class Impl>
62LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params)
63 : cpu(cpu_ptr), iewStage(iew_ptr),
64 lsqPolicy(readLSQPolicy(params->smtLSQPolicy)),
64 lsqPolicy(params->smtLSQPolicy),
65 LQEntries(params->LQEntries),
66 SQEntries(params->SQEntries),
67 maxLQEntries(maxLSQAllocation(lsqPolicy, LQEntries, params->numThreads,
68 params->smtLSQThreshold)),
69 maxSQEntries(maxLSQAllocation(lsqPolicy, SQEntries, params->numThreads,
70 params->smtLSQThreshold)),
71 numThreads(params->numThreads)
72{
73 assert(numThreads > 0 && numThreads <= Impl::MaxThreads);
74
75 //**********************************************/
76 //************ Handle SMT Parameters ***********/
77 //**********************************************/
78
79 //Figure out fetch policy
65 LQEntries(params->LQEntries),
66 SQEntries(params->SQEntries),
67 maxLQEntries(maxLSQAllocation(lsqPolicy, LQEntries, params->numThreads,
68 params->smtLSQThreshold)),
69 maxSQEntries(maxLSQAllocation(lsqPolicy, SQEntries, params->numThreads,
70 params->smtLSQThreshold)),
71 numThreads(params->numThreads)
72{
73 assert(numThreads > 0 && numThreads <= Impl::MaxThreads);
74
75 //**********************************************/
76 //************ Handle SMT Parameters ***********/
77 //**********************************************/
78
79 //Figure out fetch policy
80 if (lsqPolicy == Dynamic) {
80 if (lsqPolicy == SMTQueuePolicy::Dynamic) {
81 DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
81 DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
82 } else if (lsqPolicy == Partitioned) {
82 } else if (lsqPolicy == SMTQueuePolicy::Partitioned) {
83 DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
84 "%i entries per LQ | %i entries per SQ\n",
85 maxLQEntries,maxSQEntries);
83 DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
84 "%i entries per LQ | %i entries per SQ\n",
85 maxLQEntries,maxSQEntries);
86 } else if (lsqPolicy == Threshold) {
86 } else if (lsqPolicy == SMTQueuePolicy::Threshold) {
87
88 assert(params->smtLSQThreshold > LQEntries);
89 assert(params->smtLSQThreshold > SQEntries);
90
91 DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
92 "%i entries per LQ | %i entries per SQ\n",
93 maxLQEntries,maxSQEntries);
94 } else {

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

167 thread[tid].takeOverFrom();
168 }
169}
170
171template <class Impl>
172int
173LSQ<Impl>::entryAmount(ThreadID num_threads)
174{
87
88 assert(params->smtLSQThreshold > LQEntries);
89 assert(params->smtLSQThreshold > SQEntries);
90
91 DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
92 "%i entries per LQ | %i entries per SQ\n",
93 maxLQEntries,maxSQEntries);
94 } else {

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

167 thread[tid].takeOverFrom();
168 }
169}
170
171template <class Impl>
172int
173LSQ<Impl>::entryAmount(ThreadID num_threads)
174{
175 if (lsqPolicy == Partitioned) {
175 if (lsqPolicy == SMTQueuePolicy::Partitioned) {
176 return LQEntries / num_threads;
177 } else {
178 return 0;
179 }
180}
181
182template <class Impl>
183void
184LSQ<Impl>::resetEntries()
185{
176 return LQEntries / num_threads;
177 } else {
178 return 0;
179 }
180}
181
182template <class Impl>
183void
184LSQ<Impl>::resetEntries()
185{
186 if (lsqPolicy != Dynamic || numThreads > 1) {
186 if (lsqPolicy != SMTQueuePolicy::Dynamic || numThreads > 1) {
187 int active_threads = activeThreads->size();
188
189 int maxEntries;
190
187 int active_threads = activeThreads->size();
188
189 int maxEntries;
190
191 if (lsqPolicy == Partitioned) {
191 if (lsqPolicy == SMTQueuePolicy::Partitioned) {
192 maxEntries = LQEntries / active_threads;
192 maxEntries = LQEntries / active_threads;
193 } else if (lsqPolicy == Threshold && active_threads == 1) {
193 } else if (lsqPolicy == SMTQueuePolicy::Threshold &&
194 active_threads == 1) {
194 maxEntries = LQEntries;
195 } else {
196 maxEntries = LQEntries;
197 }
198
199 list<ThreadID>::iterator threads = activeThreads->begin();
200 list<ThreadID>::iterator end = activeThreads->end();
201

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

495}
496
497template<class Impl>
498bool
499LSQ<Impl>::isFull(ThreadID tid)
500{
501 //@todo: Change to Calculate All Entries for
502 //Dynamic Policy
195 maxEntries = LQEntries;
196 } else {
197 maxEntries = LQEntries;
198 }
199
200 list<ThreadID>::iterator threads = activeThreads->begin();
201 list<ThreadID>::iterator end = activeThreads->end();
202

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

496}
497
498template<class Impl>
499bool
500LSQ<Impl>::isFull(ThreadID tid)
501{
502 //@todo: Change to Calculate All Entries for
503 //Dynamic Policy
503 if (lsqPolicy == Dynamic)
504 if (lsqPolicy == SMTQueuePolicy::Dynamic)
504 return isFull();
505 else
506 return thread[tid].lqFull() || thread[tid].sqFull();
507}
508
509template<class Impl>
510bool
511LSQ<Impl>::isEmpty() const

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

565}
566
567template<class Impl>
568bool
569LSQ<Impl>::lqFull(ThreadID tid)
570{
571 //@todo: Change to Calculate All Entries for
572 //Dynamic Policy
505 return isFull();
506 else
507 return thread[tid].lqFull() || thread[tid].sqFull();
508}
509
510template<class Impl>
511bool
512LSQ<Impl>::isEmpty() const

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

566}
567
568template<class Impl>
569bool
570LSQ<Impl>::lqFull(ThreadID tid)
571{
572 //@todo: Change to Calculate All Entries for
573 //Dynamic Policy
573 if (lsqPolicy == Dynamic)
574 if (lsqPolicy == SMTQueuePolicy::Dynamic)
574 return lqFull();
575 else
576 return thread[tid].lqFull();
577}
578
579template<class Impl>
580bool
581LSQ<Impl>::sqFull()

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

594}
595
596template<class Impl>
597bool
598LSQ<Impl>::sqFull(ThreadID tid)
599{
600 //@todo: Change to Calculate All Entries for
601 //Dynamic Policy
575 return lqFull();
576 else
577 return thread[tid].lqFull();
578}
579
580template<class Impl>
581bool
582LSQ<Impl>::sqFull()

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

595}
596
597template<class Impl>
598bool
599LSQ<Impl>::sqFull(ThreadID tid)
600{
601 //@todo: Change to Calculate All Entries for
602 //Dynamic Policy
602 if (lsqPolicy == Dynamic)
603 if (lsqPolicy == SMTQueuePolicy::Dynamic)
603 return sqFull();
604 else
605 return thread[tid].sqFull();
606}
607
608template<class Impl>
609bool
610LSQ<Impl>::isStalled()

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

621
622 return true;
623}
624
625template<class Impl>
626bool
627LSQ<Impl>::isStalled(ThreadID tid)
628{
604 return sqFull();
605 else
606 return thread[tid].sqFull();
607}
608
609template<class Impl>
610bool
611LSQ<Impl>::isStalled()

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

622
623 return true;
624}
625
626template<class Impl>
627bool
628LSQ<Impl>::isStalled(ThreadID tid)
629{
629 if (lsqPolicy == Dynamic)
630 if (lsqPolicy == SMTQueuePolicy::Dynamic)
630 return isStalled();
631 else
632 return thread[tid].isStalled();
633}
634
635template<class Impl>
636bool
637LSQ<Impl>::hasStoresToWB()

--- 46 unchanged lines hidden ---
631 return isStalled();
632 else
633 return thread[tid].isStalled();
634}
635
636template<class Impl>
637bool
638LSQ<Impl>::hasStoresToWB()

--- 46 unchanged lines hidden ---