00001 /* 00002 * ===================================================================================== 00003 * 00004 * Filename: mcFrontEnd.h 00005 * 00006 * Description: This is the interface to connect to the memory controller 00007 * module. 00008 * 00009 * Version: 1.0 00010 * Created: 03/11/2010 05:00:00 PM 00011 * Revision: none 00012 * Compiler: gcc 00013 * 00014 * Author: Mitchelle Rasquinha (), mitchelle.rasquinha@gatech.edu 00015 * Company: Georgia Institute of Technology 00016 * 00017 * ===================================================================================== 00018 */ 00019 00020 #ifndef _mcFrontEnd_h_INC 00021 #define _mcFrontEnd_h_INC 00022 00023 #include "../interfaces/processor.h" 00024 #include "../../data_types/impl/highLevelPacket.h" 00025 #include "../../data_types/impl/irisEvent.h" 00026 #include "../../../util/genericData.h" 00027 #include "../../../util/mc_constants.h" 00028 #include "../../../memctrl/request.h" 00029 #include "../../../memctrl/mshr.h" 00030 #include <fstream> 00031 #include <algorithm> 00032 00033 #define DEFAULT_RAN_MAX_TIME 100 00034 extern uint MC_ADDR_BITS; 00035 extern uint no_mcs; 00036 extern vector <uint> mc_positions; 00037 00038 using namespace std; 00039 00040 class McFrontEnd : public Processor 00041 { 00042 public: 00043 McFrontEnd (); /* constructor */ 00044 ~McFrontEnd (); 00045 Component* mc; 00046 vector<Request> niQueue; 00047 void setup(uint no_nodes, uint vcs, uint max_sim_time); 00048 void finish(); 00049 void process_event(IrisEvent* e); 00050 string toString() const; 00051 uint node_ip; 00052 void set_no_vcs ( uint v ); 00053 void set_output_path( string v ); 00054 bool compare(); 00055 string print_stats() const; 00056 bool sending; 00057 00058 protected: 00059 00060 private: 00061 double last_pkt_out_cycle; 00062 ullint last_out_pull_cycle; 00063 unsigned long long int total_missed_time; 00064 unsigned long long int total_backward_time; 00065 uint missed_time; 00066 unsigned long long int packets_out; 00067 ullint resp_buff_occ_cycles; 00068 ullint avg_resp_buff_occ; 00069 00070 uint vcs; 00071 uint no_nodes; 00072 unsigned int packets; 00073 unsigned long long int max_sim_time; 00074 deque< HighLevelPacket > out_packets; 00075 deque< HighLevelPacket > sent_packets; 00076 vector <HighLevelPacket*> outstanding_hlp; 00077 string out_filename; 00078 string trace_name; 00079 ofstream out_file; 00080 fstream trace_filename; 00081 vector< bool > ready; 00082 unsigned int last_vc; 00083 unsigned int flast_vc; 00084 void handle_new_packet_event( IrisEvent* e); 00085 void handle_old_packet_event( IrisEvent* e); 00086 void handle_ready_event(IrisEvent* e); 00087 void handle_out_pull_event(IrisEvent* e); 00088 void handle_detect_deadlock_event(IrisEvent*); 00089 void convertToBitStream(Request* req, HighLevelPacket *hlp); 00090 void convertFromBitStream(Request* req, HighLevelPacket *hlp); 00091 bool GetFrommcFrontEndQueue(Request* req); 00092 void add_mc_bits(Request *req); 00093 void strip_mc_bits(Request *req); 00094 }; /* ----- end of class mcFrontEnd ----- */ 00095 00096 #endif /* ----- #ifndef _mcFrontEnd_h_INC ----- */