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

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

1) Add modelsim simulation systemC
2) Modelsim cosimulation systemC / VHDL is not finish !!!! (cf execute_queue and write_unit)
3) Add multi architecture
5) Add template for comparator, multiplier and divider
6) Change Message
Warning) Various test macro have change, many selftest can't compile

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1/*
2 * $Id: Counter.cpp 113 2009-04-14 18:39:12Z 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
15#undef FUNCTION
16#define FUNCTION "Counter::Counter"
17  Counter::Counter
18  (
19#ifdef SYSTEMC
20  sc_module_name name,
21#else
22  std::string name,
23#endif
24#ifdef STATISTICS
25  morpheo::behavioural::Parameters_Statistics * param_statistics,
26#endif
27  morpheo::behavioural::generic::counter::Parameters * param,
28   Tusage_t usage):
29    _name  (name),
30    _param (param),
31    _usage (usage)
32  {
33    log_begin(Counter,FUNCTION);
34
35// #if DEBUG_Counter == true
36//     log_printf(INFO,Counter,FUNCTION,_("<%s> Parameters"),_name.c_str());
37
38//     std::cout << *param << std::endl;
39// #endif   
40
41    log_printf(INFO,Core,FUNCTION,_("<%s> Allocation"),_name.c_str());
42    allocation ();
43
44#ifdef STATISTICS
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      }
52#endif
53
54#ifdef VHDL
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      }
62#endif
63
64#ifdef SYSTEMC
65
66    if (usage_is_set(_usage,USE_SYSTEMC))
67      {
68#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
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();
74#endif
75
76        log_printf(INFO,Core,FUNCTION,_("<%s> Method - genMealy"),_name.c_str());
77        SC_METHOD (genMealy);
78        dont_initialize ();
79        for (uint32_t i=0; i<_param->_nb_port; i++)
80          sensitive << *(in_COUNTER_DATA   [i])
81                    << *(in_COUNTER_ADDSUB [i]);
82       
83#ifdef SYSTEMCASS_SPECIFIC
84        // List dependency information
85        for (uint32_t i=0; i<_param->_nb_port; i++)
86          {
87            (*(out_COUNTER_DATA [i])) (*(in_COUNTER_DATA   [i]));
88            (*(out_COUNTER_DATA [i])) (*(in_COUNTER_ADDSUB [i]));
89          }
90#endif   
91      }
92
93#endif
94    log_end(Counter,FUNCTION);
95  };
96 
97#undef FUNCTION
98#define FUNCTION "Counter::~Counter"
99  Counter::~Counter (void)
100  {
101    log_begin(Counter,FUNCTION);
102
103#ifdef STATISTICS
104    if (usage_is_set(_usage,USE_STATISTICS))
105      {
106        delete _stat;
107      }
108#endif
109
110    log_printf(INFO,Core,FUNCTION,_("<%s> Deallocation"),_name.c_str());
111    deallocation ();
112
113    log_end(Counter,FUNCTION);
114  };
115
116}; // end namespace counter
117}; // end namespace generic
118
119}; // end namespace behavioural
120}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.