source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_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: 3.0 KB
Line 
1/*
2 * $Id: Component_test_map.cpp 94 2008-12-15 11:04:03Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/include/Component.h"
9#include "Common/include/Tabulation.h"
10
11namespace morpheo              {
12namespace behavioural          {
13
14#undef  FUNCTION
15#define FUNCTION "Component::test_map"
16  bool Component::test_map (bool recursive)
17  {
18    log_printf(INFO,Behavioural,FUNCTION, "Test port map and interface.");
19    return test_map (0, recursive);
20  }
21
22  bool Component::test_map (uint32_t depth, bool recursive)
23  {
24    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
25
26    std::string tab  = morpheo::tab(depth);
27    std::string name = _entity->get_name();
28    bool test_ok = true;
29
30    bool is_behavioural = _list_component->empty ();
31    if (is_behavioural)
32      {
33        log_printf(INFO,Interface,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str());
34      }
35    else
36      {
37        log_printf(INFO,Interface,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str());
38      }
39
40   
41    //  log_printf(INFO,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str());
42   
43    test_ok &= _entity->test_map(depth+1,true,is_behavioural);
44   
45    //  log_printf(INFO,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str());
46       
47    for (std::list<Tcomponent_t *>::iterator i= _list_component->begin();
48         i != _list_component->end();
49         ++i)
50      {
51        test_ok &= (*i)->_entity->test_map(depth+1,false,is_behavioural);
52        if (recursive)
53          try 
54            {
55              test_ok &= (*i)->_component->test_map(depth+1,recursive);
56            }
57          catch (morpheo::ErrorMorpheo & error)
58            {
59              // no error propagation, only top level
60            }
61      }
62   
63    log_printf(FUNC,Behavioural,FUNCTION,"End");
64   
65    if (test_ok == false)
66      throw (ERRORMORPHEO (FUNCTION,_("A lot of port is not connected.\n")));
67
68    return test_ok;
69  };
70
71// #undef  FUNCTION
72// #define FUNCTION "Component::test_equi"
73//   bool Component::test_equi (bool recursive)
74//   {
75//     log_printf(INFO,Behavioural,FUNCTION, "Test port equi and interface.");
76//     return test_equi (0, recursive);
77//   }
78
79//   bool Component::test_equi (uint32_t depth, bool recursive)
80//   {
81//     log_printf(FUNC,Behavioural,FUNCTION,"Begin");
82
83//     std::string tab  = tab(depth);
84//     std::string name = _entity->get_name();
85//     bool test_ok = true;
86
87//     test_ok &= _entity->test_equi(depth+1);
88
89//     for (std::list<Tcomponent_t *>::iterator i= _list_component->begin();
90//       i != _list_component->end();
91//       ++i)
92//       {
93//      test_ok &= (*i)->_entity->test_equi(depth+1);
94//      if (recursive)
95//        try
96//          {
97//            test_ok &= (*i)->_component->test_equi(depth+1,recursive);
98//          }
99//        catch (morpheo::ErrorMorpheo & error)
100//          {
101//            // no error propagation, only top level
102//          }
103//       }
104   
105//     log_printf(FUNC,Behavioural,FUNCTION,"End");
106   
107//     if (test_ok == false)
108//       throw (ERRORMORPHEO (FUNCTION,_("A lot of port is not connected.\n")));
109
110//     return test_ok;
111//   };
112
113
114}; // end namespace behavioural         
115}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.