source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Sort/src/Sort.cpp @ 132

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

1) add constant method - compatibility with SystemC
2) add Script to test sensitive list
3) fix bug in sensitive list

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1/*
2 * $Id: Sort.cpp 132 2009-07-11 16:39:35Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Generic/Sort/include/Sort.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace generic {
13namespace sort {
14
15
16#undef  FUNCTION
17#define FUNCTION "Sort::Sort"
18  Sort::Sort
19  (
20#ifdef SYSTEMC
21   sc_module_name name,
22#else
23   string name,
24#endif
25#ifdef STATISTICS
26   morpheo::behavioural::Parameters_Statistics * param_statistics,
27#endif
28   morpheo::behavioural::generic::sort::Parameters * param,
29   morpheo::behavioural::Tusage_t usage
30   ):
31    _name              (name)
32    ,_param            (param)
33    ,_usage            (usage)
34  {
35    log_printf(FUNC,Sort,FUNCTION,"Begin");
36
37// #if DEBUG_Sort == true
38//     log_printf(INFO,Sort,FUNCTION,_("<%s> Parameters"),_name.c_str());
39
40//     std::cout << *param << std::endl;
41// #endif   
42
43    log_printf(INFO,Sort,FUNCTION,"Allocation");
44
45    allocation (
46#ifdef STATISTICS
47                param_statistics
48#endif
49                );
50
51#ifdef STATISTICS
52    if (usage_is_set(_usage,USE_STATISTICS))
53      { 
54        log_printf(INFO,Sort,FUNCTION,"Allocation of statistics");
55
56        statistics_allocation(param_statistics);
57      }
58#endif
59
60#ifdef VHDL
61    if (usage_is_set(_usage,USE_VHDL))
62      {
63        // generate the vhdl
64        log_printf(INFO,Sort,FUNCTION,"Generate the vhdl");
65       
66        vhdl();
67      }
68#endif
69
70#ifdef SYSTEMC
71    if (usage_is_set(_usage,USE_SYSTEMC))
72      {
73# if defined(STATISTICS) or defined(VHDL_TESTBENCH)
74        log_printf(INFO,Sort,FUNCTION,"Method - transition");
75
76        SC_METHOD (transition);
77        dont_initialize ();
78        sensitive << (*(in_CLOCK)).pos();
79       
80#  ifdef SYSTEMCASS_SPECIFIC
81        // List dependency information
82#  endif   
83# endif
84
85        log_printf(INFO,Sort,FUNCTION,"Method - genMealy");
86
87        SC_METHOD (genMealy);
88        dont_initialize ();
89//      sensitive << (*(in_CLOCK)).neg(); // don't use internal register
90        sensitive << (*(in_NRESET));
91        for (uint32_t i=0; i<_param->_nb_input; i++)
92          sensitive << (*(in_INPUT_VAL  [i]))
93                    << (*(in_INPUT_DATA [i]));
94
95# ifdef SYSTEMCASS_SPECIFIC
96        // List dependency information
97        for (uint32_t i=0; i<_param->_nb_output; i++)
98          for (uint32_t j=0; j<_param->_nb_input; j++)
99            {
100              (*(out_OUTPUT_VAL   [i])) (*(in_INPUT_VAL  [j]));
101              (*(out_OUTPUT_VAL   [i])) (*(in_INPUT_DATA [j]));
102             
103              if (_param->_have_port_index_out)
104                {
105              (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_VAL  [j]));
106              (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_DATA [j]));
107                }
108              if (_param->_have_port_data_out)
109                {
110              (*(out_OUTPUT_DATA  [i])) (*(in_INPUT_VAL  [j]));
111              (*(out_OUTPUT_DATA  [i])) (*(in_INPUT_DATA [j]));
112                }
113            }
114# endif   
115       
116#endif
117      }
118    log_printf(FUNC,Sort,FUNCTION,"End");
119  };
120   
121#undef  FUNCTION
122#define FUNCTION "Sort::~Sort"
123  Sort::~Sort (void)
124  {
125    log_printf(FUNC,Sort,FUNCTION,"Begin");
126
127#ifdef STATISTICS
128    if (usage_is_set(_usage,USE_STATISTICS))
129      {
130        statistics_deallocation();
131      }
132#endif
133
134    log_printf(INFO,Sort,FUNCTION,"Deallocation");
135    deallocation ();
136
137    log_printf(FUNC,Sort,FUNCTION,"End");
138  };
139
140}; // end namespace sort
141}; // end namespace generic
142
143}; // end namespace behavioural
144}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.