lsq_impl.hh (13449:2f7efa89c58b) lsq_impl.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

--- 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 LQEntries(params->LQEntries),
65 SQEntries(params->SQEntries),
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)),
66 numThreads(params->numThreads)
67{
68 assert(numThreads > 0 && numThreads <= Impl::MaxThreads);
69
70 //**********************************************/
71 //************ Handle SMT Parameters ***********/
72 //**********************************************/
71 numThreads(params->numThreads)
72{
73 assert(numThreads > 0 && numThreads <= Impl::MaxThreads);
74
75 //**********************************************/
76 //************ Handle SMT Parameters ***********/
77 //**********************************************/
73 std::string policy = params->smtLSQPolicy;
74
78
75 //Convert string to lowercase
76 std::transform(policy.begin(), policy.end(), policy.begin(),
77 (int(*)(int)) tolower);
78
79 //Figure out fetch policy
79 //Figure out fetch policy
80 if (policy == "dynamic") {
81 lsqPolicy = Dynamic;
82
83 maxLQEntries = LQEntries;
84 maxSQEntries = SQEntries;
85
80 if (lsqPolicy == Dynamic) {
86 DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
81 DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
87 } else if (policy == "partitioned") {
88 lsqPolicy = Partitioned;
89
90 //@todo:make work if part_amt doesnt divide evenly.
91 maxLQEntries = LQEntries / numThreads;
92 maxSQEntries = SQEntries / numThreads;
93
82 } else if (lsqPolicy == Partitioned) {
94 DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
95 "%i entries per LQ | %i entries per SQ\n",
96 maxLQEntries,maxSQEntries);
83 DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
84 "%i entries per LQ | %i entries per SQ\n",
85 maxLQEntries,maxSQEntries);
97 } else if (policy == "threshold") {
98 lsqPolicy = Threshold;
86 } else if (lsqPolicy == Threshold) {
99
100 assert(params->smtLSQThreshold > LQEntries);
101 assert(params->smtLSQThreshold > SQEntries);
102
87
88 assert(params->smtLSQThreshold > LQEntries);
89 assert(params->smtLSQThreshold > SQEntries);
90
103 //Divide up by threshold amount
104 //@todo: Should threads check the max and the total
105 //amount of the LSQ
106 maxLQEntries = params->smtLSQThreshold;
107 maxSQEntries = params->smtLSQThreshold;
108
109 DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
110 "%i entries per LQ | %i entries per SQ\n",
111 maxLQEntries,maxSQEntries);
112 } else {
113 panic("Invalid LSQ sharing policy. Options are: Dynamic, "
114 "Partitioned, Threshold");
115 }
116
91 DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
92 "%i entries per LQ | %i entries per SQ\n",
93 maxLQEntries,maxSQEntries);
94 } else {
95 panic("Invalid LSQ sharing policy. Options are: Dynamic, "
96 "Partitioned, Threshold");
97 }
98
117 //Initialize LSQs
118 thread = new LSQUnit[numThreads];
99 thread.reserve(numThreads);
119 for (ThreadID tid = 0; tid < numThreads; tid++) {
100 for (ThreadID tid = 0; tid < numThreads; tid++) {
120 thread[tid].init(cpu, iew_ptr, params, this,
121 maxLQEntries, maxSQEntries, tid);
101 thread.emplace_back(maxLQEntries, maxSQEntries);
102 thread[tid].init(cpu, iew_ptr, params, this, tid);
122 thread[tid].setDcachePort(&cpu_ptr->getDataPort());
123 }
124}
125
126
127template<class Impl>
128std::string
129LSQ<Impl>::name() const

--- 573 unchanged lines hidden ---
103 thread[tid].setDcachePort(&cpu_ptr->getDataPort());
104 }
105}
106
107
108template<class Impl>
109std::string
110LSQ<Impl>::name() const

--- 573 unchanged lines hidden ---