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

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

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Sort_genMealy.cpp 123 2009-06-08 20:43:30Z 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    if (PORT_READ(in_NRESET))
24      {
25    sort_t array [_param->_nb_input];
26
27    // Push input in a array
28    for (uint32_t i=0; i<_param->_nb_input; i++)
29      {
30        array[i].index = i;
31        array[i].val   = PORT_READ ( in_INPUT_VAL  [i]);
32        array[i].data  = PORT_READ ( in_INPUT_DATA [i]);
33      }
34
35    // Sort array
36    //if (_param->_ascending == true)
37    std::stable_sort(array, array+_param->_nb_input);
38
39    // Write output
40    for (uint32_t i=0; i<_param->_nb_output; i++)
41      {
42        PORT_WRITE (out_OUTPUT_VAL   [i],array[i].val  );
43        if (_param->_have_port_index_out)
44        PORT_WRITE (out_OUTPUT_INDEX [i],array[i].index);
45        if (_param->_have_port_data_out)
46        PORT_WRITE (out_OUTPUT_DATA  [i],array[i].data );
47      }
48      }
49
50    log_printf(FUNC,Sort,FUNCTION,"End");
51  };
52
53}; // end namespace sort
54}; // end namespace generic
55
56}; // end namespace behavioural
57}; // end namespace morpheo             
58#endif
Note: See TracBrowser for help on using the repository browser.