00001 00020 #ifndef _genericflatmc_h_INC 00021 #define _genericflatmc_h_INC 00022 00023 #include "genericInterfaceNB.h" 00024 #include "../../../util/genericData.h" 00025 #include "../interfaces/processor.h" 00026 #include "../../data_types/impl/highLevelPacket.h" 00027 #include "../../../memctrl/request.h" 00028 #include <fstream> 00029 #include <deque> 00030 00031 #define DEFAULT_RAN_MAX_TIME 100 00032 #define MAX_ADDRESS 3 00033 //#define MAX(a,b) (((a)<(b))?(b):(a)) 00034 //#define MIN(a,b) (((a)<(b))?(a):(b)) 00035 00036 using namespace std; 00037 00038 extern uint mc_response_pkt_payload_length; 00039 00040 class GenericFlatMc : public Processor 00041 { 00042 00043 private: 00044 uint vcs; 00045 uint no_nodes; 00046 unsigned long long int max_sim_time; 00047 ullint last_packet_in_cycle; 00048 ullint last_packet_out_cycle; 00049 ullint packets_in; 00050 deque< HighLevelPacket > out_packets; 00051 string out_filename; 00052 ofstream out_file; 00053 vector< bool > ready; 00054 bool sending; 00055 void handle_new_packet_event(IrisEvent* e); 00056 void handle_ready_event(IrisEvent* e); 00057 void handle_out_pull_event(IrisEvent* e); 00058 void convertFromBitStream(Request* req, HighLevelPacket *hlp); 00059 long int packets_pending; 00060 deque <unsigned long long int> pending_packets_time; 00061 deque <HighLevelPacket*> pending_packets; 00062 00063 public : 00064 GenericFlatMc(); 00065 ~GenericFlatMc(); 00066 00067 /* stats variables */ 00068 unsigned int packets; 00069 ullint packets_out; 00070 uint last_vc; 00071 double min_pkt_latency; 00072 unsigned long long int waiting_at_injection; 00073 00074 unsigned long long int max_time; 00075 void setup(uint no_nodes, uint vcs, uint max_sim_time); 00076 void finish(); 00077 void process_event(IrisEvent* e); 00078 string toString() const; 00079 string print_stats() const; 00080 void set_output_path( string outpath ); 00081 vector <uint> mc_node_ip; 00082 HighLevelPacket* outstanding_hlp; 00083 }; 00084 00085 00086 00087 #endif /* ----- #ifndef _genericflatmc_h_INC ----- */ 00088