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