- Timestamp:
- Dec 4, 2007, 2:31:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_port_map.cpp
r44 r62 51 51 ,signal_dest->get_name().c_str()); 52 52 53 signal_src ->link (signal_dest, entity_dest == _entity); 54 //signal_dest->mapping(signal_src ); 53 // need an internal signal ? 54 bool src_is_port = entity_src == _entity; 55 bool dest_is_port = entity_dest == _entity; 56 57 if (src_is_port == true) 58 throw (ErrorMorpheo ("<Component::port_map> src can't be an interface's port of the top level.")); 55 59 60 // 2 cases : 61 // a) dest is a top level port -> direct connection 62 // b) dest is a component port -> need internal signal 63 if (dest_is_port == false) 64 { 65 // 1) find productor of signal 66 // 67 // Interface Component 68 // | | 69 // ----> (IN) --X-> (IN) 70 // | | 71 // <-X-- (OUT) <---- (OUT) 72 // | | 73 74 Signal * signal_productor; 75 Entity * entity_productor; 76 77 bool src_is_productor = (signal_src->get_direction() == OUT); 78 79 if (src_is_productor == true) 80 { 81 signal_productor = signal_src; 82 entity_productor = entity_src; 83 } 84 else 85 { 86 signal_productor = signal_dest; 87 entity_productor = entity_dest; 88 } 89 90 signal_dest = signal_internal (entity_productor, signal_productor); 91 dest_is_port = false; 92 } 93 94 try 95 { 96 signal_src->link(signal_dest, 97 dest_is_port); 98 } 99 catch (morpheo::ErrorMorpheo & error) 100 { 101 throw (ErrorMorpheo ("<Component::port_map> Error in mapping between "+entity_src ->get_name()+"."+signal_src ->get_name()+" and "+entity_dest->get_name()+"."+signal_dest->get_name()+" :\n"+error.what ())); 102 } 103 //catch (...) 104 // { 105 // } 106 107 log_printf(FUNC,Behavioural,FUNCTION,"End"); 108 }; 109 110 111 void Component::port_map (string component_src , 112 string port_src ) 113 { 114 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 115 116 Entity * entity_src = find_entity(component_src); 117 118 if (entity_src == NULL) 119 throw (ErrorMorpheo ("<Component::port_map> in component \""+_entity->get_name()+"\", port map with unknow component \""+component_src+"\".")); 120 121 Signal * signal_src = entity_src->find_signal (port_src); 122 123 if (signal_src == NULL) 124 throw (ErrorMorpheo ("<Component::port_map> in component \""+_entity->get_name()+"\", port map with component \""+component_src+"\" and a unknow signal \""+port_src+"\".")); 125 126 // need an internal signal ? 127 128 if (entity_src == _entity) 129 throw (ErrorMorpheo ("<Component::port_map> src can't be an interface's port of the top level.")); 130 131 if (signal_src->get_direction() != OUT) 132 throw (ErrorMorpheo ("<Component::port_map> the direction of the signal '"+signal_src->get_name()+"' must be OUT.")); 133 134 try 135 { 136 signal_src->link(signal_internal (entity_src, signal_src), 137 false); 138 } 139 catch (morpheo::ErrorMorpheo & error) 140 { 141 throw (ErrorMorpheo ("<Component::port_map> Error in mapping "+entity_src ->get_name()+"."+signal_src ->get_name()+" :\n"+error.what ())); 142 } 143 //catch (...) 144 // { 145 // } 146 56 147 log_printf(FUNC,Behavioural,FUNCTION,"End"); 57 148 }; … … 59 150 }; // end namespace behavioural 60 151 }; // end namespace morpheo 152
Note: See TracChangeset
for help on using the changeset viewer.