source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_genMealy.cpp @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 884 bytes
Line 
1#ifdef SYSTEMC
2#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id$
5 *
6 * [ Description ]
7 *
8 */
9
10#include "Behavioural/Generic/Counter/include/Counter.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace generic {
15namespace counter {
16
17  void Counter::genMealy (void)
18  {
19    log_printf(FUNC,Counter,"genMealy","Begin");
20
21    for (uint32_t i=0; i<_param._nb_port; i++)
22      {
23        Tdata_t data = PORT_READ(in_COUNTER_DATA [i]);
24
25        // Staturate counter
26        if (PORT_READ(in_COUNTER_ADDSUB [i]) == 1)
27          {
28            if (data < _param._data_max)
29              data ++;
30          }
31        else
32          {
33            if (data > 0)
34              data --;
35          }
36
37        PORT_WRITE(out_COUNTER_DATA[i], data);
38      }
39
40    log_printf(FUNC,Counter,"genMealy","End");
41  };
42
43}; // end namespace counter
44}; // end namespace generic
45}; // end namespace behavioural
46}; // end namespace morpheo             
47#endif
48#endif
Note: See TracBrowser for help on using the repository browser.