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

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1/*
2 * $Id: Sort.cpp 88 2008-12-10 18:31:39Z 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        log_printf(INFO,Sort,FUNCTION,"Method - transition");
74
75        SC_METHOD (transition);
76        dont_initialize ();
77        sensitive << (*(in_CLOCK)).pos();
78       
79# ifdef SYSTEMCASS_SPECIFIC
80        // List dependency information
81# endif   
82
83        log_printf(INFO,Sort,FUNCTION,"Method - genMealy");
84
85        SC_METHOD (genMealy);
86        dont_initialize ();
87//      sensitive << (*(in_CLOCK)).neg(); // don't use internal register
88        for (uint32_t i=0; i<_param->_nb_input; i++)
89          sensitive << (*(in_INPUT_VAL  [i]))
90                    << (*(in_INPUT_DATA [i]));
91
92# ifdef SYSTEMCASS_SPECIFIC
93        // List dependency information
94        for (uint32_t i=0; i<_param->_nb_output; i++)
95          for (uint32_t j=0; j<_param->_nb_input; j++)
96            {
97              (*(out_OUTPUT_VAL   [i])) (*(in_INPUT_VAL  [j]));
98              (*(out_OUTPUT_VAL   [i])) (*(in_INPUT_DATA [j]));
99             
100              if (_param->_have_port_index_out)
101                {
102              (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_VAL  [j]));
103              (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_DATA [j]));
104                }
105              if (_param->_have_port_data_out)
106                {
107              (*(out_OUTPUT_DATA  [i])) (*(in_INPUT_VAL  [j]));
108              (*(out_OUTPUT_DATA  [i])) (*(in_INPUT_DATA [j]));
109                }
110            }
111# endif   
112       
113#endif
114      }
115    log_printf(FUNC,Sort,FUNCTION,"End");
116  };
117   
118#undef  FUNCTION
119#define FUNCTION "Sort::~Sort"
120  Sort::~Sort (void)
121  {
122    log_printf(FUNC,Sort,FUNCTION,"Begin");
123
124#ifdef STATISTICS
125    if (usage_is_set(_usage,USE_STATISTICS))
126      {
127        statistics_deallocation();
128      }
129#endif
130
131    log_printf(INFO,Sort,FUNCTION,"Deallocation");
132    deallocation ();
133
134    log_printf(FUNC,Sort,FUNCTION,"End");
135  };
136
137}; // end namespace sort
138}; // end namespace generic
139
140}; // end namespace behavioural
141}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.