00001 #ifndef DESGIN_H_INCLUDED_ 00002 #define DESGIN_H_INCLUDED_ 00003 00004 #include "rose.h" 00005 #include "port_mapping_cache.h" 00006 00007 #include <vector> 00008 00009 #define PSG_MODE risc::get_design()->psg_mode 00010 00011 namespace risc { 00012 00013 class Thread; 00014 class Event; 00015 class Function; 00016 class HierarchicalChannel; 00017 class HierarchicalChannelInstance; 00018 class Instance; 00019 class InstanceTree; 00020 class Interface; 00021 class Module; 00022 class PathInstanceMapper; 00023 class PrimitiveChannel; 00024 class PrimitiveChannelInstance; 00025 class Variable; 00026 00027 typedef std::vector<Event*> EventVector; 00028 typedef std::vector<Function*> FunctionVector; 00029 typedef std::vector<HierarchicalChannel*> HierarchicalChannelVector; 00030 typedef std::vector<HierarchicalChannelInstance*> HierarchicalChannelInstanceVector; 00031 typedef std::vector<Instance*> InstanceVector; 00032 typedef std::vector<Interface*> InterfaceVector; 00033 typedef std::vector<Module*> ModuleVector; 00034 typedef std::vector<PrimitiveChannel*> PrimitiveChannelVector; 00035 typedef std::vector<PrimitiveChannelInstance*> PrimitiveChannelInstanceVector; 00036 typedef std::vector<Variable*> VariableVector; 00037 00042 class Design { 00043 00044 public: 00045 00051 explicit Design(int argc, char* argv[], bool is_psg_mode = false); 00052 ~Design(); 00053 00054 void initialize_port_mapping(); 00055 void initialize_interfaces(); 00056 void initialize_definitions(); 00057 void initialize_top_modules(); 00058 void initialize_global_functions(); 00059 void initialize_global_variables(); 00060 void initialize_path_instance_mapper(); 00061 00062 /* 00063 * Functions to print design properties 00064 */ 00065 void print_all_class_definitions(); 00066 void print_all_global_functions(); 00067 void print_design(); 00068 00069 /* 00070 * Interface for the instance tree 00071 */ 00072 InstanceTree get_root(); 00073 00074 /* 00075 * Containers for the different design elements 00076 */ 00077 ModuleVector module_definitions_; 00078 InstanceVector top_modules_; 00079 PrimitiveChannelVector primitive_channel_; 00080 HierarchicalChannelVector hierarchical_channel_; 00081 InterfaceVector interfaces_; 00082 00083 /* 00084 * global and sc_main related design stuff 00085 */ 00086 VariableVector global_variables_; 00087 FunctionVector global_functions_; 00088 00089 /* 00090 * Functions to search in design 00091 */ 00092 Module *find_module_definition(SgClassDefinition* cd); 00093 PrimitiveChannel* find_prim_channel_definition(SgClassDefinition* cd); 00094 HierarchicalChannel* find_channel_definition(SgClassDefinition* cd); 00095 Interface *find_interface(SgClassDefinition* cd); 00096 00100 Variable* find_global_variable(SgVariableDefinition* var_def); 00101 00102 /* 00103 * Rose specific elements 00104 */ 00105 SgProject *project_; 00106 00107 /* 00108 * misc 00109 */ 00110 int old_argc_; 00111 char **old_argv_; 00112 00113 std::vector<std::string> input_files_; 00114 00115 PathInstanceMapper *path_instance_mapper_; 00116 00117 PortMappingCache port_mapping_cache_; 00118 00124 void reset_instance_counter(); 00125 00130 std::string dynamic_analysis_filename_; 00131 00136 std::string instrumentor_output_filename_; 00137 00142 bool perform_static_analysis(); 00143 00151 void add_module_to_definition_list(SgClassDefinition *class_def); 00152 00160 void add_hierarchical_channel_to_defintion_list(SgClassDefinition *class_def); 00161 00166 std::string get_design_file_name(); 00167 00168 bool is_analyzable(); 00169 00170 bool psg_mode; 00171 int psg_count; 00172 std::vector<int> psg_seg_count; 00173 std::vector<Thread*> loaded_threads; 00174 std::vector<Thread*> simulation_threads; 00175 00176 private: 00177 00181 Design(const Design &d); 00182 }; 00183 00184 class GlobalDesign { 00185 public: 00186 static Design *design_static; 00187 }; 00188 Design* get_design(); 00189 SgProject* get_project(); 00190 00191 }; // end namespace risc 00192 00193 #endif /* DESGIN_H_INCLUDED_ */ 00194 00195 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */