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

Last change on this file since 132 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: 6.8 KB
Line 
1/*
2 * $Id: Front_end_Glue.cpp 132 2009-07-11 16:39:35Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Front_end_Glue/include/Front_end_Glue.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_front_end {
14namespace front_end {
15namespace front_end_glue {
16
17
18#undef  FUNCTION
19#define FUNCTION "Front_end_Glue::Front_end_Glue"
20  Front_end_Glue::Front_end_Glue
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::front_end_glue::Parameters * param,
31   morpheo::behavioural::Tusage_t usage
32   ):
33    _name              (name)
34    ,_param            (param)
35    ,_usage            (usage)
36  {
37    log_begin(Front_end_Glue,FUNCTION);
38
39    usage_environment(_usage);
40
41// #if DEBUG_Front_end_Glue == true
42//     log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> Parameters"),_name.c_str());
43
44//     std::cout << *param << std::endl;
45// #endif   
46
47    log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Allocation"),_name.c_str());
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,Front_end_Glue,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str());
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,Front_end_Glue,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str());
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,Front_end_Glue,FUNCTION,_("<%s> : Method - constant"),_name.c_str());
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,Front_end_Glue,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
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,Front_end_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
101
102//      SC_METHOD (genMoore);
103//      dont_initialize ();
104//      sensitive << (*(in_CLOCK)).neg(); // need internal register
105       
106// # ifdef SYSTEMCASS_SPECIFIC
107//      // List dependency information
108// # endif   
109
110        if (_param->_have_port_context_id)
111          {
112        log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_decod"),_name.c_str());
113
114        SC_METHOD (genMealy_decod);
115        dont_initialize ();
116//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
117        sensitive << (*(in_NRESET));
118        for (uint32_t i=0; i<_param->_nb_decod_unit; ++i)
119          for (uint32_t j=0; j<_param->_nb_inst_decod[i]; ++j)
120            sensitive << (*( in_DECOD_DECOD_UNIT_CONTEXT_ID [i][j]));
121
122# ifdef SYSTEMCASS_SPECIFIC
123        // List dependency information
124# endif   
125          }
126
127        log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_branch_complete"),_name.c_str());
128
129        SC_METHOD (genMealy_branch_complete);
130        dont_initialize ();
131//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
132        sensitive << (*(in_NRESET));
133        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i)
134          sensitive << (*( in_BRANCH_COMPLETE_VAL                             [i]))
135                    << (*( in_BRANCH_COMPLETE_PREDICTION_UNIT_ACK             [i]))
136                    << (*( in_BRANCH_COMPLETE_PREDICTION_UNIT_MISS_PREDICTION [i]))
137                    << (*( in_BRANCH_COMPLETE_CONTEXT_STATE_ACK               [i]));
138
139# ifdef SYSTEMCASS_SPECIFIC
140        // List dependency information
141# endif   
142
143        log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_event"),_name.c_str());
144
145        SC_METHOD (genMealy_event);
146        dont_initialize ();
147//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
148        sensitive << (*(in_NRESET));
149        for (uint32_t i=0; i<_param->_nb_context; ++i)
150          {
151            sensitive << (*( in_EVENT_ACK                            [i]))
152                      << (*( in_EVENT_IFETCH_UNIT_ACK                [i]))
153                      << (*( in_EVENT_PREDICTION_UNIT_ACK            [i]))
154                      << (*( in_EVENT_CONTEXT_STATE_VAL              [i]))
155                      << (*( in_EVENT_CONTEXT_STATE_ADDRESS          [i]))
156                      << (*( in_EVENT_CONTEXT_STATE_ADDRESS_NEXT     [i]))
157                      << (*( in_EVENT_CONTEXT_STATE_ADDRESS_NEXT_VAL [i]))
158                      << (*( in_EVENT_CONTEXT_STATE_IS_DS_TAKE       [i]))
159                      << (*( in_EVENT_CONTEXT_STATE_TYPE             [i]))
160                      << (*( in_EVENT_CONTEXT_STATE_FLUSH_ONLY       [i]))
161              ;
162            if (_param->_have_port_depth)
163            sensitive << (*( in_EVENT_CONTEXT_STATE_DEPTH            [i]));
164          }
165
166# ifdef SYSTEMCASS_SPECIFIC
167        // List dependency information
168# endif     
169
170        log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_depth"),_name.c_str());
171
172        SC_METHOD (genMealy_depth);
173        dont_initialize ();
174//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
175        sensitive << (*(in_NRESET));
176        for (uint32_t i=0; i<_param->_nb_context; ++i)
177          {
178            if (_param->_have_port_depth)
179            sensitive << (*( in_DEPTH_PREDICTION_UNIT_CURRENT [i]))
180                      << (*( in_DEPTH_PREDICTION_UNIT_MIN     [i])) 
181                      << (*( in_DEPTH_PREDICTION_UNIT_MAX     [i]));
182
183            sensitive << (*( in_DEPTH_PREDICTION_UNIT_VAL     [i]))
184                      << (*( in_DEPTH_PREDICTION_UNIT_FULL    [i]));
185          }
186
187# ifdef SYSTEMCASS_SPECIFIC
188        // List dependency information
189# endif     
190     
191        log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_nb_inst"),_name.c_str());
192
193        SC_METHOD (genMealy_nb_inst);
194        dont_initialize ();
195//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
196        sensitive << (*(in_NRESET));
197        for (uint32_t i=0; i<_param->_nb_context; ++i)
198            sensitive << (*( in_NB_INST_DECOD_UNIT_DECOD_ALL [i]));
199
200# ifdef SYSTEMCASS_SPECIFIC
201        // List dependency information
202# endif   
203       
204#endif
205      }
206    log_end(Front_end_Glue,FUNCTION);
207  };
208   
209#undef  FUNCTION
210#define FUNCTION "Front_end_Glue::~Front_end_Glue"
211  Front_end_Glue::~Front_end_Glue (void)
212  {
213    log_begin(Front_end_Glue,FUNCTION);
214
215#ifdef STATISTICS
216    if (usage_is_set(_usage,USE_STATISTICS))
217      {
218        statistics_deallocation();
219      }
220#endif
221
222    log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
223    deallocation ();
224
225    log_end(Front_end_Glue,FUNCTION);
226  };
227
228}; // end namespace front_end_glue
229}; // end namespace front_end
230}; // end namespace multi_front_end
231}; // end namespace core
232
233}; // end namespace behavioural
234}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.