2c2
< * Copyright (c) 2004-2005 The Regents of The University of Michigan
---
> * Copyright (c) 2004-2006 The Regents of The University of Michigan
29,33c29,30
< // 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.
---
> #ifndef __CPU_O3_ROB_HH__
> #define __CPU_O3_ROB_HH__
35,37c32
< #ifndef __CPU_O3_CPU_ROB_HH__
< #define __CPU_O3_CPU_ROB_HH__
<
---
> #include <string>
42,45c37
< * 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.
---
> * ROB class. The ROB is largely what drives squashing.
57,58c49,50
< typedef std::pair<RegIndex, PhysRegIndex> UnmapInfo_t;
< typedef typename list<DynInstPtr>::iterator InstIt_t;
---
> typedef std::pair<RegIndex, PhysRegIndex> UnmapInfo;
> typedef typename std::list<DynInstPtr>::iterator InstIt;
59a52,72
> /** 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;
>
62,64c75,80
< * @param _numEntries Number of entries in ROB.
< * @param _squashWidth Number of instructions that can be squashed in a
< * single cycle.
---
> * @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.
66c82,83
< ROB(unsigned _numEntries, unsigned _squashWidth);
---
> ROB(unsigned _numEntries, unsigned _squashWidth, std::string smtROBPolicy,
> unsigned _smtROBThreshold, unsigned _numThreads);
67a85,86
> std::string name() const;
>
74,77c93,104
< /** 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.
---
> /** 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.
79d105
< * @todo Remove the parameter once correctness is ensured.
87c113
< DynInstPtr readHeadInst() { return cpu->instList.front(); }
---
> // DynInstPtr readHeadInst();
89c115,119
< DynInstPtr readTailInst() { return (*tail); }
---
> /** 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);
91c121,125
< void retireHead();
---
> /** 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();
93c127,131
< bool isHeadReady();
---
> /** 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);
94a133,156
> /** 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. */
96a159,170
> /** 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. */
99a174,178
> /** Returns if a specific thread's partition is full. */
> bool isFull(unsigned tid)
> { return threadEntries[tid] == numEntries; }
>
> /** Returns if the ROB is empty. */
103c182,184
< void doSquash();
---
> /** Returns if a specific thread's partition is empty. */
> bool isEmpty(unsigned tid)
> { return threadEntries[tid] == 0; }
105c186,187
< void squash(InstSeqNum squash_num);
---
> /** Executes the squash, marking squashed instructions. */
> void doSquash(unsigned tid);
107c189,192
< uint64_t readHeadPC();
---
> /** Squashes all instructions younger than the given sequence number for
> * the specific thread.
> */
> void squash(InstSeqNum squash_num, unsigned tid);
109c194,195
< uint64_t readHeadNextPC();
---
> /** Updates the head instruction with the new oldest instruction. */
> void updateHead();
111c197,198
< InstSeqNum readHeadSeqNum();
---
> /** Updates the tail instruction with the new youngest instruction. */
> void updateTail();
113c200,201
< uint64_t readTailPC();
---
> /** Reads the PC of the oldest head instruction. */
> // uint64_t readHeadPC();
115c203,204
< InstSeqNum readTailSeqNum();
---
> /** Reads the PC of the head instruction of a specific thread. */
> // uint64_t readHeadPC(unsigned tid);
116a206,230
> /** 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);
>
120c234,235
< bool isDoneSquashing() const { return doneSquashing; }
---
> bool isDoneSquashing(unsigned tid) const
> { return doneSquashing[tid]; }
121a237,241
> /** Checks if the ROB is still in the process of squashing instructions for
> * any thread.
> */
> bool isDoneSquashing();
>
128c248,252
< private:
---
> /** 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);
129a254
> private:
132a258,260
> /** Active Threads in CPU */
> std::list<unsigned>* activeThreads;
>
135a264,272
> /** 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];
>
138a276
> public:
143c281
< InstIt_t tail;
---
> InstIt tail;
144a283,287
> /** Iterator pointing to the instruction which is the first instruction in
> * in the ROB*/
> InstIt head;
>
> private:
152c295
< InstIt_t squashIt;
---
> InstIt squashIt[Impl::MaxThreads];
153a297
> public:
156a301,303
> DynInstPtr dummyInst;
>
> private:
161c308,311
< bool doneSquashing;
---
> bool doneSquashing[Impl::MaxThreads];
>
> /** Number of active threads. */
> unsigned numThreads;
164c314
< #endif //__CPU_O3_CPU_ROB_HH__
---
> #endif //__CPU_O3_ROB_HH__