source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Core_Glue/src/Core_Glue.cpp @ 136

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

1) Add new algo in ifetch queue
2) Add Cancel bit
3) new config

  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1/*
2 * $Id: Core_Glue.cpp 136 2009-10-20 18:52:15Z 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_CANCEL                [i][j]))
177                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [i][j]))
178                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_READ  [i][j]))
179                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_EMPTY     [i][j]))
180                        << (*(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT          [i][j]))
181                        << (*(in_ISSUE_OOO_ENGINE_IMMEDIAT              [i][j]))
182                        << (*(in_ISSUE_OOO_ENGINE_READ_RA               [i][j]))
183                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RA            [i][j]))
184                        << (*(in_ISSUE_OOO_ENGINE_READ_RB               [i][j]))
185                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RB            [i][j]))
186                        << (*(in_ISSUE_OOO_ENGINE_READ_RC               [i][j]))
187                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RC            [i][j]))
188                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RD              [i][j]))
189                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RD            [i][j]))
190                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RE              [i][j]))
191                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RE            [i][j]));
192              if (_param->_have_port_front_end_id)
193              sensitive << (*(in_ISSUE_OOO_ENGINE_FRONT_END_ID          [i][j]));
194              if (_param->_have_port_context_id)
195              sensitive << (*(in_ISSUE_OOO_ENGINE_CONTEXT_ID            [i][j]));
196              if (_param->_have_port_rob_ptr)
197              sensitive << (*(in_ISSUE_OOO_ENGINE_PACKET_ID             [i][j]));
198              if (_param->_have_port_load_queue_ptr)
199              sensitive << (*(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE  [i][j]));
200            }
201
202        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
203          for (uint32_t j=0; j<_param->_nb_read_unit [i]; ++j)
204            sensitive << (*(in_ISSUE_EXECUTE_LOOP_ACK [i][j]));
205
206# ifdef SYSTEMCASS_SPECIFIC
207        // List dependency information
208# endif   
209
210        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_execute"),_name.c_str());
211        SC_METHOD (genMealy_execute);
212        dont_initialize ();
213//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
214        sensitive << (*(in_NRESET));
215
216        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
217          for (uint32_t j=0; j<_param->_ooo_engine_nb_execute_loop[i]; ++j)
218            for (uint32_t k=0; k<_param->_nb_inst_execute[i][j]; ++k)
219              sensitive << (*(in_EXECUTE_OOO_ENGINE_ACK [i][j][k]));
220       
221        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
222          for (uint32_t j=0; j<_param->_nb_write_unit[i]; ++j)
223            {
224              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_VAL           [i][j]))
225//                      << (*(in_EXECUTE_EXECUTE_LOOP_OPERATION     [i][j]))
226//                      << (*(in_EXECUTE_EXECUTE_LOOP_TYPE          [i][j]))
227                        << (*(in_EXECUTE_EXECUTE_LOOP_CANCEL        [i][j]))
228                        << (*(in_EXECUTE_EXECUTE_LOOP_FLAGS         [i][j]))
229                        << (*(in_EXECUTE_EXECUTE_LOOP_EXCEPTION     [i][j]))
230                        << (*(in_EXECUTE_EXECUTE_LOOP_NO_SEQUENCE   [i][j]))
231                        << (*(in_EXECUTE_EXECUTE_LOOP_ADDRESS       [i][j]))
232                        << (*(in_EXECUTE_EXECUTE_LOOP_DATA          [i][j]));
233              if (_param->_have_port_context_id)
234              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_CONTEXT_ID    [i][j]));
235              if (_param->_have_port_front_end_id)
236              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_FRONT_END_ID  [i][j]));
237              if (_param->_have_port_ooo_engine_id)
238              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_OOO_ENGINE_ID [i][j]));
239              if (_param->_have_port_rob_ptr)
240              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_PACKET_ID     [i][j]));
241            }
242
243# ifdef SYSTEMCASS_SPECIFIC
244        // List dependency information
245# endif   
246
247//      log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_insert"),_name.c_str());
248//      SC_METHOD (genMealy_insert);
249//      dont_initialize ();
250// //   sensitive << (*(in_CLOCK)).neg(); // don't need internal register
251//      sensitive << (*(in_NRESET));
252
253//         for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
254//           for (uint32_t j=0; j<_param->_nb_inst_insert[i]; ++j)
255//             sensitive << (*(in_INSERT_OOO_ENGINE_VAL        [i][j]))
256//                       << (*(in_INSERT_OOO_ENGINE_RD_USE     [i][j]))
257//                       << (*(in_INSERT_OOO_ENGINE_RD_NUM_REG [i][j]))
258//                       << (*(in_INSERT_OOO_ENGINE_RE_USE     [i][j]))
259//                       << (*(in_INSERT_OOO_ENGINE_RE_NUM_REG [i][j]));
260//         for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
261//           for (uint32_t j=0; j<_param->_execute_loop_nb_ooo_engine[i]; ++j)
262//             for (uint32_t k=0; k<_param->_execute_loop_nb_inst_insert[i][j]; ++k)
263//               sensitive << (*(in_INSERT_EXECUTE_LOOP_ACK [i][j][k]));
264
265// # ifdef SYSTEMCASS_SPECIFIC
266//      // List dependency information
267// # endif   
268       
269#endif
270      }
271    log_end(Core_Glue,FUNCTION);
272  };
273   
274#undef  FUNCTION
275#define FUNCTION "Core_Glue::~Core_Glue"
276  Core_Glue::~Core_Glue (void)
277  {
278    log_begin(Core_Glue,FUNCTION);
279
280#ifdef STATISTICS
281    if (usage_is_set(_usage,USE_STATISTICS))
282      {
283        statistics_deallocation();
284      }
285#endif
286
287    log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
288    deallocation ();
289
290    log_end(Core_Glue,FUNCTION);
291  };
292
293}; // end namespace core_glue
294}; // end namespace core
295
296}; // end namespace behavioural
297}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.