lsq_impl.hh (4318:eb4241362a80) lsq_impl.hh (4329:52057dbec096)
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;

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

102 }
103 lsq->thread[lsq->retryTid].recvRetry();
104 // Speculatively clear the retry Tid. This will get set again if
105 // the LSQUnit was unable to complete its access.
106 lsq->retryTid = -1;
107}
108
109template <class Impl>
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;

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

102 }
103 lsq->thread[lsq->retryTid].recvRetry();
104 // Speculatively clear the retry Tid. This will get set again if
105 // the LSQUnit was unable to complete its access.
106 lsq->retryTid = -1;
107}
108
109template <class Impl>
110LSQ::LSQ(Params *params)
111 : dcachePort(this), LQEntries(params->LQEntries),
112 SQEntries(params->SQEntries), numThreads(params->numberOfThreads),
110LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, Params *params)
111 : cpu(cpu_ptr), iewStage(iew_ptr), dcachePort(this),
112 LQEntries(params->LQEntries),
113 SQEntries(params->SQEntries),
114 numThreads(params->numberOfThreads),
113 retryTid(-1)
114{
115 dcachePort.snoopRangeSent = false;
116
117 //**********************************************/
118 //************ Handle SMT Parameters ***********/
119 //**********************************************/
120 std::string policy = params->smtLSQPolicy;
121
122 //Convert string to lowercase
123 std::transform(policy.begin(), policy.end(), policy.begin(),
124 (int(*)(int)) tolower);
125
126 //Figure out fetch policy
127 if (policy == "dynamic") {
128 lsqPolicy = Dynamic;
129
130 maxLQEntries = LQEntries;
131 maxSQEntries = SQEntries;
115 retryTid(-1)
116{
117 dcachePort.snoopRangeSent = false;
118
119 //**********************************************/
120 //************ Handle SMT Parameters ***********/
121 //**********************************************/
122 std::string policy = params->smtLSQPolicy;
123
124 //Convert string to lowercase
125 std::transform(policy.begin(), policy.end(), policy.begin(),
126 (int(*)(int)) tolower);
127
128 //Figure out fetch policy
129 if (policy == "dynamic") {
130 lsqPolicy = Dynamic;
131
132 maxLQEntries = LQEntries;
133 maxSQEntries = SQEntries;
132/*
134
133 DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
135 DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
134*/
135 } else if (policy == "partitioned") {
136 lsqPolicy = Partitioned;
137
138 //@todo:make work if part_amt doesnt divide evenly.
139 maxLQEntries = LQEntries / numThreads;
140 maxSQEntries = SQEntries / numThreads;
136 } else if (policy == "partitioned") {
137 lsqPolicy = Partitioned;
138
139 //@todo:make work if part_amt doesnt divide evenly.
140 maxLQEntries = LQEntries / numThreads;
141 maxSQEntries = SQEntries / numThreads;
141/*
142
142 DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
143 "%i entries per LQ | %i entries per SQ",
144 maxLQEntries,maxSQEntries);
143 DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
144 "%i entries per LQ | %i entries per SQ",
145 maxLQEntries,maxSQEntries);
145*/
146 } else if (policy == "threshold") {
147 lsqPolicy = Threshold;
148
149 assert(params->smtLSQThreshold > LQEntries);
150 assert(params->smtLSQThreshold > SQEntries);
151
152 //Divide up by threshold amount
153 //@todo: Should threads check the max and the total
154 //amount of the LSQ
155 maxLQEntries = params->smtLSQThreshold;
156 maxSQEntries = params->smtLSQThreshold;
146 } else if (policy == "threshold") {
147 lsqPolicy = Threshold;
148
149 assert(params->smtLSQThreshold > LQEntries);
150 assert(params->smtLSQThreshold > SQEntries);
151
152 //Divide up by threshold amount
153 //@todo: Should threads check the max and the total
154 //amount of the LSQ
155 maxLQEntries = params->smtLSQThreshold;
156 maxSQEntries = params->smtLSQThreshold;
157/*
157
158 DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
159 "%i entries per LQ | %i entries per SQ",
160 maxLQEntries,maxSQEntries);
158 DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
159 "%i entries per LQ | %i entries per SQ",
160 maxLQEntries,maxSQEntries);
161*/
162
163 } else {
164 assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic,"
165 "Partitioned, Threshold}");
166 }
167
168 //Initialize LSQs
169 for (int tid=0; tid < numThreads; tid++) {
161 } else {
162 assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic,"
163 "Partitioned, Threshold}");
164 }
165
166 //Initialize LSQs
167 for (int tid=0; tid < numThreads; tid++) {
170 thread[tid].init(params, this, maxLQEntries, maxSQEntries, tid);
168 thread[tid].init(cpu, iew_ptr, params, this,
169 maxLQEntries, maxSQEntries, tid);
171 thread[tid].setDcachePort(&dcachePort);
172 }
173}
174
175
176template<class Impl>
177std::string
178LSQ<Impl>::name() const

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

193template<class Impl>
194void
195LSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr)
196{
197 activeThreads = at_ptr;
198 assert(activeThreads != 0);
199}
200
170 thread[tid].setDcachePort(&dcachePort);
171 }
172}
173
174
175template<class Impl>
176std::string
177LSQ<Impl>::name() const

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

192template<class Impl>
193void
194LSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr)
195{
196 activeThreads = at_ptr;
197 assert(activeThreads != 0);
198}
199
201template<class Impl>
202void
203LSQ<Impl>::setCPU(O3CPU *cpu_ptr)
204{
205 cpu = cpu_ptr;
206
207 dcachePort.setName(name());
208
209 for (int tid=0; tid < numThreads; tid++) {
210 thread[tid].setCPU(cpu_ptr);
211 }
212}
213
214template<class Impl>
215void
216LSQ<Impl>::setIEW(IEW *iew_ptr)
217{
218 iewStage = iew_ptr;
219
220 for (int tid=0; tid < numThreads; tid++) {
221 thread[tid].setIEW(iew_ptr);
222 }
223}
224
225template <class Impl>
226void
227LSQ<Impl>::switchOut()
228{
229 for (int tid = 0; tid < numThreads; tid++) {
230 thread[tid].switchOut();
231 }
232}

--- 416 unchanged lines hidden ---
200template <class Impl>
201void
202LSQ<Impl>::switchOut()
203{
204 for (int tid = 0; tid < numThreads; tid++) {
205 thread[tid].switchOut();
206 }
207}

--- 416 unchanged lines hidden ---