inst_queue.hh revision 2333
16313Sgblack@eecs.umich.edu/* 27093Sgblack@eecs.umich.edu * Copyright (c) 2004-2006 The Regents of The University of Michigan 37093Sgblack@eecs.umich.edu * All rights reserved. 47093Sgblack@eecs.umich.edu * 57093Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 67093Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 77093Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 87093Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 97093Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 107093Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 117093Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 127093Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 137093Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 146313Sgblack@eecs.umich.edu * this software without specific prior written permission. 156313Sgblack@eecs.umich.edu * 166313Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176313Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186313Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196313Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206313Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216313Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226313Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236313Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246313Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256313Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266313Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276313Sgblack@eecs.umich.edu */ 286313Sgblack@eecs.umich.edu 296313Sgblack@eecs.umich.edu#ifndef __CPU_O3_INST_QUEUE_HH__ 306313Sgblack@eecs.umich.edu#define __CPU_O3_INST_QUEUE_HH__ 316313Sgblack@eecs.umich.edu 326313Sgblack@eecs.umich.edu#include <list> 336313Sgblack@eecs.umich.edu#include <map> 346313Sgblack@eecs.umich.edu#include <queue> 356313Sgblack@eecs.umich.edu#include <vector> 366313Sgblack@eecs.umich.edu 376313Sgblack@eecs.umich.edu#include "base/statistics.hh" 386313Sgblack@eecs.umich.edu#include "base/timebuf.hh" 396313Sgblack@eecs.umich.edu#include "cpu/inst_seq.hh" 406313Sgblack@eecs.umich.edu#include "cpu/o3/dep_graph.hh" 416313Sgblack@eecs.umich.edu#include "encumbered/cpu/full/op_class.hh" 426313Sgblack@eecs.umich.edu#include "sim/host.hh" 436313Sgblack@eecs.umich.edu 446313Sgblack@eecs.umich.educlass FUPool; 456313Sgblack@eecs.umich.educlass MemInterface; 466333Sgblack@eecs.umich.edu 476313Sgblack@eecs.umich.edu/** 486313Sgblack@eecs.umich.edu * A standard instruction queue class. It holds ready instructions, in 496333Sgblack@eecs.umich.edu * order, in seperate priority queues to facilitate the scheduling of 506313Sgblack@eecs.umich.edu * instructions. The IQ uses a separate linked list to track dependencies. 516313Sgblack@eecs.umich.edu * Similar to the rename map and the free list, it expects that 526313Sgblack@eecs.umich.edu * floating point registers have their indices start after the integer 536313Sgblack@eecs.umich.edu * registers (ie with 96 int and 96 fp registers, regs 0-95 are integer 546313Sgblack@eecs.umich.edu * and 96-191 are fp). This remains true even for both logical and 556313Sgblack@eecs.umich.edu * physical register indices. The IQ depends on the memory dependence unit to 566313Sgblack@eecs.umich.edu * track when memory operations are ready in terms of ordering; register 576313Sgblack@eecs.umich.edu * dependencies are tracked normally. Right now the IQ also handles the 586333Sgblack@eecs.umich.edu * execution timing; this is mainly to allow back-to-back scheduling without 596718Sgblack@eecs.umich.edu * requiring IEW to be able to peek into the IQ. At the end of the execution 606718Sgblack@eecs.umich.edu * latency, the instruction is put into the queue to execute, where it will 616718Sgblack@eecs.umich.edu * have the execute() function called on it. 626718Sgblack@eecs.umich.edu * @todo: Make IQ able to handle multiple FU pools. 636718Sgblack@eecs.umich.edu */ 646718Sgblack@eecs.umich.edutemplate <class Impl> 656718Sgblack@eecs.umich.educlass InstructionQueue 666718Sgblack@eecs.umich.edu{ 676718Sgblack@eecs.umich.edu public: 686718Sgblack@eecs.umich.edu //Typedefs from the Impl. 696718Sgblack@eecs.umich.edu typedef typename Impl::FullCPU FullCPU; 706718Sgblack@eecs.umich.edu typedef typename Impl::DynInstPtr DynInstPtr; 716718Sgblack@eecs.umich.edu typedef typename Impl::Params Params; 726718Sgblack@eecs.umich.edu 736718Sgblack@eecs.umich.edu typedef typename Impl::CPUPol::IEW IEW; 746718Sgblack@eecs.umich.edu typedef typename Impl::CPUPol::MemDepUnit MemDepUnit; 756718Sgblack@eecs.umich.edu typedef typename Impl::CPUPol::IssueStruct IssueStruct; 766718Sgblack@eecs.umich.edu typedef typename Impl::CPUPol::TimeStruct TimeStruct; 776718Sgblack@eecs.umich.edu 786723Sgblack@eecs.umich.edu // Typedef of iterator through the list of instructions. 796723Sgblack@eecs.umich.edu typedef typename std::list<DynInstPtr>::iterator ListIt; 806723Sgblack@eecs.umich.edu 816718Sgblack@eecs.umich.edu friend class Impl::FullCPU; 826718Sgblack@eecs.umich.edu 836718Sgblack@eecs.umich.edu /** FU completion event class. */ 846718Sgblack@eecs.umich.edu class FUCompletion : public Event { 856718Sgblack@eecs.umich.edu private: 866718Sgblack@eecs.umich.edu /** Executing instruction. */ 876718Sgblack@eecs.umich.edu DynInstPtr inst; 886718Sgblack@eecs.umich.edu 896718Sgblack@eecs.umich.edu /** Index of the FU used for executing. */ 906718Sgblack@eecs.umich.edu int fuIdx; 916313Sgblack@eecs.umich.edu 926313Sgblack@eecs.umich.edu /** Pointer back to the instruction queue. */ 936333Sgblack@eecs.umich.edu InstructionQueue<Impl> *iqPtr; 946333Sgblack@eecs.umich.edu 956401Sgblack@eecs.umich.edu bool freeFU; 966401Sgblack@eecs.umich.edu 976719Sgblack@eecs.umich.edu public: 986401Sgblack@eecs.umich.edu /** Construct a FU completion event. */ 996718Sgblack@eecs.umich.edu FUCompletion(DynInstPtr &_inst, int fu_idx, 1006735Sgblack@eecs.umich.edu InstructionQueue<Impl> *iq_ptr); 1016735Sgblack@eecs.umich.edu 1026735Sgblack@eecs.umich.edu virtual void process(); 1036735Sgblack@eecs.umich.edu virtual const char *description(); 1046735Sgblack@eecs.umich.edu void setFreeFU() { freeFU = true; } 1056735Sgblack@eecs.umich.edu }; 1066735Sgblack@eecs.umich.edu 1077270Sgblack@eecs.umich.edu /** Constructs an IQ. */ 1086735Sgblack@eecs.umich.edu InstructionQueue(Params *params); 1097271Sgblack@eecs.umich.edu 1107271Sgblack@eecs.umich.edu /** Destructs the IQ. */ 1117271Sgblack@eecs.umich.edu ~InstructionQueue(); 1127271Sgblack@eecs.umich.edu 1137271Sgblack@eecs.umich.edu /** Returns the name of the IQ. */ 1147271Sgblack@eecs.umich.edu std::string name() const; 1156401Sgblack@eecs.umich.edu 1166333Sgblack@eecs.umich.edu /** Registers statistics. */ 1176313Sgblack@eecs.umich.edu void regStats(); 1186333Sgblack@eecs.umich.edu 1196333Sgblack@eecs.umich.edu void resetState(); 1206333Sgblack@eecs.umich.edu 1216333Sgblack@eecs.umich.edu /** Sets CPU pointer. */ 1226745Sgblack@eecs.umich.edu void setCPU(FullCPU *_cpu) { cpu = _cpu; } 1236745Sgblack@eecs.umich.edu 1246745Sgblack@eecs.umich.edu /** Sets active threads list. */ 1256745Sgblack@eecs.umich.edu void setActiveThreads(std::list<unsigned> *at_ptr); 1266745Sgblack@eecs.umich.edu 1276745Sgblack@eecs.umich.edu /** Sets the IEW pointer. */ 1286745Sgblack@eecs.umich.edu void setIEW(IEW *iew_ptr) { iewStage = iew_ptr; } 1296745Sgblack@eecs.umich.edu 1306745Sgblack@eecs.umich.edu /** Sets the timer buffer between issue and execute. */ 1316745Sgblack@eecs.umich.edu void setIssueToExecuteQueue(TimeBuffer<IssueStruct> *i2eQueue); 1326745Sgblack@eecs.umich.edu 1336745Sgblack@eecs.umich.edu /** Sets the global time buffer. */ 1346745Sgblack@eecs.umich.edu void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr); 1356745Sgblack@eecs.umich.edu 1366745Sgblack@eecs.umich.edu void switchOut(); 1376745Sgblack@eecs.umich.edu 1386745Sgblack@eecs.umich.edu void takeOverFrom(); 1396745Sgblack@eecs.umich.edu 1406745Sgblack@eecs.umich.edu bool isSwitchedOut() { return switchedOut; } 1416745Sgblack@eecs.umich.edu 1426745Sgblack@eecs.umich.edu /** Number of entries needed for given amount of threads. */ 1436333Sgblack@eecs.umich.edu int entryAmount(int num_threads); 1446333Sgblack@eecs.umich.edu 1456313Sgblack@eecs.umich.edu /** Resets max entries for all threads. */ 1466333Sgblack@eecs.umich.edu void resetEntries(); 1476333Sgblack@eecs.umich.edu 1486333Sgblack@eecs.umich.edu /** Returns total number of free entries. */ 1497093Sgblack@eecs.umich.edu unsigned numFreeEntries(); 1507093Sgblack@eecs.umich.edu 1517093Sgblack@eecs.umich.edu /** Returns number of free entries for a thread. */ 1527093Sgblack@eecs.umich.edu unsigned numFreeEntries(unsigned tid); 1537093Sgblack@eecs.umich.edu 1547093Sgblack@eecs.umich.edu /** Returns whether or not the IQ is full. */ 1557093Sgblack@eecs.umich.edu bool isFull(); 1567093Sgblack@eecs.umich.edu 1577093Sgblack@eecs.umich.edu /** Returns whether or not the IQ is full for a specific thread. */ 1587093Sgblack@eecs.umich.edu bool isFull(unsigned tid); 1597093Sgblack@eecs.umich.edu 1607093Sgblack@eecs.umich.edu /** Returns if there are any ready instructions in the IQ. */ 1617093Sgblack@eecs.umich.edu bool hasReadyInsts(); 1627259Sgblack@eecs.umich.edu 1637259Sgblack@eecs.umich.edu /** Inserts a new instruction into the IQ. */ 1647259Sgblack@eecs.umich.edu void insert(DynInstPtr &new_inst); 1657259Sgblack@eecs.umich.edu 1667259Sgblack@eecs.umich.edu /** Inserts a new, non-speculative instruction into the IQ. */ 1676745Sgblack@eecs.umich.edu void insertNonSpec(DynInstPtr &new_inst); 1686333Sgblack@eecs.umich.edu 1696333Sgblack@eecs.umich.edu /** Inserts a memory or write barrier into the IQ to make sure 1706333Sgblack@eecs.umich.edu * loads and stores are ordered properly. 1716333Sgblack@eecs.umich.edu */ 1726333Sgblack@eecs.umich.edu void insertBarrier(DynInstPtr &barr_inst); 1736333Sgblack@eecs.umich.edu 1746745Sgblack@eecs.umich.edu DynInstPtr getInstToExecute(); 1756745Sgblack@eecs.umich.edu 1766745Sgblack@eecs.umich.edu /** 1776745Sgblack@eecs.umich.edu * Records the instruction as the producer of a register without 1786745Sgblack@eecs.umich.edu * adding it to the rest of the IQ. 1796745Sgblack@eecs.umich.edu */ 1806745Sgblack@eecs.umich.edu void recordProducer(DynInstPtr &inst) 1816745Sgblack@eecs.umich.edu { addToProducers(inst); } 1826745Sgblack@eecs.umich.edu 1836745Sgblack@eecs.umich.edu /** Process FU completion event. */ 1846745Sgblack@eecs.umich.edu void processFUCompletion(DynInstPtr &inst, int fu_idx); 1856745Sgblack@eecs.umich.edu 1866745Sgblack@eecs.umich.edu /** 1876745Sgblack@eecs.umich.edu * Schedules ready instructions, adding the ready ones (oldest first) to 1886745Sgblack@eecs.umich.edu * the queue to execute. 1896745Sgblack@eecs.umich.edu */ 1906745Sgblack@eecs.umich.edu void scheduleReadyInsts(); 1916745Sgblack@eecs.umich.edu 1926745Sgblack@eecs.umich.edu /** Schedules a single specific non-speculative instruction. */ 1936745Sgblack@eecs.umich.edu void scheduleNonSpec(const InstSeqNum &inst); 1946745Sgblack@eecs.umich.edu 1956745Sgblack@eecs.umich.edu /** 1966745Sgblack@eecs.umich.edu * Commits all instructions up to and including the given sequence number, 1976745Sgblack@eecs.umich.edu * for a specific thread. 1986745Sgblack@eecs.umich.edu */ 1996745Sgblack@eecs.umich.edu void commit(const InstSeqNum &inst, unsigned tid = 0); 2006745Sgblack@eecs.umich.edu 2016745Sgblack@eecs.umich.edu /** Wakes all dependents of a completed instruction. */ 2026745Sgblack@eecs.umich.edu int wakeDependents(DynInstPtr &completed_inst); 2036333Sgblack@eecs.umich.edu 2046333Sgblack@eecs.umich.edu /** Adds a ready memory instruction to the ready list. */ 2056333Sgblack@eecs.umich.edu void addReadyMemInst(DynInstPtr &ready_inst); 2066333Sgblack@eecs.umich.edu 2076333Sgblack@eecs.umich.edu /** 2086333Sgblack@eecs.umich.edu * Reschedules a memory instruction. It will be ready to issue once 2097271Sgblack@eecs.umich.edu * replayMemInst() is called. 2106718Sgblack@eecs.umich.edu */ 2116718Sgblack@eecs.umich.edu void rescheduleMemInst(DynInstPtr &resched_inst); 2127093Sgblack@eecs.umich.edu 2137093Sgblack@eecs.umich.edu /** Replays a memory instruction. It must be rescheduled first. */ 2147093Sgblack@eecs.umich.edu void replayMemInst(DynInstPtr &replay_inst); 2157093Sgblack@eecs.umich.edu 2167093Sgblack@eecs.umich.edu /** Completes a memory operation. */ 2177093Sgblack@eecs.umich.edu void completeMemInst(DynInstPtr &completed_inst); 2187093Sgblack@eecs.umich.edu 2197093Sgblack@eecs.umich.edu /** Indicates an ordering violation between a store and a load. */ 2206718Sgblack@eecs.umich.edu void violation(DynInstPtr &store, DynInstPtr &faulting_load); 2217259Sgblack@eecs.umich.edu 2227259Sgblack@eecs.umich.edu /** 2237259Sgblack@eecs.umich.edu * Squashes instructions for a thread. Squashing information is obtained 2247259Sgblack@eecs.umich.edu * from the time buffer. 2257259Sgblack@eecs.umich.edu */ 2267271Sgblack@eecs.umich.edu void squash(unsigned tid); 2277271Sgblack@eecs.umich.edu 2287271Sgblack@eecs.umich.edu /** Returns the number of used entries for a thread. */ 2297271Sgblack@eecs.umich.edu unsigned getCount(unsigned tid) { return count[tid]; }; 2307271Sgblack@eecs.umich.edu 2317271Sgblack@eecs.umich.edu /** Debug function to print all instructions. */ 2327271Sgblack@eecs.umich.edu void printInsts(); 2337271Sgblack@eecs.umich.edu 2347271Sgblack@eecs.umich.edu private: 2356333Sgblack@eecs.umich.edu /** Does the actual squashing. */ 2366313Sgblack@eecs.umich.edu void doSquash(unsigned tid); 2376313Sgblack@eecs.umich.edu 2386313Sgblack@eecs.umich.edu ///////////////////////// 2396313Sgblack@eecs.umich.edu // Various pointers 2406718Sgblack@eecs.umich.edu ///////////////////////// 2416718Sgblack@eecs.umich.edu 2426718Sgblack@eecs.umich.edu /** Pointer to the CPU. */ 2436726Sgblack@eecs.umich.edu FullCPU *cpu; 2446726Sgblack@eecs.umich.edu 2456718Sgblack@eecs.umich.edu /** Cache interface. */ 2466726Sgblack@eecs.umich.edu MemInterface *dcacheInterface; 2476726Sgblack@eecs.umich.edu 2486718Sgblack@eecs.umich.edu /** Pointer to IEW stage. */ 2496718Sgblack@eecs.umich.edu IEW *iewStage; 2506313Sgblack@eecs.umich.edu 2516313Sgblack@eecs.umich.edu /** The memory dependence unit, which tracks/predicts memory dependences 2526313Sgblack@eecs.umich.edu * between instructions. 2536313Sgblack@eecs.umich.edu */ 2546313Sgblack@eecs.umich.edu MemDepUnit memDepUnit[Impl::MaxThreads]; 2556313Sgblack@eecs.umich.edu 2566313Sgblack@eecs.umich.edu /** The queue to the execute stage. Issued instructions will be written 2576313Sgblack@eecs.umich.edu * into it. 2586678Sgblack@eecs.umich.edu */ 2596333Sgblack@eecs.umich.edu TimeBuffer<IssueStruct> *issueToExecuteQueue; 2606678Sgblack@eecs.umich.edu 2616678Sgblack@eecs.umich.edu /** The backwards time buffer. */ 2626333Sgblack@eecs.umich.edu TimeBuffer<TimeStruct> *timeBuffer; 2636313Sgblack@eecs.umich.edu 2646313Sgblack@eecs.umich.edu /** Wire to read information from timebuffer. */ 2656313Sgblack@eecs.umich.edu typename TimeBuffer<TimeStruct>::wire fromCommit; 2666313Sgblack@eecs.umich.edu 2676313Sgblack@eecs.umich.edu /** Function unit pool. */ 2686313Sgblack@eecs.umich.edu FUPool *fuPool; 2696313Sgblack@eecs.umich.edu 2706313Sgblack@eecs.umich.edu ////////////////////////////////////// 2716313Sgblack@eecs.umich.edu // Instruction lists, ready queues, and ordering 272 ////////////////////////////////////// 273 274 /** List of all the instructions in the IQ (some of which may be issued). */ 275 std::list<DynInstPtr> instList[Impl::MaxThreads]; 276 277 std::list<DynInstPtr> instsToExecute; 278 279 /** 280 * Struct for comparing entries to be added to the priority queue. This 281 * gives reverse ordering to the instructions in terms of sequence 282 * numbers: the instructions with smaller sequence numbers (and hence 283 * are older) will be at the top of the priority queue. 284 */ 285 struct pqCompare { 286 bool operator() (const DynInstPtr &lhs, const DynInstPtr &rhs) const 287 { 288 return lhs->seqNum > rhs->seqNum; 289 } 290 }; 291 292 typedef std::priority_queue<DynInstPtr, std::vector<DynInstPtr>, pqCompare> 293 ReadyInstQueue; 294 295 /** List of ready instructions, per op class. They are separated by op 296 * class to allow for easy mapping to FUs. 297 */ 298 ReadyInstQueue readyInsts[Num_OpClasses]; 299 300 /** List of non-speculative instructions that will be scheduled 301 * once the IQ gets a signal from commit. While it's redundant to 302 * have the key be a part of the value (the sequence number is stored 303 * inside of DynInst), when these instructions are woken up only 304 * the sequence number will be available. Thus it is most efficient to be 305 * able to search by the sequence number alone. 306 */ 307 std::map<InstSeqNum, DynInstPtr> nonSpecInsts; 308 309 typedef typename std::map<InstSeqNum, DynInstPtr>::iterator NonSpecMapIt; 310 311 /** Entry for the list age ordering by op class. */ 312 struct ListOrderEntry { 313 OpClass queueType; 314 InstSeqNum oldestInst; 315 }; 316 317 /** List that contains the age order of the oldest instruction of each 318 * ready queue. Used to select the oldest instruction available 319 * among op classes. 320 * @todo: Might be better to just move these entries around instead 321 * of creating new ones every time the position changes due to an 322 * instruction issuing. Not sure std::list supports this. 323 */ 324 std::list<ListOrderEntry> listOrder; 325 326 typedef typename std::list<ListOrderEntry>::iterator ListOrderIt; 327 328 /** Tracks if each ready queue is on the age order list. */ 329 bool queueOnList[Num_OpClasses]; 330 331 /** Iterators of each ready queue. Points to their spot in the age order 332 * list. 333 */ 334 ListOrderIt readyIt[Num_OpClasses]; 335 336 /** Add an op class to the age order list. */ 337 void addToOrderList(OpClass op_class); 338 339 /** 340 * Called when the oldest instruction has been removed from a ready queue; 341 * this places that ready queue into the proper spot in the age order list. 342 */ 343 void moveToYoungerInst(ListOrderIt age_order_it); 344 345 DependencyGraph<DynInstPtr> dependGraph; 346 347 ////////////////////////////////////// 348 // Various parameters 349 ////////////////////////////////////// 350 351 /** IQ Resource Sharing Policy */ 352 enum IQPolicy { 353 Dynamic, 354 Partitioned, 355 Threshold 356 }; 357 358 /** IQ sharing policy for SMT. */ 359 IQPolicy iqPolicy; 360 361 /** Number of Total Threads*/ 362 unsigned numThreads; 363 364 /** Pointer to list of active threads. */ 365 std::list<unsigned> *activeThreads; 366 367 /** Per Thread IQ count */ 368 unsigned count[Impl::MaxThreads]; 369 370 /** Max IQ Entries Per Thread */ 371 unsigned maxEntries[Impl::MaxThreads]; 372 373 /** Number of free IQ entries left. */ 374 unsigned freeEntries; 375 376 /** The number of entries in the instruction queue. */ 377 unsigned numEntries; 378 379 /** The total number of instructions that can be issued in one cycle. */ 380 unsigned totalWidth; 381 382 /** The number of physical registers in the CPU. */ 383 unsigned numPhysRegs; 384 385 /** The number of physical integer registers in the CPU. */ 386 unsigned numPhysIntRegs; 387 388 /** The number of floating point registers in the CPU. */ 389 unsigned numPhysFloatRegs; 390 391 /** Delay between commit stage and the IQ. 392 * @todo: Make there be a distinction between the delays within IEW. 393 */ 394 unsigned commitToIEWDelay; 395 396 bool switchedOut; 397 398 /** The sequence number of the squashed instruction. */ 399 InstSeqNum squashedSeqNum[Impl::MaxThreads]; 400 401 /** A cache of the recently woken registers. It is 1 if the register 402 * has been woken up recently, and 0 if the register has been added 403 * to the dependency graph and has not yet received its value. It 404 * is basically a secondary scoreboard, and should pretty much mirror 405 * the scoreboard that exists in the rename map. 406 */ 407 std::vector<bool> regScoreboard; 408 409 /** Adds an instruction to the dependency graph, as a consumer. */ 410 bool addToDependents(DynInstPtr &new_inst); 411 412 /** Adds an instruction to the dependency graph, as a producer. */ 413 void addToProducers(DynInstPtr &new_inst); 414 415 /** Moves an instruction to the ready queue if it is ready. */ 416 void addIfReady(DynInstPtr &inst); 417 418 /** Debugging function to count how many entries are in the IQ. It does 419 * a linear walk through the instructions, so do not call this function 420 * during normal execution. 421 */ 422 int countInsts(); 423 424 /** Debugging function to dump all the list sizes, as well as print 425 * out the list of nonspeculative instructions. Should not be used 426 * in any other capacity, but it has no harmful sideaffects. 427 */ 428 void dumpLists(); 429 430 /** Debugging function to dump out all instructions that are in the 431 * IQ. 432 */ 433 void dumpInsts(); 434 435 /** Stat for number of instructions added. */ 436 Stats::Scalar<> iqInstsAdded; 437 /** Stat for number of non-speculative instructions added. */ 438 Stats::Scalar<> iqNonSpecInstsAdded; 439 440 Stats::Scalar<> iqInstsIssued; 441 /** Stat for number of integer instructions issued. */ 442 Stats::Scalar<> iqIntInstsIssued; 443 /** Stat for number of floating point instructions issued. */ 444 Stats::Scalar<> iqFloatInstsIssued; 445 /** Stat for number of branch instructions issued. */ 446 Stats::Scalar<> iqBranchInstsIssued; 447 /** Stat for number of memory instructions issued. */ 448 Stats::Scalar<> iqMemInstsIssued; 449 /** Stat for number of miscellaneous instructions issued. */ 450 Stats::Scalar<> iqMiscInstsIssued; 451 /** Stat for number of squashed instructions that were ready to issue. */ 452 Stats::Scalar<> iqSquashedInstsIssued; 453 /** Stat for number of squashed instructions examined when squashing. */ 454 Stats::Scalar<> iqSquashedInstsExamined; 455 /** Stat for number of squashed instruction operands examined when 456 * squashing. 457 */ 458 Stats::Scalar<> iqSquashedOperandsExamined; 459 /** Stat for number of non-speculative instructions removed due to a squash. 460 */ 461 Stats::Scalar<> iqSquashedNonSpecRemoved; 462 463 Stats::VectorDistribution<> queueResDist; 464 Stats::Distribution<> numIssuedDist; 465 Stats::VectorDistribution<> issueDelayDist; 466 467 Stats::Vector<> statFuBusy; 468// Stats::Vector<> dist_unissued; 469 Stats::Vector2d<> statIssuedInstType; 470 471 Stats::Formula issueRate; 472// Stats::Formula issue_stores; 473// Stats::Formula issue_op_rate; 474 Stats::Vector<> fuBusy; //cumulative fu busy 475 476 Stats::Formula fuBusyRate; 477}; 478 479#endif //__CPU_O3_INST_QUEUE_HH__ 480