00001 00019 #ifndef _genericrc_h_INC 00020 #define _genericrc_h_INC 00021 00022 #include "../interfaces/addressDecoder.h" 00023 #include "../../../util/genericData.h" 00024 #include "../../data_types/impl/flit.h" 00025 #include "../../data_types/impl/lowLevelPacket.h" 00026 00027 using namespace std; 00028 00029 extern ROUTING_SCHEME rc_method; 00030 extern uint req_rep; 00031 extern uint grid_size; 00032 extern uint no_nodes; 00033 extern bool do_request_reply_network; 00034 00035 class GenericRC 00036 { 00037 public: 00038 GenericRC (); 00039 ~GenericRC(){} 00040 void push( Flit* f, uint vc ); 00041 uint get_output_port ( uint channel); 00042 uint speculate_port ( Flit* f, uint ch ); 00043 uint speculate_channel ( Flit* f, uint ch ); 00044 uint get_virtual_channel ( uint ch ); 00045 void resize ( uint ch ); 00046 uint get_no_channels (); 00047 uint no_adaptive_ports( uint ch ); 00048 uint no_adaptive_vcs( uint ch ); 00049 bool is_empty(); 00050 string toString() const; 00051 uint node_ip; 00052 uint address; 00053 vector < uint > grid_xloc; 00054 vector < uint > grid_yloc; 00055 00056 protected: 00057 00058 private: 00059 string name; 00060 uint vcs; 00061 uint route_x_y( uint addr ); 00062 void route_torus( HeadFlit* hf ); 00063 void route_ring( HeadFlit* hf ); 00064 void route_negative_first(HeadFlit* hf); 00065 void route_west_first(HeadFlit* hf); 00066 void route_north_last(HeadFlit* hf); 00067 void route_north_last_non_minimal(HeadFlit* hf); 00068 void route_odd_even(HeadFlit* hf); 00069 vector < uint > possible_out_ports; 00070 vector < uint > possible_out_vcs; 00071 00072 /* 00073 * ===================================================================================== 00074 * Class: Address 00075 * Description: 00076 * ===================================================================================== 00077 */ 00078 class Address 00079 { 00080 public: 00081 bool route_valid; 00082 unsigned int channel; 00083 unsigned int out_port; 00084 uint last_adaptive_port; 00085 uint last_vc; 00086 vector < uint > possible_out_ports; 00087 vector < uint > possible_out_vcs; 00088 00089 protected: 00090 00091 private: 00092 00093 }; /* ----- end of class Address ----- */ 00094 vector<Address> addresses; 00095 00096 }; /* ----- end of class GenericRC ----- */ 00097 00098 #endif /* ----- #ifndef _genericrc_h_INC ----- */ 00099