00001 #ifndef DESGIN_H_INCLUDED_ 00002 #define DESGIN_H_INCLUDED_ 00003 00004 #include "rose.h" 00005 00006 #include <vector> 00007 00008 namespace risc { 00009 00010 class Event; 00011 class Function; 00012 class HierarchicalChannel; 00013 class HierarchicalChannelInstance; 00014 class Instance; 00015 class InstanceTree; 00016 class Interface; 00017 class Module; 00018 class PathInstanceMapper; 00019 class PrimitiveChannel; 00020 class PrimitiveChannelInstance; 00021 class Variable; 00022 00023 typedef std::vector<Event*> EventVector; 00024 typedef std::vector<Function*> FunctionVector; 00025 typedef std::vector<HierarchicalChannel*> HierarchicalChannelVector; 00026 typedef std::vector<HierarchicalChannelInstance*> HierarchicalChannelInstanceVector; 00027 typedef std::vector<Instance*> InstanceVector; 00028 typedef std::vector<Interface*> InterfaceVector; 00029 typedef std::vector<Module*> ModuleVector; 00030 typedef std::vector<PrimitiveChannel*> PrimitiveChannelVector; 00031 typedef std::vector<PrimitiveChannelInstance*> PrimitiveChannelInstanceVector; 00032 typedef std::vector<Variable*> VariableVector; 00033 00038 class Design { 00039 00040 public: 00041 00047 explicit Design(int argc, char* argv[]); 00048 ~Design(); 00049 00050 void initialize_port_mapping(); 00051 void initialize_interfaces(); 00052 void initialize_definitions(); 00053 void initialize_top_modules(); 00054 void initialize_global_functions(); 00055 void initialize_global_variables(); 00056 void initialize_path_instance_mapper(); 00057 00058 /* 00059 * Functions to print design properties 00060 */ 00061 void print_all_class_definitions(); 00062 void print_all_global_functions(); 00063 void print_design(); 00064 00065 /* 00066 * Interface for the instance tree 00067 */ 00068 InstanceTree get_root(); 00069 00070 /* 00071 * Containers for the different design elements 00072 */ 00073 ModuleVector module_definitions_; 00074 InstanceVector top_modules_; 00075 PrimitiveChannelVector primitive_channel_; 00076 HierarchicalChannelVector hierarchical_channel_; 00077 InterfaceVector interfaces_; 00078 00079 /* 00080 * global and sc_main related design stuff 00081 */ 00082 VariableVector global_variables_; 00083 FunctionVector global_functions_; 00084 00085 /* 00086 * Functions to search in design 00087 */ 00088 Module *find_module_definition(SgClassDefinition* cd); 00089 PrimitiveChannel* find_prim_channel_definition(SgClassDefinition* cd); 00090 HierarchicalChannel* find_channel_definition(SgClassDefinition* cd); 00091 Interface *find_interface(SgClassDefinition* cd); 00092 00096 Variable* find_global_variable(SgVariableDefinition* var_def); 00097 00098 /* 00099 * Rose specific elements 00100 */ 00101 SgProject *project_; 00102 00103 /* 00104 * misc 00105 */ 00106 int old_argc_; 00107 char **old_argv_; 00108 00109 std::vector<std::string> input_files_; 00110 00111 PathInstanceMapper *path_instance_mapper_; 00112 00118 void reset_instance_counter(); 00119 00124 std::string dynamic_analysis_filename_; 00125 00130 std::string instrumentor_output_filename_; 00131 00136 bool perform_static_analysis(); 00137 00145 void add_module_to_definition_list(SgClassDefinition *class_def); 00146 00154 void add_hierarchical_channel_to_defintion_list(SgClassDefinition *class_def); 00155 00160 std::string get_design_file_name(); 00161 00162 bool is_analyzable(); 00163 00164 private: 00165 00169 Design(const Design &d); 00170 }; 00171 00172 class GlobalDesign { 00173 public: 00174 static Design *design_static; 00175 }; 00176 Design* get_design(); 00177 SgProject* get_project(); 00178 00179 }; // end namespace risc 00180 00181 #endif /* DESGIN_H_INCLUDED_ */ 00182 00183 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */