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