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