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

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

44#ifndef __CPU_O3_LSQ_HH__
45#define __CPU_O3_LSQ_HH__
46
47#include <map>
48#include <queue>
49
50#include "cpu/o3/lsq_unit.hh"
51#include "cpu/inst_seq.hh"
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

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

44#ifndef __CPU_O3_LSQ_HH__
45#define __CPU_O3_LSQ_HH__
46
47#include <map>
48#include <queue>
49
50#include "cpu/o3/lsq_unit.hh"
51#include "cpu/inst_seq.hh"
52#include "enums/SMTQueuePolicy.hh"
52#include "mem/port.hh"
53#include "sim/sim_object.hh"
54
55struct DerivO3CPUParams;
56
57template <class Impl>
58class LSQ {
59 public:
60 typedef typename Impl::O3CPU O3CPU;
61 typedef typename Impl::DynInstPtr DynInstPtr;
62 typedef typename Impl::CPUPol::IEW IEW;
63 typedef typename Impl::CPUPol::LSQUnit LSQUnit;
64
53#include "mem/port.hh"
54#include "sim/sim_object.hh"
55
56struct DerivO3CPUParams;
57
58template <class Impl>
59class LSQ {
60 public:
61 typedef typename Impl::O3CPU O3CPU;
62 typedef typename Impl::DynInstPtr DynInstPtr;
63 typedef typename Impl::CPUPol::IEW IEW;
64 typedef typename Impl::CPUPol::LSQUnit LSQUnit;
65
65 /** SMT policy. */
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
76 /** Returns the name of the LSQ. */
77 std::string name() const;
78
79 /** Registers statistics of each LSQ unit. */

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

301 /** The CPU pointer. */
302 O3CPU *cpu;
303
304 /** The IEW stage pointer. */
305 IEW *iewStage;
306
307 protected:
308 /** The LSQ policy for SMT mode. */
66 /** Constructs an LSQ with the given parameters. */
67 LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params);
68 ~LSQ() { }
69
70 /** Returns the name of the LSQ. */
71 std::string name() const;
72
73 /** Registers statistics of each LSQ unit. */

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

295 /** The CPU pointer. */
296 O3CPU *cpu;
297
298 /** The IEW stage pointer. */
299 IEW *iewStage;
300
301 protected:
302 /** The LSQ policy for SMT mode. */
309 LSQPolicy lsqPolicy;
303 SMTQueuePolicy lsqPolicy;
310
304
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}");
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 */
305 /** Auxiliary function to calculate per-thread max LSQ allocation limit.
306 * Depending on a policy, number of entries and possibly number of threads
307 * and threshold, this function calculates how many resources each thread
308 * can occupy at most.
309 */
335 static uint32_t maxLSQAllocation(const LSQPolicy& pol, uint32_t entries,
310 static uint32_t maxLSQAllocation(SMTQueuePolicy pol, uint32_t entries,
336 uint32_t numThreads, uint32_t SMTThreshold) {
311 uint32_t numThreads, uint32_t SMTThreshold) {
337 if (pol == Dynamic) {
312 if (pol == SMTQueuePolicy::Dynamic) {
338 return entries;
313 return entries;
339 } else if (pol == Partitioned) {
314 } else if (pol == SMTQueuePolicy::Partitioned) {
340 //@todo:make work if part_amt doesnt divide evenly.
341 return entries / numThreads;
315 //@todo:make work if part_amt doesnt divide evenly.
316 return entries / numThreads;
342 } else if (pol == Threshold) {
317 } else if (pol == SMTQueuePolicy::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

--- 44 unchanged lines hidden ---
318 //Divide up by threshold amount
319 //@todo: Should threads check the max and the total
320 //amount of the LSQ
321 return SMTThreshold;
322 }
323 return 0;
324 }
325

--- 44 unchanged lines hidden ---