source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_interface_map.cpp @ 75

Last change on this file since 75 was 75, checked in by rosiere, 16 years ago

Update all component (except front_end) to :

  • new statistics model
  • no namespace std
File size: 2.1 KB
Line 
1#ifdef POSITION
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/include/Component.h"
10
11namespace morpheo              {
12namespace behavioural          {
13
14#undef  FUNCTION
15#define FUNCTION "Component::interface_map"
16  void Component::interface_map (std::string component_src ,
17                                 std::string port_src      ,
18                                 std::string component_dest,
19                                 std::string port_dest     )
20  {
21    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
22
23    // First entity
24    Entity * entity_dest = find_entity(component_dest);
25
26    std::string name_entity = _entity->get_name();
27
28    if (entity_dest == NULL)
29      throw (ErrorMorpheo ("<Component::interface_map> Component \""+name_entity+"\", port map with unknow component \""+component_dest+"\"."));
30
31    bool is_top_level_dest = (name_entity == component_dest);
32
33    Interface * interface_dest = entity_dest->find_interface(port_dest);
34   
35    if (interface_dest == NULL)
36      throw (ErrorMorpheo ("<Component::interface_map> Component \""+name_entity+"\", port map with component \""+component_dest+"\" and a unknow interface \""+port_dest+"\"."));
37
38    // Second entity
39    Entity * entity_src = find_entity(component_src);
40
41    if (entity_src == NULL)
42      throw (ErrorMorpheo ("<Component::interface_map> Component \""+name_entity+"\", port map with unknow component \""+component_src+"\"."));
43
44    bool is_top_level_src = (name_entity == component_src);
45
46    Interface * interface_src = entity_src->find_interface(port_src);
47
48    if (interface_src == NULL)
49      throw (ErrorMorpheo ("<Component::interface_map> Component \""+name_entity+"\", port map with component \""+component_src+"\" and a unknow interface \""+port_src+"\"."));
50
51    // all is ok - link
52    if (is_top_level_dest == false)
53      interface_dest->interface_map(static_cast<void *>(entity_src   ),
54                                    static_cast<void *>(interface_src));
55   
56    if (is_top_level_src == false)
57      interface_src->interface_map(static_cast<void *>(entity_dest   ),
58                                   static_cast<void *>(interface_dest));
59 
60    log_printf(FUNC,Behavioural,FUNCTION,"End");
61  };
62
63}; // end namespace behavioural         
64}; // end namespace morpheo             
65#endif
Note: See TracBrowser for help on using the repository browser.