00001 /* 00002 * ===================================================================================== 00003 * 00004 * Filename: genericTracePktGen.h 00005 * 00006 * Description: Used to inject traces from a cycle accurate simulator into 00007 * iris as network traffic. 00008 * Does have some additional queues for mshr modelling which a genericTPG 00009 * does not need. TODO: Remove mshr modelling. 00010 * 00011 * Version: 1.0 00012 * Created: 10/19/2010 01:44:00 PM 00013 * Revision: none 00014 * Compiler: gcc 00015 * 00016 * Author: Mitchelle Rasquinha (), mitchelle.rasquinha@gatech.edu 00017 * Company: Georgia Institute of Technology 00018 * 00019 * ===================================================================================== 00020 */ 00021 00022 #ifndef _genericTracePktGen_h_INC 00023 #define _genericTracePktGen_h_INC 00024 00025 #include "genericInterfaceNB.h" 00026 #include "../../../util/genericData.h" 00027 #include "../interfaces/processor.h" 00028 #include "../../data_types/impl/highLevelPacket.h" 00029 #include "../../../memctrl/request.h" 00030 #include "../../../memctrl/mshr.h" 00031 #include "../../../util/mc_constants.h" 00032 #include <math.h> 00033 #include <fstream> 00034 #include <deque> 00035 #include <string.h> 00036 00037 #define DEFAULT_RAN_MAX_TIME 100 00038 #define MAX_ADDRESS 3 00039 00040 extern uint no_nodes; 00041 extern uint no_mcs; 00042 00043 class GenericTracePktGen : public Processor 00044 { 00045 00046 private: 00047 uint vcs; 00048 uint no_nodes; 00049 uint no_outstanding; 00050 ullint max_sim_time; 00051 deque< HighLevelPacket > out_packets; 00052 deque< HighLevelPacket > sent_packets; 00053 string out_filename; 00054 string trace_name; 00055 ofstream out_file; 00056 ifstream *trace_filename; 00057 unsigned int last_vc; 00058 Request* GetNextRequest(); 00059 bool GetNewRequest(Request *req); 00060 Request* GetRequest(); 00061 void convertToBitStream(Request* req, HighLevelPacket* hlp); 00062 void convertFromBitStream(Request* req, HighLevelPacket *hlp); 00063 void handle_new_packet_event(IrisEvent* e); 00064 void handle_ready_event(IrisEvent* e); 00065 void handle_out_pull_event(IrisEvent* e); 00066 00067 public : 00068 GenericTracePktGen(); 00069 ~GenericTracePktGen(); 00070 /* stats variables */ 00071 unsigned int packets; 00072 unsigned int packets_in; 00073 double min_pkt_latency; 00074 double last_packet_out_cycle; 00075 ullint fwd_path_delay; 00076 ullint roundTripLat; 00077 ullint TotalBLP; 00078 ullint stat_round_trip_network_latency; 00079 ullint stat_round_trip_hop_count; 00080 ullint stat_round_trip_memory_latency; 00081 ullint stat_waiting_in_ni; 00082 00083 MSHR_H *mshrHandler; 00084 vector< bool > ready; 00085 bool sending; 00086 ullint max_time; 00087 void setup(uint no_nodes, uint vcs, uint max_sim_time); 00088 void finish(); 00089 void process_event(IrisEvent* e); 00090 string toString() const; 00091 string print_stats() const; 00092 void set_trace_filename( string filename ); 00093 void set_no_vcs ( uint v ); 00094 void set_output_path( string outpath ); 00095 bool compare(); 00096 vector <uint> mc_node_ip; 00097 ullint lastSentTime; 00098 }; 00099 00100 00101 00102 #endif /* ----- #ifndef _genericTracePktGen_h_INC ----- */ 00103