00001 00024 #ifndef _genericInterfaceNB_h_INC 00025 #define _genericInterfaceNB_h_INC 00026 00027 #include "../../../util/genericData.h" 00028 #include "../../../util/stats.h" 00029 #include "../../data_types/impl/highLevelPacket.h" 00030 #include "../../data_types/impl/irisEvent.h" 00031 #include "../interfaces/interface.h" 00032 #include "../interfaces/networkComponent.h" 00033 #include "../interfaces/processor.h" 00034 #include "../interfaces/buffer.h" 00035 #include "../impl/genericLink.h" 00036 #include "genericBuffer.h" 00037 #include "genericArbiter.h" 00038 #include <queue> 00039 #include <vector> 00040 #include <math.h> 00041 #include <algorithm> 00042 00043 extern uint do_two_stage_router; 00044 extern vector <uint> mc_positions; 00045 extern IrisStats* istat; 00046 00047 using namespace std; 00048 00049 class GenericInterfaceNB : public Interface 00050 { 00051 public: 00052 GenericInterfaceNB(); /* constructor */ 00053 ~GenericInterfaceNB(); /* constructor */ 00054 00055 uint get_no_credits() const; 00056 void set_no_credits( int credits ); 00057 void set_no_vcs ( uint v ); 00058 void set_buffer_size( uint b ); 00059 void setup( uint v, uint cr, uint bs); 00060 00061 string toString() const; 00062 void process_event( IrisEvent* e); 00063 string print_stats(); 00064 ullint get_packets_out(); 00065 ullint get_packets(); 00066 ullint get_flits_out(); 00067 bool is_mc_interface; 00068 00069 protected: 00070 00071 private: 00072 uint vcs; 00073 uint buffer_size; 00074 int credits; 00075 bool in_packet_cleared; 00076 vector <bool> in_packet_complete; 00077 uint flast_vc; 00078 00079 bool ticking; 00080 GenericBuffer out_buffer; 00081 GenericBuffer in_buffer; 00082 GenericArbiter out_arbiter; 00083 vector < int > downstream_credits; 00084 00085 /* The current packet being pushed into the output buffers */ 00086 vector < LowLevelPacket> out_packets; 00087 vector < uint > out_packet_flit_index; 00088 00089 /* The current packet being pulled from the input buffers */ 00090 vector < LowLevelPacket> in_packets; 00091 vector < uint > in_packets_flit_index; 00092 vector < bool> in_packets_valid; 00093 00094 vector < bool > in_ready; 00095 00096 /* event handlers */ 00097 void handle_new_packet_event( IrisEvent* e); 00098 void handle_ready_event( IrisEvent* e); 00099 void handle_tick_event( IrisEvent* e); 00100 void handle_link_arrival( IrisEvent* e); 00101 00102 /* stats */ 00103 ullint flits_in; 00104 ullint packets_in; 00105 ullint flits_out; 00106 ullint packets_out; 00107 ullint total_packets_in_time; 00108 00109 }; /* ----- end of class GenericInterfaceNB ----- */ 00110 00111 #endif /* ----- #ifndef _genericInterfaceNB_h_INC ----- */ 00112 00113