All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mapping_info.h
Go to the documentation of this file.
1 #ifndef PORT_MAPPING_CACHE_H_INCLUDED_
2 #define PORT_MAPPING_CACHE_H_INCLUDED_
3 
4 #include <unordered_map>
5 
6 #include "rose.h"
7 
8 #include "instance.h"
9 #include "object.h"
10 #include "instance_tree.h"
11 #include "path_instance_mapper.h"
12 
13 namespace risc {
14 class Socket;
15 class Instance;
16 class Object;
17 class Design;
18 
19 struct pairhash {
20 public:
21  template <typename T, typename U>
22  std::size_t operator()(const std::pair<T, U> &x) const
23  {
24  return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
25  }
26 };
27 
31 class MappingInfo {
32 
33 public:
34  MappingInfo();
35 
43  /*std::unordered_map<int,
44  std::unordered_map<SgVariableDefinition*,
45  std::pair<risc::InstanceTree,
46  int> > > mapping_;*/
47  typedef std::unordered_map< std::pair<int, SgSymbol*>,
48  std::pair<risc::InstanceTree,int>,
55  void initialize(PathInstanceMapper *path_instance_mapper);
56 
57  void print();
58 
62  std::list<std::pair<int, InstanceTree>>
63  get_mapped_module(int channel_id, SgClassDefinition *channel_definition);
64 
65  typedef std::unordered_map<std::pair<int, SgVariableDefinition*> , risc::InstanceTree, pairhash> TreeMap;
68 
69 
70 
71 private:
73 };
74 
75 }; // end of namespace risc
76 
77 #endif /* PORT_MAPPING_CACHE_H_INCLUDED_ */
Definition: instance_tree.h:15
MappingInfo()
Definition: mapping_info.cpp:20
std::list< std::pair< int, InstanceTree > > get_mapped_module(int channel_id, SgClassDefinition *channel_definition)
This returns for a given channel instance the mapped modules.
Definition: mapping_info.cpp:733
void print()
Definition: mapping_info.cpp:712
This class can be used as a lookup table between an instance id of a module or hierarchical channel a...
Definition: path_instance_mapper.h:13
Definition: mapping_info.h:19
bool is_initialized_
Definition: mapping_info.h:72
std::unordered_map< std::pair< int, SgSymbol * >, std::pair< risc::InstanceTree, int >, pairhash > Mapping_
This maps stores the mapping for ports to channels (instance id of the module where the port is decla...
Definition: mapping_info.h:49
TreeMap inst_tree_mapping
Definition: mapping_info.h:66
std::unordered_map< std::pair< int, SgVariableDefinition * >, risc::InstanceTree, pairhash > TreeMap
Definition: mapping_info.h:65
Mapping_ mapping_
Definition: mapping_info.h:50
void initialize(PathInstanceMapper *path_instance_mapper)
This function initializes the mapping.
Definition: mapping_info.cpp:24
TreeMap backward_inst_tree_mapping
Definition: mapping_info.h:67
Definition: mapping_info.h:31
std::size_t operator()(const std::pair< T, U > &x) const
Definition: mapping_info.h:22