00001
00002
00003
00004
00005 #ifndef _MACHINE_H_HEAD_
00006 #define _MACHINE_H_HEAD_
00007
00008 #include <new.h>
00009 #include "TinkerKnobs.H"
00010 #include "lego.H"
00011
00012
00013 enum TinkerOpType { INT_OP, FP_OP, MEM_OP, BR_OP, PSUEDO_OP };
00014 enum ResourceStatus { FULL = -2, EMPTY = -99, NOT_FULL = -98, RESERVED = -1 };
00015
00016 #define COPY_OP MEM_OP
00017
00018 class machine
00019 {
00020 public:
00021
00022 const int MaxScheduleLength = 8192;
00023
00024 protected:
00025
00026 knobs *K;
00027
00028 int clustering,
00029 Bypass;
00030
00031 int allocated,
00032 NumClusters,
00033 ClusterWidth;
00034
00035 int BusLatency,
00036 NumBuses,
00037 cluster_width;
00038
00039
00040 int instrsWb,
00041 LastIssueCycle,
00042 LastWritebackCycle;
00043
00044 int totalSlots,
00045 *issueSlots,
00046 (*RRT)[ MaxScheduleLength ],
00047 (*BusRRT)[ MaxScheduleLength ],
00048 *IssueConfigInfo;
00049
00050
00051 legoOp* (*RRTop)[MaxScheduleLength];
00052
00053
00054 void PrintSchedule( int LastCycle );
00055
00056 public:
00057
00058 #define NUM_OPTYPES 4
00059
00060 machine();
00061 machine( knobs * );
00062 ~machine();
00063
00064
00065 void SetKnobs( knobs* Knobs );
00066
00067
00068 ShowParameters( knobs *Knobs );
00069
00070
00071 int GetMaxScheduleLength() { return MaxScheduleLength; }
00072
00073
00074 int GetNumSlots() {return totalSlots;}
00075
00076
00077 void setIssueConfig();
00078 void setBusLatency( int value ) { BusLatency = value; }
00079
00080 void setBypassStatus( int flag ) { Bypass = flag; }
00081 int getBypassStatus() { return Bypass; }
00082
00083
00084 enum TinkerOpType TinkerOptype( int opcode );
00085 enum TinkerOpType TinkerOptype( legoOp *Op );
00086 int opLatency( legoOp *Op );
00087 int opLatency( int opcode );
00088 int isBranchOp( legoOp *Op );
00089 int isStoreOp( legoOp *Op );
00090
00091 int isLoadOp( legoOp *Op );
00092
00093 int isRealOp( legoOp *Op );
00094
00095
00096 void adjustIssueStatus( legoOp *Op, int cycle, int slot );
00097
00098 void resetIssueStatus( int cycle );
00099
00100
00101 void resetIssueStatus( int cycle, int cluster );
00102 void showIssueStatus( int cycle );
00103
00104
00105 enum ResourceStatus checkWbStatus( legoOp *Op ) { return NOT_FULL; }
00106 void adjustWritebackStatus( legoOp *Op, int cycle );
00107
00108
00109 void setWbStatus( int value ) { instrsWb = value; }
00110 int getWbStatus() { return instrsWb; }
00111 void resetWbStatus() { instrsWb = 0; }
00112
00113
00114 void resetMachine();
00115
00116
00117 void printSchedule();
00118 void printSchedule( int Cycle );
00119
00120
00121
00122 void estimateSchedule (double *TotalOps, double *TotalCycles, int assumeDP);
00123
00124 void initialize_lmdes(knobs *Knobs);
00125
00126 };
00127
00128 #endif
00129
00130
00131 double GetSuperblockWeight( legoOp *RRTop, machine *m );