source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_test_map.cpp

Last change on this file was 139, checked in by rosiere, 14 years ago
  • Add test for all configuration
  • RAT : add rat scheme (depth_save)
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1/*
2 * $Id: Component_test_map.cpp 139 2010-07-30 14:47:27Z 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 (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(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      if (((*i)->_instance & INSTANCE_COMPONENT) != 0)
51        {
52          test_ok &= (*i)->_entity->test_map(false,is_behavioural);
53          if (recursive)
54            try 
55              {
56                test_ok &= (*i)->_component->test_map(recursive);
57              }
58            catch (morpheo::ErrorMorpheo & error)
59              {
60                // no error propagation, only top level
61              }
62        }
63   
64    log_printf(FUNC,Behavioural,FUNCTION,"End");
65   
66    if (test_ok == false)
67      throw (ERRORMORPHEO (FUNCTION,_("A lot of port is not connected.\n")));
68
69    return test_ok;
70  };
71
72// #undef  FUNCTION
73// #define FUNCTION "Component::test_equi"
74//   bool Component::test_equi (bool recursive)
75//   {
76//     log_printf(INFO,Behavioural,FUNCTION, "Test port equi and interface.");
77//     return test_equi (0, recursive);
78//   }
79
80//   bool Component::test_equi (uint32_t depth, bool recursive)
81//   {
82//     log_printf(FUNC,Behavioural,FUNCTION,"Begin");
83
84//     std::string tab  = tab(depth);
85//     std::string name = _entity->get_name();
86//     bool test_ok = true;
87
88//     test_ok &= _entity->test_equi(depth+1);
89
90//     for (std::list<Tcomponent_t *>::iterator i= _list_component->begin();
91//       i != _list_component->end();
92//       ++i)
93//       {
94//      test_ok &= (*i)->_entity->test_equi(depth+1);
95//      if (recursive)
96//        try
97//          {
98//            test_ok &= (*i)->_component->test_equi(depth+1,recursive);
99//          }
100//        catch (morpheo::ErrorMorpheo & error)
101//          {
102//            // no error propagation, only top level
103//          }
104//       }
105   
106//     log_printf(FUNC,Behavioural,FUNCTION,"End");
107   
108//     if (test_ok == false)
109//       throw (ERRORMORPHEO (FUNCTION,_("A lot of port is not connected.\n")));
110
111//     return test_ok;
112//   };
113
114
115}; // end namespace behavioural         
116}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.