source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_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.1 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Counter_genMealy.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/Counter/include/Counter.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace generic {
14namespace counter {
15
16  void Counter::genMealy (void)
17  {
18    log_printf(FUNC,Counter,"genMealy","Begin");
19
20    if (PORT_READ(in_NRESET))
21    for (uint32_t i=0; i<_param->_nb_port; i++)
22      {
23        Tcontrol_t addsub  = PORT_READ(in_COUNTER_ADDSUB [i]);
24        Tdata_t    data_in = PORT_READ(in_COUNTER_DATA   [i]);
25        Tdata_t    data_out= data_in;
26        log_printf(TRACE,Counter,"genMealy","before : %d %s = %d",data_in,((addsub==1)?"++":"--"),data_out);
27
28        // Staturate counter
29        if (addsub == 1)
30          {
31            if (data_out < _param->_data_max)
32              data_out++;
33          }
34        else
35          {
36            if (data_out > 0)
37              data_out--;
38          }
39
40        log_printf(TRACE,Counter,"genMealy","after   : %d %s = %d",data_in,((addsub==1)?"++":"--"),data_out);
41   
42        PORT_WRITE(out_COUNTER_DATA[i], data_out);
43      }
44
45    log_printf(FUNC,Counter,"genMealy","End");
46  };
47
48}; // end namespace counter
49}; // end namespace generic
50}; // end namespace behavioural
51}; // end namespace morpheo             
52#endif
Note: See TracBrowser for help on using the repository browser.