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

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

1) Ajout d'un "printer" XML pour la configuration de paramètres

2) Fin du composant "Two_Level_Branch_Predictor"

validation * systemc

  • vhdl
File size: 1.2 KB
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        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
53#endif
Note: See TracBrowser for help on using the repository browser.