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

sst/elements/mcopteron/LoadStoreUnit.h

00001 
00002 #ifndef LOADSTOREUNIT_H
00003 #define LOADSTOREUNIT_H
00004 
00005 #include <OpteronDefs.h>
00006 #include <OffCpuIF.h>
00007 
00008 class Token;
00009 class MemoryModel;
00010 
00011 /// @brief Load Store Unit model
00012 ///
00013 /// This class is responsible for simulating the load-store queue.
00014 /// It keeps track of instructions in the LSQ, calls to the memory
00015 /// module to get the cycles needed to serve the instruction's memop
00016 /// once an address is available, and notify's instructions with a load
00017 /// that the load is satisfied. We don't do any actual address tracking
00018 /// so it does not do an store-load forwarding, but relies on the 
00019 /// probabilities given to the memory model to take care of that.
00020 ///
00021 class LoadStoreUnit
00022 {
00023  public:
00024    LoadStoreUnit(unsigned int numSlots, unsigned int maxOpsPerCycle,
00025                  MemoryModel *memModel, OffCpuIF *extIF);
00026    ~LoadStoreUnit();
00027    unsigned int add(Token *token, CycleCount atCycle);
00028    void updateStatus(CycleCount currentCycle);
00029  private:
00030    unsigned int addLoad(Token *token, CycleCount atCycle);
00031    unsigned int addStore(Token *token, CycleCount atCycle);
00032    enum LSType { EMPTY, LOAD, STORE }; // TODO: handle load and store?
00033    /// Slot record
00034    struct LSSlot {
00035       Token *token;
00036       LSType type;
00037       CycleCount startCycle;
00038       CycleCount satisfiedCycle;
00039    };
00040    LSSlot *slots;                   ///< Instantiated array of LS slots
00041    unsigned int numSlots;           ///< Total number of slots
00042    unsigned int numFilled;          ///< Number of slots currently occupied
00043    unsigned int maxMemOpsPerCycle;  ///< Max number of memory ops per cycle
00044    unsigned long long fullStalls;   ///< Statistic: number of stalls due to full buffer
00045    MemoryModel *memoryModel;        ///< Ptr to memory model object
00046    OffCpuIF *externalIF;
00047 };
00048 
00049 #endif

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