inst_queue.hh

来自「M5,一个功能强大的多处理器系统模拟器.很多针对处理器架构,性能的研究都使用它作」· HH 代码 · 共 503 行 · 第 1/2 页

HH
503
字号
    MemInterface *dcacheInterface;    /** Pointer to IEW stage. */    IEW *iewStage;    /** The memory dependence unit, which tracks/predicts memory dependences     *  between instructions.     */    MemDepUnit memDepUnit[Impl::MaxThreads];    /** The queue to the execute stage.  Issued instructions will be written     *  into it.     */    TimeBuffer<IssueStruct> *issueToExecuteQueue;    /** The backwards time buffer. */    TimeBuffer<TimeStruct> *timeBuffer;    /** Wire to read information from timebuffer. */    typename TimeBuffer<TimeStruct>::wire fromCommit;    /** Function unit pool. */    FUPool *fuPool;    //////////////////////////////////////    // Instruction lists, ready queues, and ordering    //////////////////////////////////////    /** List of all the instructions in the IQ (some of which may be issued). */    std::list<DynInstPtr> instList[Impl::MaxThreads];    /** List of instructions that are ready to be executed. */    std::list<DynInstPtr> instsToExecute;    /**     * Struct for comparing entries to be added to the priority queue.     * This gives reverse ordering to the instructions in terms of     * sequence numbers: the instructions with smaller sequence     * numbers (and hence are older) will be at the top of the     * priority queue.     */    struct pqCompare {        bool operator() (const DynInstPtr &lhs, const DynInstPtr &rhs) const        {            return lhs->seqNum > rhs->seqNum;        }    };    typedef std::priority_queue<DynInstPtr, std::vector<DynInstPtr>, pqCompare>    ReadyInstQueue;    /** List of ready instructions, per op class.  They are separated by op     *  class to allow for easy mapping to FUs.     */    ReadyInstQueue readyInsts[Num_OpClasses];    /** List of non-speculative instructions that will be scheduled     *  once the IQ gets a signal from commit.  While it's redundant to     *  have the key be a part of the value (the sequence number is stored     *  inside of DynInst), when these instructions are woken up only     *  the sequence number will be available.  Thus it is most efficient to be     *  able to search by the sequence number alone.     */    std::map<InstSeqNum, DynInstPtr> nonSpecInsts;    typedef typename std::map<InstSeqNum, DynInstPtr>::iterator NonSpecMapIt;    /** Entry for the list age ordering by op class. */    struct ListOrderEntry {        OpClass queueType;        InstSeqNum oldestInst;    };    /** List that contains the age order of the oldest instruction of each     *  ready queue.  Used to select the oldest instruction available     *  among op classes.     *  @todo: Might be better to just move these entries around instead     *  of creating new ones every time the position changes due to an     *  instruction issuing.  Not sure std::list supports this.     */    std::list<ListOrderEntry> listOrder;    typedef typename std::list<ListOrderEntry>::iterator ListOrderIt;    /** Tracks if each ready queue is on the age order list. */    bool queueOnList[Num_OpClasses];    /** Iterators of each ready queue.  Points to their spot in the age order     *  list.     */    ListOrderIt readyIt[Num_OpClasses];    /** Add an op class to the age order list. */    void addToOrderList(OpClass op_class);    /**     * Called when the oldest instruction has been removed from a ready queue;     * this places that ready queue into the proper spot in the age order list.     */    void moveToYoungerInst(ListOrderIt age_order_it);    DependencyGraph<DynInstPtr> dependGraph;    //////////////////////////////////////    // Various parameters    //////////////////////////////////////    /** IQ Resource Sharing Policy */    enum IQPolicy {        Dynamic,        Partitioned,        Threshold    };    /** IQ sharing policy for SMT. */    IQPolicy iqPolicy;    /** Number of Total Threads*/    unsigned numThreads;    /** Pointer to list of active threads. */    std::list<unsigned> *activeThreads;    /** Per Thread IQ count */    unsigned count[Impl::MaxThreads];    /** Max IQ Entries Per Thread */    unsigned maxEntries[Impl::MaxThreads];    /** Number of free IQ entries left. */    unsigned freeEntries;    /** The number of entries in the instruction queue. */    unsigned numEntries;    /** The total number of instructions that can be issued in one cycle. */    unsigned totalWidth;    /** The number of physical registers in the CPU. */    unsigned numPhysRegs;    /** The number of physical integer registers in the CPU. */    unsigned numPhysIntRegs;    /** The number of floating point registers in the CPU. */    unsigned numPhysFloatRegs;    /** Delay between commit stage and the IQ.     *  @todo: Make there be a distinction between the delays within IEW.     */    unsigned commitToIEWDelay;    /** Is the IQ switched out. */    bool switchedOut;    /** The sequence number of the squashed instruction. */    InstSeqNum squashedSeqNum[Impl::MaxThreads];    /** A cache of the recently woken registers.  It is 1 if the register     *  has been woken up recently, and 0 if the register has been added     *  to the dependency graph and has not yet received its value.  It     *  is basically a secondary scoreboard, and should pretty much mirror     *  the scoreboard that exists in the rename map.     */    std::vector<bool> regScoreboard;    /** Adds an instruction to the dependency graph, as a consumer. */    bool addToDependents(DynInstPtr &new_inst);    /** Adds an instruction to the dependency graph, as a producer. */    void addToProducers(DynInstPtr &new_inst);    /** Moves an instruction to the ready queue if it is ready. */    void addIfReady(DynInstPtr &inst);    /** Debugging function to count how many entries are in the IQ.  It does     *  a linear walk through the instructions, so do not call this function     *  during normal execution.     */    int countInsts();    /** Debugging function to dump all the list sizes, as well as print     *  out the list of nonspeculative instructions.  Should not be used     *  in any other capacity, but it has no harmful sideaffects.     */    void dumpLists();    /** Debugging function to dump out all instructions that are in the     *  IQ.     */    void dumpInsts();    /** Stat for number of instructions added. */    Stats::Scalar<> iqInstsAdded;    /** Stat for number of non-speculative instructions added. */    Stats::Scalar<> iqNonSpecInstsAdded;    Stats::Scalar<> iqInstsIssued;    /** Stat for number of integer instructions issued. */    Stats::Scalar<> iqIntInstsIssued;    /** Stat for number of floating point instructions issued. */    Stats::Scalar<> iqFloatInstsIssued;    /** Stat for number of branch instructions issued. */    Stats::Scalar<> iqBranchInstsIssued;    /** Stat for number of memory instructions issued. */    Stats::Scalar<> iqMemInstsIssued;    /** Stat for number of miscellaneous instructions issued. */    Stats::Scalar<> iqMiscInstsIssued;    /** Stat for number of squashed instructions that were ready to issue. */    Stats::Scalar<> iqSquashedInstsIssued;    /** Stat for number of squashed instructions examined when squashing. */    Stats::Scalar<> iqSquashedInstsExamined;    /** Stat for number of squashed instruction operands examined when     * squashing.     */    Stats::Scalar<> iqSquashedOperandsExamined;    /** Stat for number of non-speculative instructions removed due to a squash.     */    Stats::Scalar<> iqSquashedNonSpecRemoved;    // Also include number of instructions rescheduled and replayed.    /** Distribution of number of instructions in the queue.     * @todo: Need to create struct to track the entry time for each     * instruction. *///    Stats::VectorDistribution<> queueResDist;    /** Distribution of the number of instructions issued. */    Stats::Distribution<> numIssuedDist;    /** Distribution of the cycles it takes to issue an instruction.     * @todo: Need to create struct to track the ready time for each     * instruction. *///    Stats::VectorDistribution<> issueDelayDist;    /** Number of times an instruction could not be issued because a     * FU was busy.     */    Stats::Vector<> statFuBusy;//    Stats::Vector<> dist_unissued;    /** Stat for total number issued for each instruction type. */    Stats::Vector2d<> statIssuedInstType;    /** Number of instructions issued per cycle. */    Stats::Formula issueRate;    /** Number of times the FU was busy. */    Stats::Vector<> fuBusy;    /** Number of times the FU was busy per instruction issued. */    Stats::Formula fuBusyRate;};#endif //__CPU_O3_INST_QUEUE_HH__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?