00001 00053 #ifndef _genericRouterPhy_h_INC 00054 #define _genericRouterPhy_h_INC 00055 00056 #include "../interfaces/router.h" 00057 #include "genericBuffer.h" 00058 #include "genericRC.h" 00059 #include "ptop_swa.h" 00060 #include "genericCrossbar.h" 00061 #include "../../../util/genericData.h" 00062 #include "../../../util/stats.h" 00063 #include "genericLink.h" 00064 #include <sys/time.h> 00065 00066 extern uint send_early_credit; 00067 extern uint do_two_stage_router; 00068 extern uint stat_print_level; 00069 extern IrisStats* istat; 00070 00071 class GenericRouterPhy: public Router 00072 { 00073 public: 00074 GenericRouterPhy (); /* constructor */ 00075 ~GenericRouterPhy(); 00076 void init(uint ports, uint vcs, uint credits, uint buffer_size); 00077 00078 void set_no_nodes( uint nodes); 00079 void set_grid_x_location ( uint a, uint b, uint c); 00080 void set_grid_y_location ( uint a, uint b, uint c); 00081 00082 void send_credit_back( uint i); 00083 00084 void process_event(IrisEvent* e); 00085 string toString() const; 00086 string print_stats(); 00087 vector< vector<uint> > downstream_credits; 00088 00089 /* These are the statistics variables */ 00090 uint packets; 00091 uint flits; 00092 double total_packet_latency; 00093 double last_flit_out_cycle; 00094 unsigned long long int stat_sim_total_time; 00095 vector< vector<uint> > stat_packet_out; 00096 vector< vector<uint> > stat_flit_out; 00097 00098 protected: 00099 00100 private: 00101 vector <GenericBuffer> in_buffers; 00102 vector <GenericRC> decoders; 00103 vector <InputBufferState> input_buffer_state; 00104 PToPSwitchArbiter swa; 00105 GenericCrossbar xbar; 00106 00107 bool ticking; 00108 void handle_link_arrival_event(IrisEvent* e); 00109 void handle_tick_event(IrisEvent* e); 00110 void do_switch_traversal(); 00111 void do_switch_allocation(); 00112 void do_input_buffering(); 00113 00114 }; /* ----- end of class GenericRouterPhy ----- */ 00115 00116 #endif /* ----- #ifndef _genericRouterPhy_h_INC ----- */ 00117