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