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

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