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

sst/elements/mcopteron/InstructionInfo.h

00001 
00002 #ifndef INSTRUCTIONINFO_H
00003 #define INSTRUCTIONINFO_H
00004 
00005 #include <OpteronDefs.h>
00006 
00007 //-------------------------------------------------------------------
00008 /// @brief Holds the static information about an instruction type
00009 ///
00010 /// This holds the information about how to execute an instruction
00011 /// along with how to do the bookkeeping for it. Objects of this
00012 /// class will be initialized at simulator initialization from a file
00013 /// of instruction info.
00014 //-------------------------------------------------------------------
00015 class InstructionInfo
00016 {
00017  public:
00018    enum OperandSize { OPSIZE8 = 1, OPSIZE16 = 2, OPSIZE32 = 4, OPSIZE64 = 8, OPSIZE128 = 16 };
00019    enum DataDirection {
00020       IREG2IREG = 1, IREG2MEM = 2, IREG2FREG = 4,
00021       FREG2FREG = 8, FREG2MEM = 16, FREG2IREG = 32,
00022       MEM2IREG = 64, MEM2MEM = 128, MEM2FREG = 256 };
00023    
00024    InstructionInfo();
00025    ~InstructionInfo();
00026    void dumpDebugInfo();
00027    void initStaticInfo(char *name, char *operands, char *operation, char *decodeUnit, 
00028                        char *execUnits, char *category);
00029    void initTimings(unsigned int baseLatency, unsigned int memLatency,
00030                     unsigned int throughputNum, unsigned int throughputDem);
00031    void initProbabilities(double occurProb, double loadProb, double storeProb,
00032                           double useHistogram[]);
00033    void accumProbabilities(double occurProb, unsigned long long occurs,
00034                            unsigned long long loads, unsigned long long stores,
00035                            double useHistogram[]);
00036    InstructionInfo* findInstructionRecord(const char *mnemonic, unsigned int iOpSize);
00037    unsigned int getUseDistance(double prob);
00038    bool isConditionalJump() {return conditionalJump;}
00039    char* getName() {return name;}
00040    InstructionInfo* getNext() {return next;}
00041    void setNext(InstructionInfo *other) {next = other;}
00042    Category getCategory() {return category;}
00043    unsigned int getLatency() {return latency;}
00044    double getOccurProb() {return occurProbability;}
00045    double getLoadProb() {return loadProbability;}
00046    double getStoreProb() {return storeProbability;}
00047    bool handlesLoad() {return (allowedDataDirs & (MEM2IREG|MEM2MEM|MEM2FREG)) != 0;}
00048    bool handlesStore() {return (allowedDataDirs & (IREG2MEM|FREG2MEM|MEM2MEM)) != 0;}
00049    bool needsLoadAddress() {return (!stackOp || loadProbability < 0.99);}
00050    bool needsStoreAddress() {return (!stackOp || storeProbability < 0.99);}
00051    bool needsFunctionalUnit(FunctionalUnitTypes fut) { return (execUnitMask & fut);}
00052    bool isFPUInstruction() {return execUnitMask & (FADD|FMUL|FSTORE);}
00053    unsigned long long getSimulationCount() {return actualOccurs;}
00054    void incSimulationCount() {actualOccurs++;}
00055    unsigned int throughput() {return throughputDem;}
00056    static InstructionInfo* createFromString(char* infoString);
00057  private:
00058    char* operands;   ///< Number of operands needed
00059    char* operation;  ///< Operation??
00060    char* decodeUnit; ///< Which decode unit needed?
00061    char* execUnits;  ///< Execution units that this insn type can use
00062                      // optional paths? how do we encode and/or/seq?
00063    Category category;       ///< High level instruction type category
00064    double occurProbability; ///< Probability of occurrence 
00065    double loadProbability;  ///< Probability this insn type does a load
00066    double storeProbability; ///< Probability this insn type does a store
00067    char *name;              ///< Instruction type name
00068    unsigned long long actualOccurs; ///< actual # of occurs in simulation
00069    unsigned long execUnitMask; ///< Bit mask that encodes FU usage
00070    unsigned int latency;    ///< Instruction type latency
00071    unsigned int throughputDem; ///< Throughput (HOW TO USE THIS???)
00072    bool stackOp;
00073    bool conditionalJump;
00074 
00075    unsigned int opSize; ///< OR'd bits of OperandSize (8/16/32/64)
00076    unsigned int allowedDataDirs; ///< OR'd bits of DataDirection types
00077    unsigned long long totalOccurs; ///< accumulated total occurs from i-mix file
00078    unsigned int memLatency; ///< Memory latency (not used??)
00079    unsigned int throughputNum; ///< Throughput (HOW TO USE THIS???)
00080    double toUseHistogram[HISTOGRAMSIZE]; ///< Dependence histogram
00081    class InstructionInfo *next;  ///< List ptr
00082 };
00083 
00084 #endif

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