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

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 10.8 KB
Line 
1/*
2 * $Id: Core_Glue.cpp 88 2008-12-10 18:31:39Z 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        // Constant
76        if (_param->_have_port_front_end_id)
77          for (uint32_t i=0; i<_param->_nb_front_end; ++i)
78            for (uint32_t j=0; j<_param->_nb_inst_decod [i]; ++j)
79              PORT_WRITE(out_RENAME_FRONT_END_ID [i][j],_param->_translate_num_front_end_to_ooo_engine_front_end_id[i]);
80       
81        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
82
83        SC_METHOD (transition);
84        dont_initialize ();
85        sensitive << (*(in_CLOCK)).pos();
86       
87# ifdef SYSTEMCASS_SPECIFIC
88        // List dependency information
89# endif   
90
91//      log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
92//      SC_METHOD (genMoore);
93//      dont_initialize ();
94//      sensitive << (*(in_CLOCK)).neg(); // need internal register
95
96// # ifdef SYSTEMCASS_SPECIFIC
97//      // List dependency information
98// # endif   
99
100        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_branch_complete"),_name.c_str());
101        SC_METHOD (genMealy_branch_complete);
102        dont_initialize ();
103//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
104        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
105          for (uint32_t j=0; j<_param->_front_end_nb_inst_branch_complete[i]; ++j)
106            sensitive << (*(in_BRANCH_COMPLETE_FRONT_END_ACK             [i][j]))
107                      << (*(in_BRANCH_COMPLETE_FRONT_END_MISS_PREDICTION [i][j]));
108
109        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
110          for (uint32_t j=0; j<_param->_ooo_engine_nb_inst_branch_complete[i]; ++j)
111            {
112              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_VAL            [i][j]))
113                        << (*(in_BRANCH_COMPLETE_OOO_ENGINE_ADDRESS        [i][j]))
114                        << (*(in_BRANCH_COMPLETE_OOO_ENGINE_FLAG           [i][j]));
115              if (_param->_have_port_front_end_id)
116              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_FRONT_END_ID   [i][j]));
117              if (_param->_have_port_context_id)
118              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_CONTEXT_ID     [i][j]));
119              if (_param->_have_port_depth)
120              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_DEPTH          [i][j]));
121            }   
122
123
124# ifdef SYSTEMCASS_SPECIFIC
125        // List dependency information
126# endif   
127
128        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_commit_event"),_name.c_str());
129        SC_METHOD (genMealy_commit_event);
130        dont_initialize ();
131//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
132        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
133          sensitive << (*(in_COMMIT_EVENT_FRONT_END_ACK               [i]));
134        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
135          {
136            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_VAL              [i]))
137                      << (*(in_COMMIT_EVENT_OOO_ENGINE_TYPE             [i]))
138                      << (*(in_COMMIT_EVENT_OOO_ENGINE_IS_DELAY_SLOT    [i]))
139                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS          [i]))
140                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EPCR     [i]))
141                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EEAR_VAL [i]))
142                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EEAR     [i]));
143            if (_param->_have_port_front_end_id)
144            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_FRONT_END_ID     [i]));
145            if (_param->_have_port_context_id)
146            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_CONTEXT_ID       [i]));
147            if (_param->_have_port_depth)
148            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_DEPTH            [i]));
149          }
150
151# ifdef SYSTEMCASS_SPECIFIC
152        // List dependency information
153# endif   
154
155        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_issue"),_name.c_str());
156        SC_METHOD (genMealy_issue);
157        dont_initialize ();
158//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
159
160        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
161          for (uint32_t j=0; j<_param->_nb_inst_issue [i]; ++j)
162            {
163              sensitive << (*(in_ISSUE_OOO_ENGINE_VAL                   [i][j]))
164                        << (*(in_ISSUE_OOO_ENGINE_TYPE                  [i][j]))
165                        << (*(in_ISSUE_OOO_ENGINE_OPERATION             [i][j]))
166                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [i][j]))
167                        << (*(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT          [i][j]))
168                        << (*(in_ISSUE_OOO_ENGINE_IMMEDIAT              [i][j]))
169                        << (*(in_ISSUE_OOO_ENGINE_READ_RA               [i][j]))
170                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RA            [i][j]))
171                        << (*(in_ISSUE_OOO_ENGINE_READ_RB               [i][j]))
172                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RB            [i][j]))
173                        << (*(in_ISSUE_OOO_ENGINE_READ_RC               [i][j]))
174                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RC            [i][j]))
175                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RD              [i][j]))
176                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RD            [i][j]))
177                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RE              [i][j]))
178                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RE            [i][j]));
179              if (_param->_have_port_front_end_id)
180              sensitive << (*(in_ISSUE_OOO_ENGINE_FRONT_END_ID          [i][j]));
181              if (_param->_have_port_context_id)
182              sensitive << (*(in_ISSUE_OOO_ENGINE_CONTEXT_ID            [i][j]));
183              if (_param->_have_port_rob_ptr)
184              sensitive << (*(in_ISSUE_OOO_ENGINE_PACKET_ID             [i][j]));
185              if (_param->_have_port_load_queue_ptr)
186              sensitive << (*(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE  [i][j]));
187            }
188
189        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
190          for (uint32_t j=0; j<_param->_nb_read_unit [i]; ++j)
191            sensitive << (*(in_ISSUE_EXECUTE_LOOP_ACK [i][j]));
192
193# ifdef SYSTEMCASS_SPECIFIC
194        // List dependency information
195# endif   
196
197        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_execute"),_name.c_str());
198        SC_METHOD (genMealy_execute);
199        dont_initialize ();
200//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
201
202        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
203          for (uint32_t j=0; j<_param->_ooo_engine_nb_execute_loop[i]; ++j)
204            for (uint32_t k=0; k<_param->_nb_inst_execute[i][j]; ++k)
205              sensitive << (*(in_EXECUTE_OOO_ENGINE_ACK [i][j][k]));
206       
207        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
208          for (uint32_t j=0; j<_param->_nb_write_unit[i]; ++j)
209            {
210              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_VAL           [i][j]))
211//                      << (*(in_EXECUTE_EXECUTE_LOOP_OPERATION     [i][j]))
212//                      << (*(in_EXECUTE_EXECUTE_LOOP_TYPE          [i][j]))
213                        << (*(in_EXECUTE_EXECUTE_LOOP_FLAGS         [i][j]))
214                        << (*(in_EXECUTE_EXECUTE_LOOP_EXCEPTION     [i][j]))
215                        << (*(in_EXECUTE_EXECUTE_LOOP_NO_SEQUENCE   [i][j]))
216                        << (*(in_EXECUTE_EXECUTE_LOOP_ADDRESS       [i][j]))
217                        << (*(in_EXECUTE_EXECUTE_LOOP_DATA          [i][j]));
218              if (_param->_have_port_context_id)
219              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_CONTEXT_ID    [i][j]));
220              if (_param->_have_port_front_end_id)
221              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_FRONT_END_ID  [i][j]));
222              if (_param->_have_port_ooo_engine_id)
223              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_OOO_ENGINE_ID [i][j]));
224              if (_param->_have_port_rob_ptr)
225              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_PACKET_ID     [i][j]));
226            }
227
228# ifdef SYSTEMCASS_SPECIFIC
229        // List dependency information
230# endif   
231
232        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_insert"),_name.c_str());
233        SC_METHOD (genMealy_insert);
234        dont_initialize ();
235//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
236
237        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
238          for (uint32_t j=0; j<_param->_nb_inst_insert[i]; ++j)
239            sensitive << (*(in_INSERT_OOO_ENGINE_VAL        [i][j]))
240                      << (*(in_INSERT_OOO_ENGINE_RD_USE     [i][j]))
241                      << (*(in_INSERT_OOO_ENGINE_RD_NUM_REG [i][j]))
242                      << (*(in_INSERT_OOO_ENGINE_RE_USE     [i][j]))
243                      << (*(in_INSERT_OOO_ENGINE_RE_NUM_REG [i][j]));
244        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
245          for (uint32_t j=0; j<_param->_execute_loop_nb_ooo_engine[i]; ++j)
246            for (uint32_t k=0; k<_param->_execute_loop_nb_inst_insert[i][j]; ++k)
247              sensitive << (*(in_INSERT_EXECUTE_LOOP_ACK [i][j][k]));
248
249# ifdef SYSTEMCASS_SPECIFIC
250        // List dependency information
251# endif   
252       
253#endif
254      }
255    log_end(Core_Glue,FUNCTION);
256  };
257   
258#undef  FUNCTION
259#define FUNCTION "Core_Glue::~Core_Glue"
260  Core_Glue::~Core_Glue (void)
261  {
262    log_begin(Core_Glue,FUNCTION);
263
264#ifdef STATISTICS
265    if (usage_is_set(_usage,USE_STATISTICS))
266      {
267        statistics_deallocation();
268      }
269#endif
270
271    log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
272    deallocation ();
273
274    log_end(Core_Glue,FUNCTION);
275  };
276
277}; // end namespace core_glue
278}; // end namespace core
279
280}; // end namespace behavioural
281}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.