source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_test_map.cpp @ 144

Last change on this file since 144 was 144, checked in by rosiere, 14 years ago

1) compatible gcc 4.4.3
2) Translation file in MORPHEO_PREFIX directory

  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
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"
9#include "Common/include/Tabulation.h"
10
11namespace morpheo              {
12namespace 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      {//BURP : ajoue de la parenthÚse ...
43        if (top_level == true)
44          {
45            switch (_direction)
46              {
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;
89              }
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)
98              {
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;
142              }
143          }
144      }
145
146    if (_return == false)
147      {
148        msgError("%s\n",str.c_str());
149      }
150    else
151      {
152//      log_printf(INFO,Interface,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),signame.c_str());
153      }
154
155    log_printf(FUNC,Behavioural,FUNCTION,"End");
156   
157    return _return;
158  };
159
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 = "";
167//     std::string tab = tab(depth);
168//     bool _return = true;
169
170   
171
172//     if (_return == false)
173//       {
174//      log_printf(INFO,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
175       
176// #ifndef DEBUG
177//      std::cerr << str << std::endl;
178// #endif
179//       }
180//     else
181//       {
182// //   log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),signame.c_str());
183//       }
184   
185//     return _return;
186//   };
187
188}; // end namespace behavioural         
189}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.