lsq.hh (13429:a1e199fd8122) lsq.hh (13472:7ceacede4f1e)
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

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

66 enum LSQPolicy {
67 Dynamic,
68 Partitioned,
69 Threshold
70 };
71
72 /** Constructs an LSQ with the given parameters. */
73 LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params);
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

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

66 enum LSQPolicy {
67 Dynamic,
68 Partitioned,
69 Threshold
70 };
71
72 /** Constructs an LSQ with the given parameters. */
73 LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params);
74 ~LSQ() {
75 if (thread) delete [] thread;
76 }
74 ~LSQ() { }
77
78 /** Returns the name of the LSQ. */
79 std::string name() const;
80
81 /** Registers statistics of each LSQ unit. */
82 void regStats();
83
84 /** Sets the pointer to the list of active threads. */

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

305
306 /** The IEW stage pointer. */
307 IEW *iewStage;
308
309 protected:
310 /** The LSQ policy for SMT mode. */
311 LSQPolicy lsqPolicy;
312
75
76 /** Returns the name of the LSQ. */
77 std::string name() const;
78
79 /** Registers statistics of each LSQ unit. */
80 void regStats();
81
82 /** Sets the pointer to the list of active threads. */

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

303
304 /** The IEW stage pointer. */
305 IEW *iewStage;
306
307 protected:
308 /** The LSQ policy for SMT mode. */
309 LSQPolicy lsqPolicy;
310
313 /** The LSQ units for individual threads. */
314 LSQUnit *thread;
311 /** Transform a SMT sharing policy string into a LSQPolicy value. */
312 static LSQPolicy readLSQPolicy(const std::string& policy) {
313 std::string policy_ = policy;
314 std::transform(policy_.begin(), policy_.end(), policy_.begin(),
315 (int(*)(int)) tolower);
316 if (policy_ == "dynamic") {
317 return Dynamic;
318 } else if (policy_ == "partitioned") {
319 return Partitioned;
320 } else if (policy_ == "threshold") {
321 return Threshold;
322 }
323 assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic,"
324 "Partitioned, Threshold}");
315
325
326 // Some compilers complain if there is no return.
327 return Dynamic;
328 }
329
330 /** Auxiliary function to calculate per-thread max LSQ allocation limit.
331 * Depending on a policy, number of entries and possibly number of threads
332 * and threshold, this function calculates how many resources each thread
333 * can occupy at most.
334 */
335 static uint32_t maxLSQAllocation(const LSQPolicy& pol, uint32_t entries,
336 uint32_t numThreads, uint32_t SMTThreshold) {
337 if (pol == Dynamic) {
338 return entries;
339 } else if (pol == Partitioned) {
340 //@todo:make work if part_amt doesnt divide evenly.
341 return entries / numThreads;
342 } else if (pol == Threshold) {
343 //Divide up by threshold amount
344 //@todo: Should threads check the max and the total
345 //amount of the LSQ
346 return SMTThreshold;
347 }
348 return 0;
349 }
350
316 /** List of Active Threads in System. */
317 std::list<ThreadID> *activeThreads;
318
319 /** Total Size of LQ Entries. */
320 unsigned LQEntries;
321 /** Total Size of SQ Entries. */
322 unsigned SQEntries;
323
324 /** Max LQ Size - Used to Enforce Sharing Policies. */
325 unsigned maxLQEntries;
326
327 /** Max SQ Size - Used to Enforce Sharing Policies. */
328 unsigned maxSQEntries;
329
351 /** List of Active Threads in System. */
352 std::list<ThreadID> *activeThreads;
353
354 /** Total Size of LQ Entries. */
355 unsigned LQEntries;
356 /** Total Size of SQ Entries. */
357 unsigned SQEntries;
358
359 /** Max LQ Size - Used to Enforce Sharing Policies. */
360 unsigned maxLQEntries;
361
362 /** Max SQ Size - Used to Enforce Sharing Policies. */
363 unsigned maxSQEntries;
364
365 /** The LSQ units for individual threads. */
366 std::vector<LSQUnit> thread;
367
330 /** Number of Threads. */
331 ThreadID numThreads;
332};
333
334template <class Impl>
335Fault
336LSQ<Impl>::read(const RequestPtr &req,
337 RequestPtr &sreqLow, RequestPtr &sreqHigh,

--- 19 unchanged lines hidden ---
368 /** Number of Threads. */
369 ThreadID numThreads;
370};
371
372template <class Impl>
373Fault
374LSQ<Impl>::read(const RequestPtr &req,
375 RequestPtr &sreqLow, RequestPtr &sreqHigh,

--- 19 unchanged lines hidden ---