source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Core_Glue/src/Core_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: 11.2 KB
Line 
1/*
2 * $Id: Core_Glue.cpp 132 2009-07-11 16:39:35Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Core_Glue/include/Core_Glue.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace core_glue {
14
15
16#undef  FUNCTION
17#define FUNCTION "Core_Glue::Core_Glue"
18  Core_Glue::Core_Glue
19  (
20#ifdef SYSTEMC
21   sc_module_name name,
22#else
23   string name,
24#endif
25#ifdef STATISTICS
26   morpheo::behavioural::Parameters_Statistics * param_statistics,
27#endif
28   morpheo::behavioural::core::core_glue::Parameters * param,
29   morpheo::behavioural::Tusage_t usage
30   ):
31    _name              (name)
32    ,_param            (param)
33    ,_usage            (usage)
34  {
35    log_begin(Core_Glue,FUNCTION);
36
37    usage_environment(_usage);
38
39// #if DEBUG_Core_Glue == true
40//     log_printf(INFO,Core_Glue,FUNCTION,_("<%s> Parameters"),_name.c_str());
41
42//     std::cout << *param << std::endl;
43// #endif   
44
45    log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Allocation"),_name.c_str());
46
47    allocation (
48#ifdef STATISTICS
49                param_statistics
50#endif
51                );
52
53#ifdef STATISTICS
54    if (usage_is_set(_usage,USE_STATISTICS))
55      { 
56        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str());
57
58        statistics_allocation(param_statistics);
59      }
60#endif
61
62#ifdef VHDL
63    if (usage_is_set(_usage,USE_VHDL))
64      {
65        // generate the vhdl
66        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str());
67       
68        vhdl();
69      }
70#endif
71
72#ifdef SYSTEMC
73    if (usage_is_set(_usage,USE_SYSTEMC))
74      {
75#ifdef SYSTEMCASS_SPECIFIC
76        constant();
77#else
78        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - constant"),_name.c_str());
79
80        SC_METHOD (constant);
81//      dont_initialize ();
82       
83# ifdef SYSTEMCASS_SPECIFIC
84        // List dependency information
85# endif   
86#endif
87
88        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
89
90        SC_METHOD (transition);
91        dont_initialize ();
92        sensitive << (*(in_CLOCK)).pos();
93       
94# ifdef SYSTEMCASS_SPECIFIC
95        // List dependency information
96# endif   
97
98//      log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
99//      SC_METHOD (genMoore);
100//      dont_initialize ();
101//      sensitive << (*(in_CLOCK)).neg(); // need internal register
102
103// # ifdef SYSTEMCASS_SPECIFIC
104//      // List dependency information
105// # endif   
106
107        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_branch_complete"),_name.c_str());
108        SC_METHOD (genMealy_branch_complete);
109        dont_initialize ();
110//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
111        sensitive << (*(in_NRESET));
112        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
113          for (uint32_t j=0; j<_param->_front_end_nb_inst_branch_complete[i]; ++j)
114            sensitive << (*(in_BRANCH_COMPLETE_FRONT_END_ACK             [i][j]))
115                      << (*(in_BRANCH_COMPLETE_FRONT_END_MISS_PREDICTION [i][j]));
116
117        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
118          for (uint32_t j=0; j<_param->_ooo_engine_nb_inst_branch_complete[i]; ++j)
119            {
120              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_VAL            [i][j]))
121                        << (*(in_BRANCH_COMPLETE_OOO_ENGINE_ADDRESS        [i][j]))
122                        << (*(in_BRANCH_COMPLETE_OOO_ENGINE_NO_SEQUENCE    [i][j]));
123              if (_param->_have_port_front_end_id)
124              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_FRONT_END_ID   [i][j]));
125              if (_param->_have_port_context_id)
126              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_CONTEXT_ID     [i][j]));
127              if (_param->_have_port_depth)
128              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_DEPTH          [i][j]));
129            }   
130
131
132# ifdef SYSTEMCASS_SPECIFIC
133        // List dependency information
134# endif   
135
136        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_commit_event"),_name.c_str());
137        SC_METHOD (genMealy_commit_event);
138        dont_initialize ();
139//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
140        sensitive << (*(in_NRESET));
141        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
142          sensitive << (*(in_COMMIT_EVENT_FRONT_END_ACK               [i]));
143        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
144          {
145            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_VAL              [i]))
146                      << (*(in_COMMIT_EVENT_OOO_ENGINE_TYPE             [i]))
147                      << (*(in_COMMIT_EVENT_OOO_ENGINE_IS_DELAY_SLOT    [i]))
148                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS          [i]))
149                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EPCR_VAL [i]))
150                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EPCR     [i]))
151                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EEAR_VAL [i]))
152                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EEAR     [i]));
153            if (_param->_have_port_front_end_id)
154            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_FRONT_END_ID     [i]));
155            if (_param->_have_port_context_id)
156            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_CONTEXT_ID       [i]));
157            if (_param->_have_port_depth)
158            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_DEPTH            [i]));
159          }
160
161# ifdef SYSTEMCASS_SPECIFIC
162        // List dependency information
163# endif   
164
165        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_issue"),_name.c_str());
166        SC_METHOD (genMealy_issue);
167        dont_initialize ();
168//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
169        sensitive << (*(in_NRESET));
170        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
171          for (uint32_t j=0; j<_param->_nb_inst_issue_queue [i]; ++j)
172            {
173              sensitive << (*(in_ISSUE_OOO_ENGINE_VAL                   [i][j]))
174                        << (*(in_ISSUE_OOO_ENGINE_TYPE                  [i][j]))
175                        << (*(in_ISSUE_OOO_ENGINE_OPERATION             [i][j]))
176                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [i][j]))
177                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_READ  [i][j]))
178                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_EMPTY     [i][j]))
179                        << (*(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT          [i][j]))
180                        << (*(in_ISSUE_OOO_ENGINE_IMMEDIAT              [i][j]))
181                        << (*(in_ISSUE_OOO_ENGINE_READ_RA               [i][j]))
182                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RA            [i][j]))
183                        << (*(in_ISSUE_OOO_ENGINE_READ_RB               [i][j]))
184                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RB            [i][j]))
185                        << (*(in_ISSUE_OOO_ENGINE_READ_RC               [i][j]))
186                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RC            [i][j]))
187                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RD              [i][j]))
188                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RD            [i][j]))
189                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RE              [i][j]))
190                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RE            [i][j]));
191              if (_param->_have_port_front_end_id)
192              sensitive << (*(in_ISSUE_OOO_ENGINE_FRONT_END_ID          [i][j]));
193              if (_param->_have_port_context_id)
194              sensitive << (*(in_ISSUE_OOO_ENGINE_CONTEXT_ID            [i][j]));
195              if (_param->_have_port_rob_ptr)
196              sensitive << (*(in_ISSUE_OOO_ENGINE_PACKET_ID             [i][j]));
197              if (_param->_have_port_load_queue_ptr)
198              sensitive << (*(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE  [i][j]));
199            }
200
201        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
202          for (uint32_t j=0; j<_param->_nb_read_unit [i]; ++j)
203            sensitive << (*(in_ISSUE_EXECUTE_LOOP_ACK [i][j]));
204
205# ifdef SYSTEMCASS_SPECIFIC
206        // List dependency information
207# endif   
208
209        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_execute"),_name.c_str());
210        SC_METHOD (genMealy_execute);
211        dont_initialize ();
212//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
213        sensitive << (*(in_NRESET));
214
215        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
216          for (uint32_t j=0; j<_param->_ooo_engine_nb_execute_loop[i]; ++j)
217            for (uint32_t k=0; k<_param->_nb_inst_execute[i][j]; ++k)
218              sensitive << (*(in_EXECUTE_OOO_ENGINE_ACK [i][j][k]));
219       
220        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
221          for (uint32_t j=0; j<_param->_nb_write_unit[i]; ++j)
222            {
223              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_VAL           [i][j]))
224//                      << (*(in_EXECUTE_EXECUTE_LOOP_OPERATION     [i][j]))
225//                      << (*(in_EXECUTE_EXECUTE_LOOP_TYPE          [i][j]))
226                        << (*(in_EXECUTE_EXECUTE_LOOP_FLAGS         [i][j]))
227                        << (*(in_EXECUTE_EXECUTE_LOOP_EXCEPTION     [i][j]))
228                        << (*(in_EXECUTE_EXECUTE_LOOP_NO_SEQUENCE   [i][j]))
229                        << (*(in_EXECUTE_EXECUTE_LOOP_ADDRESS       [i][j]))
230                        << (*(in_EXECUTE_EXECUTE_LOOP_DATA          [i][j]));
231              if (_param->_have_port_context_id)
232              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_CONTEXT_ID    [i][j]));
233              if (_param->_have_port_front_end_id)
234              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_FRONT_END_ID  [i][j]));
235              if (_param->_have_port_ooo_engine_id)
236              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_OOO_ENGINE_ID [i][j]));
237              if (_param->_have_port_rob_ptr)
238              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_PACKET_ID     [i][j]));
239            }
240
241# ifdef SYSTEMCASS_SPECIFIC
242        // List dependency information
243# endif   
244
245        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_insert"),_name.c_str());
246        SC_METHOD (genMealy_insert);
247        dont_initialize ();
248//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
249        sensitive << (*(in_NRESET));
250
251        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
252          for (uint32_t j=0; j<_param->_nb_inst_insert[i]; ++j)
253            sensitive << (*(in_INSERT_OOO_ENGINE_VAL        [i][j]))
254                      << (*(in_INSERT_OOO_ENGINE_RD_USE     [i][j]))
255                      << (*(in_INSERT_OOO_ENGINE_RD_NUM_REG [i][j]))
256                      << (*(in_INSERT_OOO_ENGINE_RE_USE     [i][j]))
257                      << (*(in_INSERT_OOO_ENGINE_RE_NUM_REG [i][j]));
258        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
259          for (uint32_t j=0; j<_param->_execute_loop_nb_ooo_engine[i]; ++j)
260            for (uint32_t k=0; k<_param->_execute_loop_nb_inst_insert[i][j]; ++k)
261              sensitive << (*(in_INSERT_EXECUTE_LOOP_ACK [i][j][k]));
262
263# ifdef SYSTEMCASS_SPECIFIC
264        // List dependency information
265# endif   
266       
267#endif
268      }
269    log_end(Core_Glue,FUNCTION);
270  };
271   
272#undef  FUNCTION
273#define FUNCTION "Core_Glue::~Core_Glue"
274  Core_Glue::~Core_Glue (void)
275  {
276    log_begin(Core_Glue,FUNCTION);
277
278#ifdef STATISTICS
279    if (usage_is_set(_usage,USE_STATISTICS))
280      {
281        statistics_deallocation();
282      }
283#endif
284
285    log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
286    deallocation ();
287
288    log_end(Core_Glue,FUNCTION);
289  };
290
291}; // end namespace core_glue
292}; // end namespace core
293
294}; // end namespace behavioural
295}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.