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

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

1) add constant method - compatibility with SystemC
2) add Script to test sensitive list
3) fix bug in sensitive list

  • Property svn:keywords set to Id
File size: 2.7 KB
RevLine 
[2]1/*
2 * $Id: Counter.cpp 132 2009-07-11 16:39:35Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Generic/Counter/include/Counter.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace generic {
13namespace counter {
14
[113]15#undef FUNCTION
16#define FUNCTION "Counter::Counter"
[82]17  Counter::Counter
18  (
[2]19#ifdef SYSTEMC
[82]20  sc_module_name name,
[2]21#else
[82]22  std::string name,
[2]23#endif
24#ifdef STATISTICS
[82]25  morpheo::behavioural::Parameters_Statistics * param_statistics,
[2]26#endif
[113]27  morpheo::behavioural::generic::counter::Parameters * param,
[82]28   Tusage_t usage):
29    _name  (name),
30    _param (param),
31    _usage (usage)
[2]32  {
[113]33    log_begin(Counter,FUNCTION);
[2]34
[113]35// #if DEBUG_Counter == true
36//     log_printf(INFO,Counter,FUNCTION,_("<%s> Parameters"),_name.c_str());
[88]37
[113]38//     std::cout << *param << std::endl;
39// #endif   
[88]40
41    log_printf(INFO,Core,FUNCTION,_("<%s> Allocation"),_name.c_str());
[42]42    allocation ();
43
[2]44#ifdef STATISTICS
[88]45    if (usage_is_set(_usage,USE_STATISTICS))
46      { 
47        log_printf(INFO,Core,FUNCTION,_("<%s> Allocation of statistics"),_name.c_str());
48
49        // Allocation of statistics
50        statistics_declaration(param_statistics);
51      }
[2]52#endif
53
54#ifdef VHDL
[88]55    if (usage_is_set(_usage,USE_VHDL))
56      {
57        // generate the vhdl
58        log_printf(INFO,Core,FUNCTION,_("<%s> Generate the vhdl"),_name.c_str());
59       
60        vhdl();
61      }
[2]62#endif
63
64#ifdef SYSTEMC
[53]65
[88]66    if (usage_is_set(_usage,USE_SYSTEMC))
67      {
[53]68#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
[88]69        log_printf(INFO,Core,FUNCTION,_("<%s> Method - transition"),_name.c_str());
70
71        SC_METHOD (transition);
72        dont_initialize ();
73        sensitive << (*(in_CLOCK)).pos();
[53]74#endif
[2]75
[88]76        log_printf(INFO,Core,FUNCTION,_("<%s> Method - genMealy"),_name.c_str());
77        SC_METHOD (genMealy);
78        dont_initialize ();
[132]79        sensitive << (*(in_NRESET));
[113]80        for (uint32_t i=0; i<_param->_nb_port; i++)
[88]81          sensitive << *(in_COUNTER_DATA   [i])
82                    << *(in_COUNTER_ADDSUB [i]);
83       
[2]84#ifdef SYSTEMCASS_SPECIFIC
[88]85        // List dependency information
[113]86        for (uint32_t i=0; i<_param->_nb_port; i++)
[88]87          {
88            (*(out_COUNTER_DATA [i])) (*(in_COUNTER_DATA   [i]));
89            (*(out_COUNTER_DATA [i])) (*(in_COUNTER_ADDSUB [i]));
90          }
91#endif   
[2]92      }
93
94#endif
[113]95    log_end(Counter,FUNCTION);
[2]96  };
97 
[113]98#undef FUNCTION
99#define FUNCTION "Counter::~Counter"
[2]100  Counter::~Counter (void)
101  {
[113]102    log_begin(Counter,FUNCTION);
[2]103
104#ifdef STATISTICS
[88]105    if (usage_is_set(_usage,USE_STATISTICS))
106      {
107        delete _stat;
108      }
[2]109#endif
[88]110
111    log_printf(INFO,Core,FUNCTION,_("<%s> Deallocation"),_name.c_str());
112    deallocation ();
113
[113]114    log_end(Counter,FUNCTION);
[2]115  };
116
117}; // end namespace counter
118}; // end namespace generic
119
120}; // end namespace behavioural
121}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.