2c2
< * Copyright (c) 2004-2006 The Regents of The University of Michigan
---
> * Copyright (c) 2004-2005 The Regents of The University of Michigan
26a27,28
> *
> * Authors: Kevin Lim
29,30c31,35
< #ifndef __CPU_O3_ROB_HH__
< #define __CPU_O3_ROB_HH__
---
> // Todo: Probably add in support for scheduling events (more than one as
> // well) on the case of the ROB being empty or full. Considering tracking
> // free entries instead of insts in ROB. Differentiate between squashing
> // all instructions after the instruction, and all instructions after *and*
> // including that instruction.
32c37,39
< #include <string>
---
> #ifndef __CPU_O3_CPU_ROB_HH__
> #define __CPU_O3_CPU_ROB_HH__
>
37c44,47
< * ROB class. The ROB is largely what drives squashing.
---
> * ROB class. Uses the instruction list that exists within the CPU to
> * represent the ROB. This class doesn't contain that list, but instead
> * a pointer to the CPU to get access to the list. The ROB, in this first
> * implementation, is largely what drives squashing.
49,50c59,60
< typedef std::pair<RegIndex, PhysRegIndex> UnmapInfo;
< typedef typename std::list<DynInstPtr>::iterator InstIt;
---
> typedef std::pair<RegIndex, PhysRegIndex> UnmapInfo_t;
> typedef typename list<DynInstPtr>::iterator InstIt_t;
52,72d61
< /** Possible ROB statuses. */
< enum Status {
< Running,
< Idle,
< ROBSquashing
< };
<
< /** SMT ROB Sharing Policy */
< enum ROBPolicy{
< Dynamic,
< Partitioned,
< Threshold
< };
<
< private:
< /** Per-thread ROB status. */
< Status robStatus[Impl::MaxThreads];
<
< /** ROB resource sharing policy for SMT mode. */
< ROBPolicy robPolicy;
<
75,80c64,66
< * @param _numEntries Number of entries in ROB.
< * @param _squashWidth Number of instructions that can be squashed in a
< * single cycle.
< * @param _smtROBPolicy ROB Partitioning Scheme for SMT.
< * @param _smtROBThreshold Max Resources(by %) a thread can have in the ROB.
< * @param _numThreads The number of active threads.
---
> * @param _numEntries Number of entries in ROB.
> * @param _squashWidth Number of instructions that can be squashed in a
> * single cycle.
82,83c68
< ROB(unsigned _numEntries, unsigned _squashWidth, std::string smtROBPolicy,
< unsigned _smtROBThreshold, unsigned _numThreads);
---
> ROB(unsigned _numEntries, unsigned _squashWidth);
85,86d69
< std::string name() const;
<
93,104c76,79
< /** Sets pointer to the list of active threads.
< * @param at_ptr Pointer to the list of active threads.
< */
< void setActiveThreads(std::list<unsigned>* at_ptr);
<
< void switchOut();
<
< void takeOverFrom();
<
< /** Function to insert an instruction into the ROB. Note that whatever
< * calls this function must ensure that there is enough space within the
< * ROB for the new instruction.
---
> /** Function to insert an instruction into the ROB. The parameter inst is
> * not truly required, but is useful for checking correctness. Note
> * that whatever calls this function must ensure that there is enough
> * space within the ROB for the new instruction.
105a81
> * @todo Remove the parameter once correctness is ensured.
113c89
< // DynInstPtr readHeadInst();
---
> DynInstPtr readHeadInst() { return cpu->instList.front(); }
115,119c91
< /** Returns a pointer to the head instruction of a specific thread within
< * the ROB.
< * @return Pointer to the DynInst that is at the head of the ROB.
< */
< DynInstPtr readHeadInst(unsigned tid);
---
> DynInstPtr readTailInst() { return (*tail); }
121,125c93
< /** Returns pointer to the tail instruction within the ROB. There is
< * no guarantee as to the return value if the ROB is empty.
< * @retval Pointer to the DynInst that is at the tail of the ROB.
< */
< // DynInstPtr readTailInst();
---
> void retireHead();
127,131c95
< /** Returns a pointer to the tail instruction of a specific thread within
< * the ROB.
< * @return Pointer to the DynInst that is at the tail of the ROB.
< */
< DynInstPtr readTailInst(unsigned tid);
---
> bool isHeadReady();
133,156d96
< /** Retires the head instruction, removing it from the ROB. */
< // void retireHead();
<
< /** Retires the head instruction of a specific thread, removing it from the
< * ROB.
< */
< void retireHead(unsigned tid);
<
< /** Is the oldest instruction across all threads ready. */
< // bool isHeadReady();
<
< /** Is the oldest instruction across a particular thread ready. */
< bool isHeadReady(unsigned tid);
<
< /** Is there any commitable head instruction across all threads ready. */
< bool canCommit();
<
< /** Re-adjust ROB partitioning. */
< void resetEntries();
<
< /** Number of entries needed For 'num_threads' amount of threads. */
< int entryAmount(int num_threads);
<
< /** Returns the number of total free entries in the ROB. */
159,170d98
< /** Returns the number of free entries in a specific ROB paritition. */
< unsigned numFreeEntries(unsigned tid);
<
< /** Returns the maximum number of entries for a specific thread. */
< unsigned getMaxEntries(unsigned tid)
< { return maxEntries[tid]; }
<
< /** Returns the number of entries being used by a specific thread. */
< unsigned getThreadEntries(unsigned tid)
< { return threadEntries[tid]; }
<
< /** Returns if the ROB is full. */
174,178d101
< /** Returns if a specific thread's partition is full. */
< bool isFull(unsigned tid)
< { return threadEntries[tid] == numEntries; }
<
< /** Returns if the ROB is empty. */
182,184c105
< /** Returns if a specific thread's partition is empty. */
< bool isEmpty(unsigned tid)
< { return threadEntries[tid] == 0; }
---
> void doSquash();
186,187c107
< /** Executes the squash, marking squashed instructions. */
< void doSquash(unsigned tid);
---
> void squash(InstSeqNum squash_num);
189,192c109
< /** Squashes all instructions younger than the given sequence number for
< * the specific thread.
< */
< void squash(InstSeqNum squash_num, unsigned tid);
---
> uint64_t readHeadPC();
194,195c111
< /** Updates the head instruction with the new oldest instruction. */
< void updateHead();
---
> uint64_t readHeadNextPC();
197,198c113
< /** Updates the tail instruction with the new youngest instruction. */
< void updateTail();
---
> InstSeqNum readHeadSeqNum();
200,201c115
< /** Reads the PC of the oldest head instruction. */
< // uint64_t readHeadPC();
---
> uint64_t readTailPC();
203,204c117
< /** Reads the PC of the head instruction of a specific thread. */
< // uint64_t readHeadPC(unsigned tid);
---
> InstSeqNum readTailSeqNum();
206,230d118
< /** Reads the next PC of the oldest head instruction. */
< // uint64_t readHeadNextPC();
<
< /** Reads the next PC of the head instruction of a specific thread. */
< // uint64_t readHeadNextPC(unsigned tid);
<
< /** Reads the sequence number of the oldest head instruction. */
< // InstSeqNum readHeadSeqNum();
<
< /** Reads the sequence number of the head instruction of a specific thread.
< */
< // InstSeqNum readHeadSeqNum(unsigned tid);
<
< /** Reads the PC of the youngest tail instruction. */
< // uint64_t readTailPC();
<
< /** Reads the PC of the tail instruction of a specific thread. */
< // uint64_t readTailPC(unsigned tid);
<
< /** Reads the sequence number of the youngest tail instruction. */
< // InstSeqNum readTailSeqNum();
<
< /** Reads the sequence number of tail instruction of a specific thread. */
< // InstSeqNum readTailSeqNum(unsigned tid);
<
234,235c122
< bool isDoneSquashing(unsigned tid) const
< { return doneSquashing[tid]; }
---
> bool isDoneSquashing() const { return doneSquashing; }
237,241d123
< /** Checks if the ROB is still in the process of squashing instructions for
< * any thread.
< */
< bool isDoneSquashing();
<
248,253d129
< /** This is more of a debugging function than anything. Use
< * threadEntries to get the instructions in the ROB unless you are
< * double checking that variable.
< */
< int countInsts(unsigned tid);
<
254a131
>
258,260d134
< /** Active Threads in CPU */
< std::list<unsigned>* activeThreads;
<
264,272d137
< /** Entries Per Thread */
< unsigned threadEntries[Impl::MaxThreads];
<
< /** Max Insts a Thread Can Have in the ROB */
< unsigned maxEntries[Impl::MaxThreads];
<
< /** ROB List of Instructions */
< std::list<DynInstPtr> instList[Impl::MaxThreads];
<
276d140
< public:
281c145
< InstIt tail;
---
> InstIt_t tail;
283,287d146
< /** Iterator pointing to the instruction which is the first instruction in
< * in the ROB*/
< InstIt head;
<
< private:
295c154
< InstIt squashIt[Impl::MaxThreads];
---
> InstIt_t squashIt;
297d155
< public:
301,303d158
< DynInstPtr dummyInst;
<
< private:
308,311c163
< bool doneSquashing[Impl::MaxThreads];
<
< /** Number of active threads. */
< unsigned numThreads;
---
> bool doneSquashing;
314c166
< #endif //__CPU_O3_ROB_HH__
---
> #endif //__CPU_O3_CPU_ROB_HH__