00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MAINPROC_H
00014 #define MAINPROC_H
00015
00016 #include "ssb_sim-outorder.h"
00017 #include "FE/pimSysCallTypes.h"
00018 #include "FE/thread.h"
00019 #include "smpProc.h"
00020
00021 class genericNIC;
00022 class thread;
00023 class genericNetwork;
00024 class PIM_NICChip;
00025 class proc;
00026
00027
00028
00029
00030
00031
00032
00033 class mainProc : public convProc {
00034 string confFile;
00035 threadSource *tSource;
00036 processor *myProc;
00037 proc *myP;
00038 public:
00039
00040
00041 protected:
00042
00043 int latToNic;
00044
00045 int mainProcID;
00046
00047
00048
00049
00050
00051
00052 public:
00053 virtual uint64_t getCurrentCycle();
00054 void setClearPipe(bool p) {
00055 clearPipe = p;
00056 }
00057 thread* getThread() const {return thr;}
00058 void setThread(thread *t) {
00059 if (thr && !thr->isDead() && !pipeClear()) {
00060 ERROR("Trying to overwrite a running thread!");
00061 }
00062 thr = t;
00063 if (thr) {
00064 fetch_pred_PC = thr->getStartPC();
00065 thr->assimilate(myProc);
00066 }
00067 }
00068 virtual unsigned getFEBDelay() {return 0;}
00069
00070
00071
00072 int getMainProcID() const {return mainProcID;}
00073 mainProc(string configFile, threadSource &tSource, int maxMMO, processor *p,
00074 int id, map<string,string> prefInit, proc *pp);
00075 virtual void setup();
00076 virtual void finish();
00077
00078 virtual void preTic();
00079 virtual void postTic(){;}
00080
00081 virtual bool spawnToCoProc(const PIM_coProc, thread* t, simRegister);
00082 virtual bool switchAddrMode(PIM_addrMode) {printf("%s:%i (%s) not sup\n",__FILE__,__LINE__,__func__);return 0;}
00083 virtual exceptType writeSpecial(const PIM_cmd, const int nargs,
00084 const uint *args);
00085 virtual exceptType readSpecial(const PIM_cmd, const int nInArgs,
00086 const int nOutArgs, const simRegister *args,
00087 simRegister *rets);
00088
00089
00090 friend class smpProc;
00091 smpProc coher;
00092 virtual void handleCoher(const simAddress a, const enum mem_cmd cmd) {
00093 coher.handleCoher(a, cmd);
00094 }
00095 virtual void noteWrite(const simAddress a) {
00096 coher.noteWrite(a);
00097 }
00098 };
00099
00100 #endif