00001 /* 00002 * ===================================================================================== 00003 * 00004 * Filename: flit.h 00005 * 00006 * Description: 00007 * 00008 * Version: 1.0 00009 * Created: 02/18/2010 07:05:11 PM 00010 * Revision: none 00011 * Compiler: gcc 00012 * 00013 * Author: Mitchelle Rasquinha (), mitchelle.rasquinha@gatech.edu 00014 * Company: Georgia Institute of Technology 00015 * 00016 * ===================================================================================== 00017 */ 00018 00019 #ifndef _flit_h_INC 00020 #define _flit_h_INC 00021 00022 #include <vector> 00023 #include <string> 00024 #include <sstream> 00025 #include <math.h> 00026 #include "../../../util/simIrisComponentHeader.h" 00027 #include "../../../kernel/simulator.h" 00028 00029 using namespace std; 00030 00031 enum flit_type { HEAD, BODY, TAIL}; 00032 extern uint max_phy_link_bits; 00033 /* 00034 * ===================================================================================== 00035 * Class: Phit 00036 * Description: 00037 * 00038 * ===================================================================================== 00039 */ 00040 class Phit 00041 { 00042 public: 00043 Phit (); /* constructor */ 00044 ~Phit (); 00045 vector<bool> data; 00046 string toString() const; 00047 00048 protected: 00049 00050 private: 00051 00052 }; /* ----- end of class Phit ----- */ 00053 00054 /* 00055 * ===================================================================================== 00056 * Class: Flit 00057 * Description: 00058 * 00059 * ===================================================================================== 00060 */ 00061 class Flit 00062 { 00063 public: 00064 /* ==================== LIFECYCLE ======================================= */ 00065 Flit (); /* constructor */ 00066 ~Flit (); 00067 vector<Phit*> phits; 00068 void populate_phit_data( vector<bool>* c); 00069 string toString() const; 00070 flit_type type; 00071 uint vc; 00072 bool is_single_flit_pkt; 00073 00074 protected: 00075 00076 private: 00077 00078 }; /* ----- end of class Flit ----- */ 00079 00080 /* 00081 * ===================================================================================== 00082 * Class: HeadFlit 00083 * Description: 00084 * ===================================================================================== 00085 */ 00086 class HeadFlit : public Flit 00087 { 00088 public: 00089 HeadFlit (); /* constructor */ 00090 ~HeadFlit(); 00091 uint src_address; /* Restricting the max number of src to 2^32 */ 00092 uint dst_address; /* 32 bits src addr 32 bits dest addr and 32 bits of transaction id max */ 00093 uint transaction_id; 00094 uint pkt_cnt; /*Number of packets clubbed in this*/ 00095 ullint addr; 00096 message_class msg_class; 00097 uint length; 00098 vector<bool> control_bits; 00099 vector<bool> payload; 00100 /* Two bits for virtual netwrok, two bits for the virtual channel, three bits for the message class. All this comprises a header control bitfield. */ 00101 void populate_head_flit(); 00102 string toString() const; 00103 void route(); 00104 pair<uint, uint> next(); 00105 simTime packet_originated_time; 00106 uint inport; 00107 00108 /* For torus routing */ 00109 bool is_dateline_traversed; 00110 /* Stats variables */ 00111 double avg_network_latency; 00112 unsigned int hop_count; 00113 ullint stat_memory_serviced_time; 00114 ullint req_start_time; 00115 ullint waiting_in_ni; 00116 00117 protected: 00118 00119 private: 00120 00121 }; /* ----- end of class HeadFlit ----- */ 00122 00123 /* 00124 * ===================================================================================== 00125 * Class: BodyFlit 00126 * Description: 00127 * 00128 * ===================================================================================== 00129 */ 00130 class BodyFlit : public Flit 00131 { 00132 public: 00133 BodyFlit (); /* constructor */ 00134 ~BodyFlit (); /* constructor */ 00135 void populate_body_flit(); 00136 vector <bool> bf_data; 00137 std::string toString() const; 00138 00139 protected: 00140 00141 private: 00142 00143 }; /* ----- end of class BodyFlit ----- */ 00144 00145 /* 00146 * ===================================================================================== 00147 * Class: TailFlit 00148 * Description: 00149 * 00150 * ===================================================================================== 00151 */ 00152 class TailFlit : public Flit 00153 { 00154 public: 00155 TailFlit (); /* constructor */ 00156 ~TailFlit (); /* constructor */ 00157 void populate_tail_flit(); 00158 simTime packet_originated_time; 00159 simTime scratch_pad_time; 00160 std::string toString() const; 00161 00162 /* Stats variables */ 00163 double avg_network_latency; 00164 unsigned int hop_count; 00165 00166 protected: 00167 00168 private: 00169 00170 }; /* ----- end of class TailFlit ----- */ 00171 00172 #endif /* ----- #ifndef _flit_h_INC ----- */ 00173