00001 00002 #ifndef _genericrpg_h_INC 00003 #define _genericrpg_h_INC 00004 00005 #include "../../randomNumbers/impl/libRandom.hpp" 00006 00007 #include "../interfaces/processor.h" 00008 #include "genericInterface.h" 00009 #include "genericData.h" 00010 #include <fstream> 00011 #include <deque> 00012 00013 #ifndef IN_OUT_MISMATCH 00014 #define IN_OUT_MISMATCH -1 00015 #endif 00016 00017 #ifndef SIM_SUCCESS 00018 #define SIM_SUCCESS 0 00019 #endif 00020 00021 #ifdef REPORT_BASE 00022 #undef REPORT_BASE 00023 #endif 00024 00025 #define REPORT_BASE 20 00026 00027 #define DEFAULT_RAN_LAMDA 2.35 00028 #define DEFAULT_RAN_DESTINATION_TYPE "uniform" 00029 #define DEFAULT_RAN_LENGTH_TYPE "uniform" 00030 #define DEFAULT_RAN_ADDRESS 0 00031 #define MAX_ADDRESS 3 00032 #define MAX_LENGTH 10 00033 #define MIN_LENGTH 1 00034 #define MIN_DELAY 1 00035 #define MAX_DELAY 100 00036 #define DEFAULT_RAN_MAX_VC 1 00037 #define DEFAULT_RAN_SEED 324986 00038 #define DEFAULT_RAN_MAX_TIME 100 00039 #define HOT_SPOTS 3 00040 #define DEFAULT_RAN_TRACE_FILE_NAME "randomOut.tr" 00041 const string run_destination_type = "uniform"; 00042 #define MAX(a,b) (((a)<(b))?(b):(a)) 00043 #define MIN(a,b) (((a)<(b))?(a):(b)) 00044 00045 class GenericRPG : public Processor 00046 { 00047 00048 private: 00049 deque< HighLevelPacket > out_packets; 00050 deque< HighLevelPacket > sent_packets; 00051 string out_filename; 00052 uint vcs; 00053 ofstream out_file; 00054 vector< bool > ready; 00055 unsigned int last_vc; 00056 bool only_sink; 00057 bool sending; 00058 void handle_new_packet_event(IrisEvent* e); 00059 void handle_ready_event(IrisEvent* e); 00060 void handle_out_pull_event(IrisEvent* e); 00061 libRandom::randomNumberGenerator generator; 00062 00063 public : 00064 GenericRPG(); 00065 ~GenericRPG(); 00066 /* stats variables */ 00067 unsigned int packets; 00068 uint max_sim_time; 00069 void init_generator(); 00070 double lamda; 00071 libRandom::randomNumberGenerator::distribution destination_type; 00072 libRandom::randomNumberGenerator::distribution length_type; 00073 libRandom::randomNumberGenerator::distribution delay_type; 00074 unsigned int address; 00075 unsigned int max_address; 00076 unsigned int min_length; 00077 unsigned int max_length; 00078 unsigned int min_delay; 00079 unsigned int max_delay; 00080 unsigned int hot_spots; 00081 unsigned long long int max_time; 00082 unsigned int seed; 00083 void setup(uint no_nodes, uint vcs, uint max_sim_time); 00084 void finish(); 00085 void pre_tick(); 00086 void post_tick(); 00087 void idle(); 00088 void process_event(IrisEvent* e); 00089 void set_no_vcs( uint v ); 00090 string toString() const; 00091 bool compare(); 00092 set< HighLevelPacket > get_all_sent(); 00093 set< HighLevelPacket > get_all_recv(); 00094 void init(); 00095 }; 00096 00097 00098 00099 #endif /* ----- #ifndef _genericrpg_h_INC ----- */ 00100