00001 00002 #ifndef _genericsink_h_INC 00003 #define _genericsink_h_INC 00004 #include "../interfaces/processor.h" 00005 #include "../../data_types/impl/highLevelPacket.h" 00006 #include "../../../util/genericData.h" 00007 #include "genericInterfaceNB.h" 00008 #include <deque> 00009 #include <fstream> 00010 00011 using namespace std; 00012 00013 /* 00014 * ===================================================================================== 00015 * Class: GenericSink 00016 * Description: 00017 * ===================================================================================== 00018 */ 00019 class GenericSink : public Processor 00020 { 00021 private: 00022 uint vcs; 00023 uint no_nodes; 00024 ullint max_sim_time; 00025 string out_filename; 00026 uint last_vc; 00027 /* stats variables */ 00028 unsigned int stat_packets_in; 00029 double stat_min_pkt_latency; 00030 ullint stat_last_packet_in_cycle; 00031 ullint stat_last_packet_out_cycle; 00032 ullint stat_total_lat; 00033 ullint stat_hop_count; 00034 ullint stat_packets_out; 00035 00036 //Event handlers 00037 void handle_new_packet_event( IrisEvent* e); 00038 void handle_ready_event( IrisEvent* e); 00039 void handle_out_pull_event( IrisEvent* e); 00040 public: 00041 GenericSink (); /* constructor */ 00042 void setup(uint v, uint time, uint no_nodes); 00043 void process_event(IrisEvent* e); 00044 string toString() const; 00045 string print_stats() const; 00046 ofstream out_file; 00047 uint address; 00048 vector<bool> ready; 00049 unsigned int packets; 00050 bool sending; 00051 void set_output_path( string outpath ); 00052 00053 protected: 00054 00055 00056 }; /* ----- end of class GenericSink ----- */ 00057 00058 00059 #endif /* ----- #ifndef -genericsink_h_INC ----- */