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

Last change on this file since 42 was 42, checked in by rosiere, 17 years ago

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

File size: 1.1 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
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    for (uint32_t i=0; i<_param._nb_port; i++)
21      {
22        Tcontrol_t addsub  = PORT_READ(in_COUNTER_ADDSUB [i]);
23        Tdata_t    data_in = PORT_READ(in_COUNTER_DATA   [i]);
24        Tdata_t    data_out= data_in;
25        log_printf(TRACE,Counter,"genMealy","before : %d %s = %d",data_in,((addsub==1)?"++":"--"),data_out);
26
27        // Staturate counter
28        if (addsub == 1)
29          {
30            if (data_out < _param._data_max)
31              data_out++;
32          }
33        else
34          {
35            if (data_out > 0)
36              data_out--;
37          }
38
39        log_printf(TRACE,Counter,"genMealy","after   : %d %s = %d",data_in,((addsub==1)?"++":"--"),data_out);
40   
41        PORT_WRITE(out_COUNTER_DATA[i], data_out);
42      }
43
44    log_printf(FUNC,Counter,"genMealy","End");
45  };
46
47}; // end namespace counter
48}; // end namespace generic
49}; // end namespace behavioural
50}; // end namespace morpheo             
51#endif
Note: See TracBrowser for help on using the repository browser.