[31] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
[42] | 8 | #include "Behavioural/include/Component.h" |
---|
[31] | 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | |
---|
[43] | 13 | #undef FUNCTION |
---|
| 14 | #define FUNCTION "Component::port_map" |
---|
[42] | 15 | void Component::port_map (string component_src , |
---|
| 16 | string port_src , |
---|
| 17 | string component_dest, |
---|
| 18 | string port_dest ) |
---|
[31] | 19 | { |
---|
[43] | 20 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
| 21 | |
---|
[42] | 22 | string name_entity = _entity->get_name(); |
---|
[31] | 23 | |
---|
[42] | 24 | // First entity |
---|
| 25 | Entity * entity_dest = find_entity(component_dest); |
---|
[31] | 26 | |
---|
[42] | 27 | if (entity_dest == NULL) |
---|
[43] | 28 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with unknow component \""+component_dest+"\".")); |
---|
[31] | 29 | |
---|
[42] | 30 | Signal * signal_dest = entity_dest->find_signal (port_dest); |
---|
[31] | 31 | |
---|
[42] | 32 | if (signal_dest == NULL) |
---|
[43] | 33 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with component \""+component_dest+"\" and a unknow signal \""+port_dest+"\".")); |
---|
[31] | 34 | |
---|
[42] | 35 | // Second entity |
---|
| 36 | Entity * entity_src = find_entity(component_src); |
---|
[31] | 37 | |
---|
[42] | 38 | if (entity_src == NULL) |
---|
[43] | 39 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with unknow component \""+component_src+"\".")); |
---|
[31] | 40 | |
---|
[42] | 41 | Signal * signal_src = entity_src->find_signal (port_src); |
---|
[31] | 42 | |
---|
[42] | 43 | if (signal_src == NULL) |
---|
[43] | 44 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with component \""+component_src+"\" and a unknow signal \""+port_src+"\".")); |
---|
[31] | 45 | |
---|
[42] | 46 | // If all is ok, mapping |
---|
[44] | 47 | log_printf(TRACE,Behavioural,FUNCTION, "Signal \"%s.%s\"\tlink with \"%s.%s\"" |
---|
| 48 | ,entity_src ->get_name().c_str() |
---|
| 49 | ,signal_src ->get_name().c_str() |
---|
| 50 | ,entity_dest->get_name().c_str() |
---|
| 51 | ,signal_dest->get_name().c_str()); |
---|
[43] | 52 | |
---|
[44] | 53 | signal_src ->link (signal_dest, entity_dest == _entity); |
---|
[43] | 54 | //signal_dest->mapping(signal_src ); |
---|
| 55 | |
---|
| 56 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
[31] | 57 | }; |
---|
| 58 | |
---|
| 59 | }; // end namespace behavioural |
---|
| 60 | }; // end namespace morpheo |
---|