00001 /* 00002 * ===================================================================================== 00003 * 00004 * Filename: genericRouterVct.h 00005 * 00006 * Description: 00007 * 00008 * Version: 1.0 00009 * Created: 03/11/2010 08:56:06 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 _genericRouter4Stg_h_INC 00020 #define _genericRouter4Stg_h_INC 00021 00022 #include "../interfaces/router.h" 00023 #include "genericBuffer.h" 00024 #include "genericRC.h" 00025 //#include "pvtopv_swa.h" 00026 #include "genericVcAllocator.h" 00027 #include "ptopSwaVcs.h" 00028 #include "genericCrossbar.h" 00029 #include "genericEvents.h" 00030 #include "../../../util/genericData.h" 00031 #include "../../../util/stats.h" 00032 #include "genericLink.h" 00033 #include <sys/time.h> 00034 #include <algorithm> 00035 00036 extern uint send_early_credit; 00037 extern uint stat_print_level; 00038 extern uint do_two_stage_router; 00039 extern void print_state_at_deadlock(void); 00040 extern IrisStats* istat; 00041 00067 class GenericRouter4Stg: public Router 00068 { 00069 public: 00070 GenericRouter4Stg (); 00071 ~GenericRouter4Stg(); 00072 void init(uint ports, uint vcs, uint credits, uint buffer_size); 00076 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 // uint get_credits_for(uint op); 00086 string toString() const; 00087 string print_stats(); 00088 void set_edge_links(); 00089 vector< vector<uint> > downstream_credits; 00090 void dump_buffer_state(); 00091 00093 uint packets; 00094 uint flits; 00095 double total_packet_latency; 00096 double last_flit_out_cycle; 00097 unsigned long long int stat_sim_total_time; 00098 vector< vector<uint> > stat_packet_out; 00099 vector< vector<uint> > stat_flit_out; 00100 bool is_mc_router; 00101 00102 protected: 00103 00104 private: 00105 vector <GenericBuffer> in_buffers; 00106 vector <GenericRC> decoders; 00107 vector <InputBufferState> input_buffer_state; 00108 GenericVcAllocator vca; 00109 PToPSwitchArbiterVcs swa; 00110 GenericCrossbar xbar; 00111 vector <uint> available_ports; 00112 vector <uint> available_vcs; 00113 vector < vector<uint> > cr_time; 00114 00115 bool ticking; 00116 void handle_link_arrival_event(IrisEvent* e); 00117 void handle_tick_event(IrisEvent* e); 00118 void handle_detect_deadlock_event(IrisEvent*); 00119 void do_switch_traversal(); 00120 void do_switch_allocation(); 00121 00122 }; /* ----- end of class GenericRouter4Stg ----- */ 00123 00124 #endif /* ----- #ifndef _genericRouter4Stg_h_INC ----- */ 00125