2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //Todo: Update with statuses.
30 //Need to handle delaying writes to the writeback bus if it's full at the
33 #ifndef __CPU_O3_CPU_SIMPLE_IEW_HH__
34 #define __CPU_O3_CPU_SIMPLE_IEW_HH__
38 #include "config/full_system.hh"
39 #include "base/statistics.hh"
40 #include "base/timebuf.hh"
41 #include "cpu/o3/comm.hh"
48 typedef typename Impl::CPUPol CPUPol;
49 typedef typename Impl::DynInstPtr DynInstPtr;
50 typedef typename Impl::FullCPU FullCPU;
51 typedef typename Impl::Params Params;
53 typedef typename CPUPol::IQ IQ;
54 typedef typename CPUPol::RenameMap RenameMap;
55 typedef typename CPUPol::LDSTQ LDSTQ;
57 typedef typename CPUPol::TimeStruct TimeStruct;
58 typedef typename CPUPol::IEWStruct IEWStruct;
59 typedef typename CPUPol::RenameStruct RenameStruct;
60 typedef typename CPUPol::IssueStruct IssueStruct;
62 friend class Impl::FullCPU;
79 class WritebackEvent : public Event {
82 SimpleIEW<Impl> *iewStage;
85 WritebackEvent(DynInstPtr &_inst, SimpleIEW<Impl> *_iew);
87 virtual void process();
88 virtual const char *description();
92 SimpleIEW(Params ¶ms);
96 void setCPU(FullCPU *cpu_ptr);
98 void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr);
100 void setRenameQueue(TimeBuffer<RenameStruct> *rq_ptr);
102 void setIEWQueue(TimeBuffer<IEWStruct> *iq_ptr);
104 void setRenameMap(RenameMap *rm_ptr);
108 void squashDueToBranch(DynInstPtr &inst);
110 void squashDueToMem(DynInstPtr &inst);
114 inline void unblock();
116 void wakeDependents(DynInstPtr &inst);
118 void instToCommit(DynInstPtr &inst);
121 void dispatchInsts();
130 //Interfaces to objects inside and outside of IEW.
131 /** Time buffer interface. */
132 TimeBuffer<TimeStruct> *timeBuffer;
134 /** Wire to get commit's output from backwards time buffer. */
135 typename TimeBuffer<TimeStruct>::wire fromCommit;
137 /** Wire to write information heading to previous stages. */
138 typename TimeBuffer<TimeStruct>::wire toRename;
140 /** Rename instruction queue interface. */
141 TimeBuffer<RenameStruct> *renameQueue;
143 /** Wire to get rename's output from rename queue. */
144 typename TimeBuffer<RenameStruct>::wire fromRename;
146 /** Issue stage queue. */
147 TimeBuffer<IssueStruct> issueToExecQueue;
149 /** Wire to read information from the issue stage time queue. */
150 typename TimeBuffer<IssueStruct>::wire fromIssue;
153 * IEW stage time buffer. Holds ROB indices of instructions that
154 * can be marked as completed.
156 TimeBuffer<IEWStruct> *iewQueue;
158 /** Wire to write infromation heading to commit. */
159 typename TimeBuffer<IEWStruct>::wire toCommit;
161 //Will need internal queue to hold onto instructions coming from
162 //the rename stage in case of a stall.
163 /** Skid buffer between rename and IEW. */
164 std::queue<RenameStruct> skidBuffer;
167 /** Instruction queue. */
178 /** Pointer to rename map. Might not want this stage to directly
179 * access this though...
181 RenameMap *renameMap;
183 /** CPU interface. */
187 /** Commit to IEW delay, in ticks. */
188 unsigned commitToIEWDelay;
190 /** Rename to IEW delay, in ticks. */
191 unsigned renameToIEWDelay;
194 * Issue to execute delay, in ticks. What this actually represents is
195 * the amount of time it takes for an instruction to wake up, be
196 * scheduled, and sent to a FU for execution.
198 unsigned issueToExecuteDelay;
200 /** Width of issue's read path, in instructions. The read path is both
201 * the skid buffer and the rename instruction queue.
202 * Note to self: is this really different than issueWidth?
204 unsigned issueReadWidth;
206 /** Width of issue, in instructions. */
209 /** Width of execute, in instructions. Might make more sense to break
210 * down into FP vs int.
212 unsigned executeWidth;
214 /** Number of cycles stage has been squashing. Used so that the stage
215 * knows when it can start unblocking, which is when the previous stage
216 * has received the stall signal and clears up its outputs.
218 unsigned cyclesSquashing;
220 Stats::Scalar<> iewIdleCycles;
221 Stats::Scalar<> iewSquashCycles;
222 Stats::Scalar<> iewBlockCycles;
223 Stats::Scalar<> iewUnblockCycles;
224 // Stats::Scalar<> iewWBInsts;
225 Stats::Scalar<> iewDispatchedInsts;
226 Stats::Scalar<> iewDispSquashedInsts;
227 Stats::Scalar<> iewDispLoadInsts;
228 Stats::Scalar<> iewDispStoreInsts;
229 Stats::Scalar<> iewDispNonSpecInsts;
230 Stats::Scalar<> iewIQFullEvents;
231 Stats::Scalar<> iewExecutedInsts;
232 Stats::Scalar<> iewExecLoadInsts;
233 Stats::Scalar<> iewExecStoreInsts;
234 Stats::Scalar<> iewExecSquashedInsts;
235 Stats::Scalar<> memOrderViolationEvents;
236 Stats::Scalar<> predictedTakenIncorrect;
239 #endif // __CPU_O3_CPU_IEW_HH__