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

Last change on this file since 94 was 94, checked in by rosiere, 15 years ago

Update document on Vhdl generation.

  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
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"
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 (uint32_t depth, bool top_level, bool is_behavioural)
17  {
18    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
19
20    std::string str     = "";
21    std::string tab     = morpheo::tab(depth);
22    bool        _return = true;
23
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(),
26//             _is_map_as_toplevel_dest,
27//             _is_map_as_component_src,
28//             _is_map_as_component_dest);
29//     log_printf(INFO,Behavioural,FUNCTION, "%stop_level %d, is_behavioural %d",tab.c_str(),
30//             top_level,
31//             is_behavioural);
32
33    // behavioural | top_level
34    //-------------+-----------
35    // 0           | 0         -
36    // 0           | 1         -
37    // 1           | 0         -
38    // 1           | 1         -
39
40    if (not (is_behavioural and top_level))
41      if (top_level == true)
42        {
43          switch (_direction)
44            {
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;
87            }
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)
96            {
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;
140            }
141        }
142
143    if (_return == false)
144      {
145#ifndef DEBUG
146        std::cerr << str << std::endl;
147#else
148        log_printf(INFO,Interface,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
149#endif
150      }
151    else
152      {
153//      log_printf(INFO,Interface,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());
154      }
155
156    log_printf(FUNC,Behavioural,FUNCTION,"End");
157   
158    return _return;
159  };
160
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 = "";
168//     std::string tab = tab(depth);
169//     bool _return = true;
170
171   
172
173//     if (_return == false)
174//       {
175//      log_printf(INFO,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
176       
177// #ifndef DEBUG
178//      std::cerr << str << std::endl;
179// #endif
180//       }
181//     else
182//       {
183// //   log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());
184//       }
185   
186//     return _return;
187//   };
188
189}; // end namespace behavioural         
190}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.