[62] | 1 | /* |
---|
| 2 | * $Id: Signal_test_map.cpp 144 2010-09-28 11:19:10Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/include/Signal.h" |
---|
[94] | 9 | #include "Common/include/Tabulation.h" |
---|
[62] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | |
---|
| 14 | #undef FUNCTION |
---|
| 15 | #define FUNCTION "Signal::test_map" |
---|
[139] | 16 | bool Signal::test_map (std::string name_interface,bool top_level, bool is_behavioural) |
---|
[62] | 17 | { |
---|
| 18 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
| 19 | |
---|
[139] | 20 | std::string signame = name_interface+"."+_name; |
---|
[82] | 21 | std::string str = ""; |
---|
[139] | 22 | // std::string tab = morpheo::tab(depth); |
---|
[82] | 23 | bool _return = true; |
---|
| 24 | |
---|
[88] | 25 | // log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\"",tab.c_str(),_name.c_str()); |
---|
| 26 | // log_printf(INFO,Behavioural,FUNCTION, "%s%d - %d - %d",tab.c_str(), |
---|
[78] | 27 | // _is_map_as_toplevel_dest, |
---|
| 28 | // _is_map_as_component_src, |
---|
| 29 | // _is_map_as_component_dest); |
---|
[88] | 30 | // log_printf(INFO,Behavioural,FUNCTION, "%stop_level %d, is_behavioural %d",tab.c_str(), |
---|
[82] | 31 | // top_level, |
---|
| 32 | // is_behavioural); |
---|
[62] | 33 | |
---|
[82] | 34 | // behavioural | top_level |
---|
| 35 | //-------------+----------- |
---|
| 36 | // 0 | 0 - |
---|
| 37 | // 0 | 1 - |
---|
| 38 | // 1 | 0 - |
---|
| 39 | // 1 | 1 - |
---|
[78] | 40 | |
---|
[82] | 41 | if (not (is_behavioural and top_level)) |
---|
[144] | 42 | {//BURP : ajoue de la parenthÚse ... |
---|
| 43 | if (top_level == true) |
---|
| 44 | { |
---|
| 45 | switch (_direction) |
---|
[82] | 46 | { |
---|
[144] | 47 | case morpheo::behavioural::IN : |
---|
| 48 | { |
---|
| 49 | if (_is_map_as_toplevel_dest == false) |
---|
| 50 | { |
---|
| 51 | _return = false; |
---|
| 52 | |
---|
| 53 | str = "Signal \""+signame+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
| 54 | } |
---|
| 55 | break; |
---|
| 56 | } |
---|
| 57 | case morpheo::behavioural::OUT : |
---|
| 58 | { |
---|
| 59 | if (_is_map_as_toplevel_dest == false) |
---|
| 60 | { |
---|
| 61 | _return = false; |
---|
| 62 | str = "Signal \""+signame+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
| 63 | } |
---|
| 64 | break; |
---|
| 65 | } |
---|
| 66 | case morpheo::behavioural::INTERNAL : |
---|
| 67 | { |
---|
| 68 | if (_is_map_as_component_src == false) |
---|
| 69 | { |
---|
| 70 | _return = false; |
---|
| 71 | |
---|
| 72 | str = "Internal signal \""+signame+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | if (_is_map_as_component_dest == false) |
---|
| 76 | { |
---|
| 77 | if (_return == false) |
---|
| 78 | str+="\n"; |
---|
| 79 | |
---|
| 80 | _return = false; |
---|
| 81 | |
---|
| 82 | str += "Internal signal \""+signame+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | break; |
---|
| 86 | } |
---|
| 87 | //case morpheo::behavioural::INOUT : |
---|
| 88 | default : break; |
---|
[82] | 89 | } |
---|
[144] | 90 | } |
---|
| 91 | else |
---|
| 92 | { |
---|
| 93 | // internal signal : |
---|
| 94 | // Component --- I/O (as_src) |
---|
| 95 | // Component --- Component (as_src and as_dest) |
---|
| 96 | |
---|
| 97 | switch (_direction) |
---|
[82] | 98 | { |
---|
[144] | 99 | case morpheo::behavioural::IN : |
---|
| 100 | { |
---|
| 101 | if (_is_map_as_component_src == false) |
---|
| 102 | { |
---|
| 103 | _return = false; |
---|
| 104 | |
---|
| 105 | str = "Signal \""+signame+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
| 106 | } |
---|
| 107 | break; |
---|
| 108 | } |
---|
| 109 | case morpheo::behavioural::OUT : |
---|
| 110 | { |
---|
| 111 | if (_is_map_as_component_src == false) |
---|
| 112 | { |
---|
| 113 | _return = false; |
---|
| 114 | |
---|
| 115 | str = "Signal \""+signame+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
| 116 | } |
---|
| 117 | break; |
---|
| 118 | } |
---|
| 119 | case morpheo::behavioural::INTERNAL : |
---|
| 120 | { |
---|
| 121 | if (_is_map_as_component_src == false) |
---|
| 122 | { |
---|
| 123 | _return = false; |
---|
| 124 | |
---|
| 125 | str = "Internal signal \""+signame+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | if (_is_map_as_component_dest == false) |
---|
| 129 | { |
---|
| 130 | if (_return == false) |
---|
| 131 | str+="\n"; |
---|
| 132 | |
---|
| 133 | _return = false; |
---|
| 134 | |
---|
| 135 | str += "Internal signal \""+signame+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | break; |
---|
| 139 | } |
---|
| 140 | //case morpheo::behavioural::INOUT : |
---|
| 141 | default : break; |
---|
[82] | 142 | } |
---|
[144] | 143 | } |
---|
| 144 | } |
---|
[78] | 145 | |
---|
| 146 | if (_return == false) |
---|
| 147 | { |
---|
[139] | 148 | msgError("%s\n",str.c_str()); |
---|
[78] | 149 | } |
---|
| 150 | else |
---|
| 151 | { |
---|
[139] | 152 | // log_printf(INFO,Interface,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),signame.c_str()); |
---|
[78] | 153 | } |
---|
[82] | 154 | |
---|
| 155 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
[62] | 156 | |
---|
| 157 | return _return; |
---|
| 158 | }; |
---|
| 159 | |
---|
[82] | 160 | // #undef FUNCTION |
---|
| 161 | // #define FUNCTION "Signal::test_equi" |
---|
| 162 | // bool Signal::test_equi (uint32_t depth) |
---|
| 163 | // { |
---|
| 164 | // log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
| 165 | |
---|
| 166 | // std::string str = ""; |
---|
[94] | 167 | // std::string tab = tab(depth); |
---|
[82] | 168 | // bool _return = true; |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | // if (_return == false) |
---|
| 173 | // { |
---|
[88] | 174 | // log_printf(INFO,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str()); |
---|
[82] | 175 | |
---|
| 176 | // #ifndef DEBUG |
---|
| 177 | // std::cerr << str << std::endl; |
---|
| 178 | // #endif |
---|
| 179 | // } |
---|
| 180 | // else |
---|
| 181 | // { |
---|
[139] | 182 | // // log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),signame.c_str()); |
---|
[82] | 183 | // } |
---|
| 184 | |
---|
| 185 | // return _return; |
---|
| 186 | // }; |
---|
| 187 | |
---|
[62] | 188 | }; // end namespace behavioural |
---|
| 189 | }; // end namespace morpheo |
---|