All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
class.h
Go to the documentation of this file.
1 #ifndef CLASS_H_INCLUDED_
2 #define CLASS_H_INCLUDED_
3 
4 #include <string>
5 #include <vector>
6 
7 #include "rose.h"
8 
9 #include "object.h"
10 #include "definition.h"
11 
12 namespace risc {
13 
14 class Event;
15 class EventAndList;
16 class EventOrList;
17 class Function;
18 class HierarchicalChannelInstance;
19 class InOutPort;
20 class InPort;
21 class Instance;
22 class Module;
23 class ModuleInstance;
24 class OutPort;
25 class Port;
26 class PrimitiveChannelInstance;
27 class Variable;
28 
29 /*TLM 2.0*/
30 class Socket;
31 class InitiatorSocket;
33 
34 typedef std::vector<Event*> EventVector;
35 typedef std::vector<EventAndList*> EventAndListVector;
36 typedef std::vector<EventOrList*> EventOrListVector;
37 typedef std::vector<Function*> FunctionVector;
38 typedef std::vector<HierarchicalChannelInstance*>
40 typedef std::vector<InOutPort*> InOutPortVector;
41 typedef std::vector<InPort*> InPortVector;
42 typedef std::vector<ModuleInstance*> ModuleInstanceVector;
43 typedef std::vector<OutPort*> OutPortVector;
44 typedef std::vector<Port*> PortVector;
45 typedef std::vector<PrimitiveChannelInstance*> PrimitiveChannelInstanceVector;
46 typedef std::vector<Variable*> VariableVector;
47 
48 /*TLM 2.0*/
49 typedef std::vector<Socket*> SocketVector;
50 typedef std::vector<InitiatorSocket*>InitiatorSocketVector;
51 typedef std::vector<TargetSocket*>TargetSocketVector;
52 
53 class Class: public Definition {
54 
55 public:
56 
60  explicit Class(SgClassDefinition *ast_node, Type type);
61 
62  ~Class();
63 
64  virtual void initialize_functions();
65 
70  void initialize_variables();
71 
77  SgFunctionDefinition* get_before_end_of_elaboration_definition();
78 
82  Variable* find_variable(SgVariableDefinition* var_def);
83 
87  Port* find_port(SgVariableDefinition* var_def);
88 
92  Event* find_event(SgVariableDefinition* var_def);
93 
97  EventAndList* find_event_and_list(SgVariableDefinition* var_def);
98 
102  EventOrList* find_event_or_list(SgVariableDefinition* var_def);
103 
107  ModuleInstance* find_module(SgVariableDefinition* var_def);
108 
112  PrimitiveChannelInstance* find_prim_channel(SgVariableDefinition* var_def);
113 
117  HierarchicalChannelInstance* find_hier_channel(SgVariableDefinition* var_def);
118 
123  Instance* find_instance(SgVariableDefinition* var_def);
124 
125  Socket* find_socket(SgVariableDefinition* var_def);
126 
131  TargetSocket* find_target_socket(SgVariableDefinition* var_def);
132 
137  InitiatorSocket* find_initiator_socket(SgVariableDefinition* var_def);
138 
143  SgClassDefinition* get_ast_node();
144 
148  std::string get_name();
149 
154  virtual std::string get_ast_type_name();
155 
160 
165 
170 
175 
180 
185 
190 
195 
200 
206 
212 
217 
222 
228  void initialize_mapping();
229 
236  Module *parent_module, ModuleInstance *sub_module_instance, Port *port);
237 
244  Module *parent_module, ModuleInstance *sub_module_instance, Port *port);
245 
252  Module *parent_module, ModuleInstance *sub_module_instance, Socket *socket);
253 
264  bool has_module_pointers();
265 
271  bool has_channel_pointers();
272 
273  typedef std::set<
274  std::pair<
275  std::list<SgVariableSymbol*>,
276  std::list<SgVariableSymbol*>
277  >
279 
281 
282  bool is_used_;
283 
284 private:
288  Class(const Class &c);
289 };
290 
291 
292 } // end of namespace risc
293 
294 
295 #endif /* CLASS_H_INCLUDED_ */
296 
297 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */
std::vector< InitiatorSocket * > InitiatorSocketVector
Definition: class.h:50
PrimitiveChannelInstanceVector sub_prim_channel_
Vector of primitive channel instances which are declared in this module.
Definition: class.h:205
InPortVector inports_
Vector of inports which are defined in this module.
Definition: class.h:179
Definition: initiatorsocket.h:13
std::set< std::pair< std::list< SgVariableSymbol * >, std::list< SgVariableSymbol * > > > PathMappingType
Definition: class.h:278
Definition: primitive_channel_instance.h:15
ModuleInstanceVector sub_modules_
Vector of module instances which are declared in this module.
Definition: class.h:216
TargetSocket * find_target_socket(SgVariableDefinition *var_def)
find a target socket by it&#39;s ast variable definition
Definition: class.cpp:599
VariableVector variables_
Vector of C++ builtin variables that are declared in the module.
Definition: class.h:174
std::vector< EventOrList * > EventOrListVector
Definition: class.h:36
Definition: targetsocket.h:13
Definition: definition.h:12
Definition: class.h:53
Definition: port.h:11
Variable * find_variable(SgVariableDefinition *var_def)
Find a port by it&#39;s ast variable definition.
Definition: class.cpp:499
Class(SgClassDefinition *ast_node, Type type)
Default constructor.
Definition: class.cpp:29
Event * find_event(SgVariableDefinition *var_def)
Find an event by it&#39;s ast variable definition.
Definition: class.cpp:454
std::vector< Function * > FunctionVector
Definition: class.h:37
Instance * find_instance(SgVariableDefinition *var_def)
find a hier channel/module/ prim channel by it&#39;s ast variable definition
Definition: class.cpp:650
std::vector< ModuleInstance * > ModuleInstanceVector
Definition: class.h:42
bool has_channel_pointers()
This functions returns true if the class has channel member which is declared as a pointer...
Definition: class.cpp:1349
EventOrListVector event_or_lists_
Vector of event or lists which are defined in this module.
Definition: class.h:169
Definition: event.h:12
InitiatorSocketVector initiatorsockets_
Vector of initiator sockets which are defined in this module.
Definition: class.h:194
EventOrList * find_event_or_list(SgVariableDefinition *var_def)
Find an event by it&#39;s ast variable definition.
Definition: class.cpp:484
Definition: socket.h:13
void analyze_socket_mapping(Module *parent_module, ModuleInstance *sub_module_instance, Socket *socket)
This is a helper function for internal use only.
Definition: class.cpp:1120
Definition: event_and_list.h:12
void initialize_variables()
This function searches for all variable declarations in the module definition. The corresponding vari...
Definition: class.cpp:177
std::vector< Variable * > VariableVector
Definition: class.h:46
HierarchicalChannelInstanceVector sub_hier_channel_
Vector of hierarchical channel instances which are declared in this module.
Definition: class.h:211
SgClassDefinition * get_ast_node()
Returns the ast definition of the class.
Definition: class.cpp:160
bool is_used_
Definition: class.h:282
PathMappingType path_mappings
Definition: class.h:280
Definition: event_or_list.h:12
EventAndListVector event_and_lists_
Vector of event and lists which are defined in this module.
Definition: class.h:164
void analyze_port_mapping(Module *parent_module, ModuleInstance *sub_module_instance, Port *port)
This is a helper function for internal use only.
Definition: class.cpp:1188
void analyze_general_mapping()
This is a helper function for internal use only.
Definition: class.cpp:793
std::vector< PrimitiveChannelInstance * > PrimitiveChannelInstanceVector
Definition: class.h:45
std::vector< Port * > PortVector
Definition: class.h:44
InOutPortVector inoutports_
Vector of inoutports which are defined in this module.
Definition: class.h:184
std::string get_name()
returns the name of the module definition
Definition: class.cpp:171
FunctionVector functions_
Vector of functions which are defined in this module.
Definition: class.h:221
Definition: instance.h:17
InitiatorSocket * find_initiator_socket(SgVariableDefinition *var_def)
find an initiator socket by it&#39;s ast variable definition
Definition: class.cpp:616
Definition: hierarchical_channel_instance.h:15
EventAndList * find_event_and_list(SgVariableDefinition *var_def)
Find an event by it&#39;s ast variable definition.
Definition: class.cpp:469
PrimitiveChannelInstance * find_prim_channel(SgVariableDefinition *var_def)
find a prim channel by it&#39;s ast variable definition
Definition: class.cpp:535
This class represents instances.
Definition: module.h:49
std::vector< EventAndList * > EventAndListVector
Definition: class.h:35
TargetSocketVector targetsockets_
Vector of targets sockets which are defined in this module.
Definition: class.h:199
Socket * find_socket(SgVariableDefinition *var_def)
Definition: class.cpp:570
void analyze_port_mapping_style3(Module *parent_module, ModuleInstance *sub_module_instance, Port *port)
This is a helper function for internal use only.
Definition: class.cpp:1240
virtual void initialize_functions()
Definition: class.cpp:128
bool has_module_pointers()
This functions returns true if the class has module member which is declared as a pointer...
Definition: class.cpp:1276
EventVector events_
Vector of events which are defined in this module.
Definition: class.h:159
std::vector< HierarchicalChannelInstance * > HierarchicalChannelInstanceVector
Definition: class.h:39
HierarchicalChannelInstance * find_hier_channel(SgVariableDefinition *var_def)
find a hier channel by it&#39;s ast variable definition
Definition: class.cpp:552
This class represents a instance of a module.
Definition: module_instance.h:27
~Class()
Definition: class.cpp:36
OutPortVector outports_
Vector of outports which are defined in this module.
Definition: class.h:189
void initialize_mapping()
This function analyzes the mapping between a module/channel definition and its children.
Definition: class.cpp:667
std::vector< OutPort * > OutPortVector
Definition: class.h:43
Type
We are using these enums to identify type type of and instance or definition during traversal...
Definition: definition.h:20
std::vector< InPort * > InPortVector
Definition: class.h:41
std::vector< Socket * > SocketVector
Definition: class.h:49
std::vector< TargetSocket * > TargetSocketVector
Definition: class.h:51
std::vector< InOutPort * > InOutPortVector
Definition: class.h:40
ModuleInstance * find_module(SgVariableDefinition *var_def)
Find an module by it&#39;s ast variable definition.
Definition: class.cpp:633
std::vector< Event * > EventVector
Definition: class.h:32
Port * find_port(SgVariableDefinition *var_def)
Find a port by it&#39;s ast variable definition.
Definition: class.cpp:419
virtual std::string get_ast_type_name()
Returns the name of the module type.
Definition: class.cpp:166
SgFunctionDefinition * get_before_end_of_elaboration_definition()
This function return a pointer to the definition of the function before_end_of_elaboration.
Definition: class.cpp:515
This class represents a variable in a module.
Definition: variable.h:22