00001 #ifndef MODULE_H_INCLUDED_ 00002 #define MODULE_H_INCLUDED_ 00003 00004 #include<iostream> 00005 #include<string> 00006 #include<vector> 00007 00008 #include"rose.h" 00009 #include "class.h" 00010 00011 namespace risc { 00012 00013 class CThread; 00014 class Function; 00015 class HierarchicalChannelInstance; 00016 class Instance; 00017 class Method; 00018 class Module; 00019 class ModuleInstance; 00020 class Port; 00021 class PrimitiveChannel; 00022 class PrimitiveChannelInstance; 00023 class Thread; 00024 class VariableInstance; 00025 00026 typedef std::pair<Port*, SgBoolValExp*> ResetSignal; 00027 00028 typedef std::vector<CThread*> CThreadVector; 00029 typedef std::vector<Function*> FunctionVector; 00030 typedef std::vector<HierarchicalChannelInstance*> HierarchicalChannelInstanceVector; 00031 typedef std::vector<Method*> MethodVector; 00032 typedef std::vector<Module*> ModuleVector; 00033 typedef std::vector<Module*>::const_iterator ModuleVectorConstIter; 00034 typedef std::vector<Module*>::iterator ModuleVectorIter; 00035 typedef std::vector<ModuleInstance*> ModuleInstanceVector; 00036 typedef std::vector<PrimitiveChannel*> PrimitiveChannelVector; 00037 typedef std::vector<PrimitiveChannelInstance*> PrimitiveChannelInstanceVector; 00038 typedef std::vector<ResetSignal*> ResetSignalVector; 00039 typedef std::vector<Thread*> ThreadVector; 00040 typedef std::vector<VariableInstance*> VariableInstanceVector; 00041 00049 class Module: public Class { 00050 00051 public: 00052 00059 explicit Module(SgClassDefinition *ast_node); 00060 00067 explicit Module(SgClassDefinition *ast_node, Type type); 00068 00069 ~Module(); 00070 00071 /* 00072 * initialization functions 00073 */ 00074 00080 virtual void initialize_functions(); 00081 00082 /* 00083 * helper functions 00084 */ 00085 00089 void print_module_definition(); 00090 00094 void print_hierarchy(unsigned indent_level = 0); 00095 00096 /* 00097 * Vectors module definition elements 00098 */ 00099 00103 ThreadVector threads_; 00104 00108 CThreadVector cthreads_; 00109 00113 MethodVector methods_; 00114 00118 ResetSignalVector reset_signals_; 00119 00123 ResetSignalVector async_reset_signals_; 00124 00129 int instance_counter_; 00130 00135 std::string get_mangled_type_name(); 00136 00141 std::list<Instance*> instances_; 00142 00143 private: 00144 00148 Module(const Module &md); 00149 }; 00150 00151 } // end of namespace risc 00152 00153 #endif /* MODULE_H_INCLUDED_ */ 00154 00155 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */