source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp @ 131

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

1) add constant method
2) test with systemc 2.2.0

  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1/*
2 * $Id: Context_State.cpp 131 2009-07-08 18:40:08Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_front_end {
14namespace front_end {
15namespace context_state {
16
17
18#undef  FUNCTION
19#define FUNCTION "Context_State::Context_State"
20  Context_State::Context_State
21  (
22#ifdef SYSTEMC
23   sc_module_name name,
24#else
25   string name,
26#endif
27#ifdef STATISTICS
28   morpheo::behavioural::Parameters_Statistics * param_statistics,
29#endif
30   morpheo::behavioural::core::multi_front_end::front_end::context_state::Parameters * param,
31   morpheo::behavioural::Tusage_t usage
32   ):
33    _name              (name)
34    ,_param            (param)
35    ,_usage            (usage)
36  {
37    log_begin(Context_State,FUNCTION);
38
39    usage_environment(_usage);
40
41// #if DEBUG_Context_State == true
42//     log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str());
43
44//     std::cout << *param << std::endl;
45// #endif   
46
47    log_printf(INFO,Context_State,FUNCTION,_("Allocation"));
48
49    allocation (
50#ifdef STATISTICS
51                param_statistics
52#endif
53                );
54
55#ifdef STATISTICS
56    if (usage_is_set(_usage,USE_STATISTICS))
57      { 
58        log_printf(INFO,Context_State,FUNCTION,_("Allocation of statistics"));
59
60        statistics_allocation(param_statistics);
61      }
62#endif
63
64#ifdef VHDL
65    if (usage_is_set(_usage,USE_VHDL))
66      {
67        // generate the vhdl
68        log_printf(INFO,Context_State,FUNCTION,_("Generate the vhdl"));
69       
70        vhdl();
71      }
72#endif
73
74#ifdef SYSTEMC
75    if (usage_is_set(_usage,USE_SYSTEMC))
76      {
77#ifdef SYSTEMCASS_SPECIFIC
78        constant();
79#else
80        log_printf(INFO,Context_State,FUNCTION,_("Method - constant"));
81
82        SC_METHOD (constant);
83//      dont_initialize ();
84       
85# ifdef SYSTEMCASS_SPECIFIC
86        // List dependency information
87# endif   
88#endif
89
90        log_printf(INFO,Context_State,FUNCTION,_("Method - transition"));
91
92        SC_METHOD (transition);
93        dont_initialize ();
94        sensitive << (*(in_CLOCK)).pos();
95       
96# ifdef SYSTEMCASS_SPECIFIC
97        // List dependency information
98# endif   
99
100        log_printf(INFO,Context_State,FUNCTION,_("Method - genMoore"));
101
102        SC_METHOD (genMoore);
103        dont_initialize ();
104        sensitive << (*(in_CLOCK)).neg(); // use internal register
105       
106# ifdef SYSTEMCASS_SPECIFIC
107        // List dependency information
108# endif   
109
110        log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_decod_event"));
111
112        SC_METHOD (genMealy_decod_event);
113        dont_initialize ();
114        sensitive << (*(in_CLOCK)).neg(); // use internal register
115        for (uint32_t i=0; i<_param->_nb_decod_unit; ++i)
116          {
117            sensitive << (*(in_DECOD_EVENT_VAL        [i])) // not necessary
118                      << (*(in_DECOD_EVENT_TYPE       [i]));
119            if (_param->_have_port_context_id)                                 
120            sensitive << (*(in_DECOD_EVENT_CONTEXT_ID [i]));
121          }
122        for (uint32_t i=0; i<_param->_nb_context; ++i)
123          {
124            sensitive << (*(in_NB_INST_DECOD_ALL      [i]))
125                      << (*(in_NB_INST_COMMIT_ALL     [i]))
126                      << (*(in_NB_INST_COMMIT_MEM     [i]));
127          }
128       
129# ifdef SYSTEMCASS_SPECIFIC
130        // List dependency information
131# endif   
132
133        log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_context_event"));
134
135        SC_METHOD (genMealy_context_event);
136        dont_initialize ();
137//      sensitive << (*(in_CLOCK)).neg(); // use internal register
138        sensitive << (*(in_COMMIT_EVENT_VAL             ));
139        if (_param->_have_port_context_id)                                     
140        sensitive << (*(in_COMMIT_EVENT_CONTEXT_ID      ));
141        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i)
142          {
143            sensitive << (*(in_BRANCH_COMPLETE_VAL             [i]))
144                      << (*(in_BRANCH_COMPLETE_MISS_PREDICTION [i]));
145            if (_param->_have_port_context_id)                                 
146            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID      [i]));
147          }
148       
149# ifdef SYSTEMCASS_SPECIFIC
150        // List dependency information
151# endif   
152       
153#endif
154      }
155    log_end(Context_State,FUNCTION);
156  };
157   
158#undef  FUNCTION
159#define FUNCTION "Context_State::~Context_State"
160  Context_State::~Context_State (void)
161  {
162    log_begin(Context_State,FUNCTION);
163
164#ifdef STATISTICS
165    if (usage_is_set(_usage,USE_STATISTICS))
166      {
167        statistics_deallocation();
168      }
169#endif
170
171    log_printf(INFO,Context_State,FUNCTION,_("Deallocation"));
172    deallocation ();
173
174    log_end(Context_State,FUNCTION);
175  };
176
177}; // end namespace context_state
178}; // end namespace front_end
179}; // end namespace multi_front_end
180}; // end namespace core
181
182}; // end namespace behavioural
183}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.