inst_queue.hh (2670:9107b8bd08cd) inst_queue.hh (2674:6d4afef73a20)
1/*
2 * Copyright (c) 2004-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;

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

89 DynInstPtr inst;
90
91 /** Index of the FU used for executing. */
92 int fuIdx;
93
94 /** Pointer back to the instruction queue. */
95 InstructionQueue<Impl> *iqPtr;
96
1/*
2 * Copyright (c) 2004-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;

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

89 DynInstPtr inst;
90
91 /** Index of the FU used for executing. */
92 int fuIdx;
93
94 /** Pointer back to the instruction queue. */
95 InstructionQueue<Impl> *iqPtr;
96
97 /** Should the FU be added to the list to be freed upon
98 * completing this event.
99 */
97 bool freeFU;
98
99 public:
100 /** Construct a FU completion event. */
101 FUCompletion(DynInstPtr &_inst, int fu_idx,
102 InstructionQueue<Impl> *iq_ptr);
103
104 virtual void process();

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

113 ~InstructionQueue();
114
115 /** Returns the name of the IQ. */
116 std::string name() const;
117
118 /** Registers statistics. */
119 void regStats();
120
100 bool freeFU;
101
102 public:
103 /** Construct a FU completion event. */
104 FUCompletion(DynInstPtr &_inst, int fu_idx,
105 InstructionQueue<Impl> *iq_ptr);
106
107 virtual void process();

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

116 ~InstructionQueue();
117
118 /** Returns the name of the IQ. */
119 std::string name() const;
120
121 /** Registers statistics. */
122 void regStats();
123
124 /** Resets all instruction queue state. */
121 void resetState();
122
123 /** Sets CPU pointer. */
124 void setCPU(FullCPU *_cpu) { cpu = _cpu; }
125
126 /** Sets active threads list. */
127 void setActiveThreads(std::list<unsigned> *at_ptr);
128
129 /** Sets the IEW pointer. */
130 void setIEW(IEW *iew_ptr) { iewStage = iew_ptr; }
131
132 /** Sets the timer buffer between issue and execute. */
133 void setIssueToExecuteQueue(TimeBuffer<IssueStruct> *i2eQueue);
134
135 /** Sets the global time buffer. */
136 void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr);
137
125 void resetState();
126
127 /** Sets CPU pointer. */
128 void setCPU(FullCPU *_cpu) { cpu = _cpu; }
129
130 /** Sets active threads list. */
131 void setActiveThreads(std::list<unsigned> *at_ptr);
132
133 /** Sets the IEW pointer. */
134 void setIEW(IEW *iew_ptr) { iewStage = iew_ptr; }
135
136 /** Sets the timer buffer between issue and execute. */
137 void setIssueToExecuteQueue(TimeBuffer<IssueStruct> *i2eQueue);
138
139 /** Sets the global time buffer. */
140 void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr);
141
142 /** Switches out the instruction queue. */
138 void switchOut();
139
143 void switchOut();
144
145 /** Takes over execution from another CPU's thread. */
140 void takeOverFrom();
141
146 void takeOverFrom();
147
148 /** Returns if the IQ is switched out. */
142 bool isSwitchedOut() { return switchedOut; }
143
144 /** Number of entries needed for given amount of threads. */
145 int entryAmount(int num_threads);
146
147 /** Resets max entries for all threads. */
148 void resetEntries();
149

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

168 /** Inserts a new, non-speculative instruction into the IQ. */
169 void insertNonSpec(DynInstPtr &new_inst);
170
171 /** Inserts a memory or write barrier into the IQ to make sure
172 * loads and stores are ordered properly.
173 */
174 void insertBarrier(DynInstPtr &barr_inst);
175
149 bool isSwitchedOut() { return switchedOut; }
150
151 /** Number of entries needed for given amount of threads. */
152 int entryAmount(int num_threads);
153
154 /** Resets max entries for all threads. */
155 void resetEntries();
156

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

175 /** Inserts a new, non-speculative instruction into the IQ. */
176 void insertNonSpec(DynInstPtr &new_inst);
177
178 /** Inserts a memory or write barrier into the IQ to make sure
179 * loads and stores are ordered properly.
180 */
181 void insertBarrier(DynInstPtr &barr_inst);
182
183 /** Returns the oldest scheduled instruction, and removes it from
184 * the list of instructions waiting to execute.
185 */
176 DynInstPtr getInstToExecute();
177
178 /**
179 * Records the instruction as the producer of a register without
180 * adding it to the rest of the IQ.
181 */
182 void recordProducer(DynInstPtr &inst)
183 { addToProducers(inst); }

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

271
272 //////////////////////////////////////
273 // Instruction lists, ready queues, and ordering
274 //////////////////////////////////////
275
276 /** List of all the instructions in the IQ (some of which may be issued). */
277 std::list<DynInstPtr> instList[Impl::MaxThreads];
278
186 DynInstPtr getInstToExecute();
187
188 /**
189 * Records the instruction as the producer of a register without
190 * adding it to the rest of the IQ.
191 */
192 void recordProducer(DynInstPtr &inst)
193 { addToProducers(inst); }

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

281
282 //////////////////////////////////////
283 // Instruction lists, ready queues, and ordering
284 //////////////////////////////////////
285
286 /** List of all the instructions in the IQ (some of which may be issued). */
287 std::list<DynInstPtr> instList[Impl::MaxThreads];
288
289 /** List of instructions that are ready to be executed. */
279 std::list<DynInstPtr> instsToExecute;
280
281 /**
290 std::list<DynInstPtr> instsToExecute;
291
292 /**
282 * Struct for comparing entries to be added to the priority queue. This
283 * gives reverse ordering to the instructions in terms of sequence
284 * numbers: the instructions with smaller sequence numbers (and hence
285 * are older) will be at the top of the priority queue.
293 * Struct for comparing entries to be added to the priority queue.
294 * This gives reverse ordering to the instructions in terms of
295 * sequence numbers: the instructions with smaller sequence
296 * numbers (and hence are older) will be at the top of the
297 * priority queue.
286 */
287 struct pqCompare {
288 bool operator() (const DynInstPtr &lhs, const DynInstPtr &rhs) const
289 {
290 return lhs->seqNum > rhs->seqNum;
291 }
292 };
293

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

390 /** The number of floating point registers in the CPU. */
391 unsigned numPhysFloatRegs;
392
393 /** Delay between commit stage and the IQ.
394 * @todo: Make there be a distinction between the delays within IEW.
395 */
396 unsigned commitToIEWDelay;
397
298 */
299 struct pqCompare {
300 bool operator() (const DynInstPtr &lhs, const DynInstPtr &rhs) const
301 {
302 return lhs->seqNum > rhs->seqNum;
303 }
304 };
305

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

402 /** The number of floating point registers in the CPU. */
403 unsigned numPhysFloatRegs;
404
405 /** Delay between commit stage and the IQ.
406 * @todo: Make there be a distinction between the delays within IEW.
407 */
408 unsigned commitToIEWDelay;
409
410 /** Is the IQ switched out. */
398 bool switchedOut;
399
400 /** The sequence number of the squashed instruction. */
401 InstSeqNum squashedSeqNum[Impl::MaxThreads];
402
403 /** A cache of the recently woken registers. It is 1 if the register
404 * has been woken up recently, and 0 if the register has been added
405 * to the dependency graph and has not yet received its value. It

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

457 /** Stat for number of squashed instruction operands examined when
458 * squashing.
459 */
460 Stats::Scalar<> iqSquashedOperandsExamined;
461 /** Stat for number of non-speculative instructions removed due to a squash.
462 */
463 Stats::Scalar<> iqSquashedNonSpecRemoved;
464
411 bool switchedOut;
412
413 /** The sequence number of the squashed instruction. */
414 InstSeqNum squashedSeqNum[Impl::MaxThreads];
415
416 /** A cache of the recently woken registers. It is 1 if the register
417 * has been woken up recently, and 0 if the register has been added
418 * to the dependency graph and has not yet received its value. It

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

470 /** Stat for number of squashed instruction operands examined when
471 * squashing.
472 */
473 Stats::Scalar<> iqSquashedOperandsExamined;
474 /** Stat for number of non-speculative instructions removed due to a squash.
475 */
476 Stats::Scalar<> iqSquashedNonSpecRemoved;
477
478 /** Distribution of number of instructions in the queue. */
465 Stats::VectorDistribution<> queueResDist;
479 Stats::VectorDistribution<> queueResDist;
480 /** Distribution of the number of instructions issued. */
466 Stats::Distribution<> numIssuedDist;
481 Stats::Distribution<> numIssuedDist;
482 /** Distribution of the cycles it takes to issue an instruction. */
467 Stats::VectorDistribution<> issueDelayDist;
468
483 Stats::VectorDistribution<> issueDelayDist;
484
485 /** Number of times an instruction could not be issued because a
486 * FU was busy.
487 */
469 Stats::Vector<> statFuBusy;
470// Stats::Vector<> dist_unissued;
488 Stats::Vector<> statFuBusy;
489// Stats::Vector<> dist_unissued;
490 /** Stat for total number issued for each instruction type. */
471 Stats::Vector2d<> statIssuedInstType;
472
491 Stats::Vector2d<> statIssuedInstType;
492
493 /** Number of instructions issued per cycle. */
473 Stats::Formula issueRate;
474// Stats::Formula issue_stores;
475// Stats::Formula issue_op_rate;
494 Stats::Formula issueRate;
495// Stats::Formula issue_stores;
496// Stats::Formula issue_op_rate;
476 Stats::Vector<> fuBusy; //cumulative fu busy
477
497 /** Number of times the FU was busy. */
498 Stats::Vector<> fuBusy;
499 /** Number of times the FU was busy per instruction issued. */
478 Stats::Formula fuBusyRate;
479};
480
481#endif //__CPU_O3_INST_QUEUE_HH__
500 Stats::Formula fuBusyRate;
501};
502
503#endif //__CPU_O3_INST_QUEUE_HH__