1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/include/Signal.h" |
---|
9 | |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | |
---|
14 | #undef FUNCTION |
---|
15 | #define FUNCTION "Signal::test_map" |
---|
16 | bool Signal::test_map (uint32_t depth, bool top_level) |
---|
17 | { |
---|
18 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
19 | |
---|
20 | std::string str = ""; |
---|
21 | std::string tab = std::string(depth,'\t'); |
---|
22 | // log_printf(NONE,Behavioural,FUNCTION, "%s* Signal \"%s\"",tab.c_str(),_name.c_str()); |
---|
23 | // log_printf(NONE,Behavioural,FUNCTION, "%s%d - %d - %d",tab.c_str(), |
---|
24 | // _is_map_as_toplevel_dest, |
---|
25 | // _is_map_as_component_src, |
---|
26 | // _is_map_as_component_dest); |
---|
27 | bool _return = true; |
---|
28 | |
---|
29 | if (top_level == true) |
---|
30 | { |
---|
31 | switch (_direction) |
---|
32 | { |
---|
33 | case morpheo::behavioural::IN : |
---|
34 | { |
---|
35 | if (_is_map_as_toplevel_dest == false) |
---|
36 | { |
---|
37 | _return = false; |
---|
38 | |
---|
39 | str = "Signal \""+_name+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
40 | } |
---|
41 | break; |
---|
42 | } |
---|
43 | case morpheo::behavioural::OUT : |
---|
44 | { |
---|
45 | if (_is_map_as_toplevel_dest == false) |
---|
46 | { |
---|
47 | _return = false; |
---|
48 | str = "Signal \""+_name+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
49 | } |
---|
50 | break; |
---|
51 | } |
---|
52 | //case morpheo::behavioural::INTERNAL : |
---|
53 | //case morpheo::behavioural::INOUT : |
---|
54 | default : break; |
---|
55 | } |
---|
56 | } |
---|
57 | else |
---|
58 | { |
---|
59 | // internal signal : |
---|
60 | // Component --- I/O (as_src) |
---|
61 | // Component --- Component (as_src and as_dest) |
---|
62 | |
---|
63 | switch (_direction) |
---|
64 | { |
---|
65 | case morpheo::behavioural::IN : |
---|
66 | { |
---|
67 | if (_is_map_as_component_src == false) |
---|
68 | { |
---|
69 | _return = false; |
---|
70 | |
---|
71 | str = "Signal \""+_name+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
72 | } |
---|
73 | break; |
---|
74 | } |
---|
75 | case morpheo::behavioural::OUT : |
---|
76 | { |
---|
77 | if (_is_map_as_component_src == false) |
---|
78 | { |
---|
79 | _return = false; |
---|
80 | |
---|
81 | str = "Signal \""+_name+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
82 | } |
---|
83 | break; |
---|
84 | } |
---|
85 | case morpheo::behavioural::INTERNAL : |
---|
86 | { |
---|
87 | if (_is_map_as_component_src == false) |
---|
88 | { |
---|
89 | _return = false; |
---|
90 | |
---|
91 | str = "Internal signal \""+_name+"\" is not mapped with an outpout port top-level's interface or a input port component's interface."; |
---|
92 | } |
---|
93 | |
---|
94 | if (_is_map_as_component_dest == false) |
---|
95 | { |
---|
96 | if (_return == false) |
---|
97 | str+="\n"; |
---|
98 | |
---|
99 | _return = false; |
---|
100 | |
---|
101 | str += "Internal signal \""+_name+"\" is not mapped with an input port top-level's interface or a output port component's interface."; |
---|
102 | } |
---|
103 | |
---|
104 | break; |
---|
105 | } |
---|
106 | //case morpheo::behavioural::INOUT : |
---|
107 | default : break; |
---|
108 | } |
---|
109 | } |
---|
110 | |
---|
111 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | if (_return == false) |
---|
116 | { |
---|
117 | log_printf(NONE,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str()); |
---|
118 | |
---|
119 | #ifndef DEBUG |
---|
120 | std::cerr << str << std::endl; |
---|
121 | #endif |
---|
122 | } |
---|
123 | else |
---|
124 | { |
---|
125 | // log_printf(NONE,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str()); |
---|
126 | } |
---|
127 | |
---|
128 | return _return; |
---|
129 | }; |
---|
130 | |
---|
131 | }; // end namespace behavioural |
---|
132 | }; // end namespace morpheo |
---|