• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/elements/mcopteron/InstructionQueue.h

00001 
00002 #ifndef INSTRUCTIONQUEUE_H
00003 #define INSTRUCTIONQUEUE_H
00004 
00005 #include <OpteronDefs.h>
00006 
00007 class FunctionalUnit;
00008 class Token;
00009 
00010 #define MAXFUNITS 5
00011 
00012 //-------------------------------------------------------------------
00013 /// @brief Represents an instruction queue in the CPU
00014 ///
00015 /// This class implements the instruction queue concept. One
00016 /// object represents one queue. Each queue has some functional
00017 /// units that it supervises. This class really is the heart of
00018 /// simulating the execution of an instruction, since it assigns
00019 /// instructions to functional units and retires them when they 
00020 /// are done.
00021 //-------------------------------------------------------------------
00022 class InstructionQueue
00023 {
00024  public:
00025    enum QType {INT, INTMUL, INTSP, FLOAT};
00026    InstructionQueue(QType type, char *name, unsigned int id, unsigned int size);
00027    ~InstructionQueue();
00028    void setNext(InstructionQueue *other);
00029    InstructionQueue* getNext();
00030    int addFunctionalUnit(FunctionalUnit *fu);
00031    int scheduleInstructions(CycleCount currentCycle);
00032    bool canHandleInstruction(Token *token);
00033    int assignInstruction(Token *token, CycleCount atCycle);
00034    bool isFull() {return (numInstructions >= size);};
00035    bool isEmpty() {return (numInstructions == 0);};
00036    void incFullStall() {fullStalls++;}
00037    void incAlreadyAssignedStall() {assignedStalls++;}
00038    bool alreadyAssigned(CycleCount currentCycle);
00039    double averageOccupancy(CycleCount cycles);
00040  private:
00041    char *name;         ///< Queue name
00042    QType type;         ///< Queue type
00043    unsigned int id;    ///< Unique queue ID
00044    unsigned int size;  ///< Number of entries in queue
00045    FunctionalUnit* myUnits[MAXFUNITS];  ///< Functional units this queue manages
00046    Token **queuedInstructions;    ///< Instructions in queue (of size 'size')
00047    InstructionCount totalInstructions;   ///< Total instructions this queue processed
00048    InstructionCount finishedInstructions; ///< Total instructions completed from queue so far
00049    unsigned long long fullStalls, assignedStalls;
00050    unsigned long long occupancyXCycles, totalCycles;
00051    unsigned int numInstructions;  ///< Number of instructions ???
00052    CycleCount lastAssignedCycle;  ///< Cycle that last instruction assignment occurred
00053    class InstructionQueue *next;  ///< Linked list ptr
00054 };
00055 
00056 #endif

Generated on Fri Oct 22 2010 11:02:25 for SST by  doxygen 1.7.1