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

Last change on this file since 144 was 144, checked in by rosiere, 14 years ago

1) compatible gcc 4.4.3
2) Translation file in MORPHEO_PREFIX directory

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Sort_genMealy.cpp 144 2010-09-28 11:19:10Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/Sort/include/Sort.h"
10#include <algorithm>
11
12namespace morpheo                    {
13namespace behavioural {
14namespace generic {
15namespace sort {
16
17
18#undef  FUNCTION
19#define FUNCTION "Sort::genMealy"
20  void Sort::genMealy (void)
21  {
22    log_printf(FUNC,Sort,FUNCTION,"Begin");
23
24    if (PORT_READ(in_NRESET))
25      {
26    sort_t array [_param->_nb_input];
27
28    // Push input in a array
29    for (uint32_t i=0; i<_param->_nb_input; i++)
30      {
31        array[i].index = i;
32        array[i].val   = PORT_READ( in_INPUT_VAL  [i]);
33        array[i].data  = PORT_READ( in_INPUT_DATA [i]);
34      }
35
36    // Sort array
37    //if (_param->_ascending == true)
38    std::stable_sort(array, array+_param->_nb_input);
39
40    // Write output
41    for (uint32_t i=0; i<_param->_nb_output; i++)
42      {
43        PORT_WRITE (out_OUTPUT_VAL   [i],array[i].val  );
44        if (_param->_have_port_index_out)
45        PORT_WRITE (out_OUTPUT_INDEX [i],array[i].index);
46        if (_param->_have_port_data_out)
47        PORT_WRITE (out_OUTPUT_DATA  [i],array[i].data );
48      }
49      }
50
51    log_printf(FUNC,Sort,FUNCTION,"End");
52  };
53
54}; // end namespace sort
55}; // end namespace generic
56
57}; // end namespace behavioural
58}; // end namespace morpheo             
59#endif
Note: See TracBrowser for help on using the repository browser.