source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Core_Glue/src/Core_Glue.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: 11.0 KB
Line 
1/*
2 * $Id: Core_Glue.cpp 131 2009-07-08 18:40:08Z 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        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
112          for (uint32_t j=0; j<_param->_front_end_nb_inst_branch_complete[i]; ++j)
113            sensitive << (*(in_BRANCH_COMPLETE_FRONT_END_ACK             [i][j]))
114                      << (*(in_BRANCH_COMPLETE_FRONT_END_MISS_PREDICTION [i][j]));
115
116        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
117          for (uint32_t j=0; j<_param->_ooo_engine_nb_inst_branch_complete[i]; ++j)
118            {
119              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_VAL            [i][j]))
120                        << (*(in_BRANCH_COMPLETE_OOO_ENGINE_ADDRESS        [i][j]))
121                        << (*(in_BRANCH_COMPLETE_OOO_ENGINE_NO_SEQUENCE    [i][j]));
122              if (_param->_have_port_front_end_id)
123              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_FRONT_END_ID   [i][j]));
124              if (_param->_have_port_context_id)
125              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_CONTEXT_ID     [i][j]));
126              if (_param->_have_port_depth)
127              sensitive << (*(in_BRANCH_COMPLETE_OOO_ENGINE_DEPTH          [i][j]));
128            }   
129
130
131# ifdef SYSTEMCASS_SPECIFIC
132        // List dependency information
133# endif   
134
135        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_commit_event"),_name.c_str());
136        SC_METHOD (genMealy_commit_event);
137        dont_initialize ();
138//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
139        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
140          sensitive << (*(in_COMMIT_EVENT_FRONT_END_ACK               [i]));
141        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
142          {
143            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_VAL              [i]))
144                      << (*(in_COMMIT_EVENT_OOO_ENGINE_TYPE             [i]))
145                      << (*(in_COMMIT_EVENT_OOO_ENGINE_IS_DELAY_SLOT    [i]))
146                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS          [i]))
147                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EPCR_VAL [i]))
148                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EPCR     [i]))
149                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EEAR_VAL [i]))
150                      << (*(in_COMMIT_EVENT_OOO_ENGINE_ADDRESS_EEAR     [i]));
151            if (_param->_have_port_front_end_id)
152            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_FRONT_END_ID     [i]));
153            if (_param->_have_port_context_id)
154            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_CONTEXT_ID       [i]));
155            if (_param->_have_port_depth)
156            sensitive << (*(in_COMMIT_EVENT_OOO_ENGINE_DEPTH            [i]));
157          }
158
159# ifdef SYSTEMCASS_SPECIFIC
160        // List dependency information
161# endif   
162
163        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_issue"),_name.c_str());
164        SC_METHOD (genMealy_issue);
165        dont_initialize ();
166//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
167
168        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
169          for (uint32_t j=0; j<_param->_nb_inst_issue_queue [i]; ++j)
170            {
171              sensitive << (*(in_ISSUE_OOO_ENGINE_VAL                   [i][j]))
172                        << (*(in_ISSUE_OOO_ENGINE_TYPE                  [i][j]))
173                        << (*(in_ISSUE_OOO_ENGINE_OPERATION             [i][j]))
174                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [i][j]))
175                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_READ  [i][j]))
176                        << (*(in_ISSUE_OOO_ENGINE_STORE_QUEUE_EMPTY     [i][j]))
177                        << (*(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT          [i][j]))
178                        << (*(in_ISSUE_OOO_ENGINE_IMMEDIAT              [i][j]))
179                        << (*(in_ISSUE_OOO_ENGINE_READ_RA               [i][j]))
180                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RA            [i][j]))
181                        << (*(in_ISSUE_OOO_ENGINE_READ_RB               [i][j]))
182                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RB            [i][j]))
183                        << (*(in_ISSUE_OOO_ENGINE_READ_RC               [i][j]))
184                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RC            [i][j]))
185                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RD              [i][j]))
186                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RD            [i][j]))
187                        << (*(in_ISSUE_OOO_ENGINE_WRITE_RE              [i][j]))
188                        << (*(in_ISSUE_OOO_ENGINE_NUM_REG_RE            [i][j]));
189              if (_param->_have_port_front_end_id)
190              sensitive << (*(in_ISSUE_OOO_ENGINE_FRONT_END_ID          [i][j]));
191              if (_param->_have_port_context_id)
192              sensitive << (*(in_ISSUE_OOO_ENGINE_CONTEXT_ID            [i][j]));
193              if (_param->_have_port_rob_ptr)
194              sensitive << (*(in_ISSUE_OOO_ENGINE_PACKET_ID             [i][j]));
195              if (_param->_have_port_load_queue_ptr)
196              sensitive << (*(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE  [i][j]));
197            }
198
199        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
200          for (uint32_t j=0; j<_param->_nb_read_unit [i]; ++j)
201            sensitive << (*(in_ISSUE_EXECUTE_LOOP_ACK [i][j]));
202
203# ifdef SYSTEMCASS_SPECIFIC
204        // List dependency information
205# endif   
206
207        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_execute"),_name.c_str());
208        SC_METHOD (genMealy_execute);
209        dont_initialize ();
210//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
211
212        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
213          for (uint32_t j=0; j<_param->_ooo_engine_nb_execute_loop[i]; ++j)
214            for (uint32_t k=0; k<_param->_nb_inst_execute[i][j]; ++k)
215              sensitive << (*(in_EXECUTE_OOO_ENGINE_ACK [i][j][k]));
216       
217        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
218          for (uint32_t j=0; j<_param->_nb_write_unit[i]; ++j)
219            {
220              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_VAL           [i][j]))
221//                      << (*(in_EXECUTE_EXECUTE_LOOP_OPERATION     [i][j]))
222//                      << (*(in_EXECUTE_EXECUTE_LOOP_TYPE          [i][j]))
223                        << (*(in_EXECUTE_EXECUTE_LOOP_FLAGS         [i][j]))
224                        << (*(in_EXECUTE_EXECUTE_LOOP_EXCEPTION     [i][j]))
225                        << (*(in_EXECUTE_EXECUTE_LOOP_NO_SEQUENCE   [i][j]))
226                        << (*(in_EXECUTE_EXECUTE_LOOP_ADDRESS       [i][j]))
227                        << (*(in_EXECUTE_EXECUTE_LOOP_DATA          [i][j]));
228              if (_param->_have_port_context_id)
229              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_CONTEXT_ID    [i][j]));
230              if (_param->_have_port_front_end_id)
231              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_FRONT_END_ID  [i][j]));
232              if (_param->_have_port_ooo_engine_id)
233              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_OOO_ENGINE_ID [i][j]));
234              if (_param->_have_port_rob_ptr)
235              sensitive << (*(in_EXECUTE_EXECUTE_LOOP_PACKET_ID     [i][j]));
236            }
237
238# ifdef SYSTEMCASS_SPECIFIC
239        // List dependency information
240# endif   
241
242        log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Method - genMealy_insert"),_name.c_str());
243        SC_METHOD (genMealy_insert);
244        dont_initialize ();
245//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
246
247        for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i)
248          for (uint32_t j=0; j<_param->_nb_inst_insert[i]; ++j)
249            sensitive << (*(in_INSERT_OOO_ENGINE_VAL        [i][j]))
250                      << (*(in_INSERT_OOO_ENGINE_RD_USE     [i][j]))
251                      << (*(in_INSERT_OOO_ENGINE_RD_NUM_REG [i][j]))
252                      << (*(in_INSERT_OOO_ENGINE_RE_USE     [i][j]))
253                      << (*(in_INSERT_OOO_ENGINE_RE_NUM_REG [i][j]));
254        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
255          for (uint32_t j=0; j<_param->_execute_loop_nb_ooo_engine[i]; ++j)
256            for (uint32_t k=0; k<_param->_execute_loop_nb_inst_insert[i][j]; ++k)
257              sensitive << (*(in_INSERT_EXECUTE_LOOP_ACK [i][j][k]));
258
259# ifdef SYSTEMCASS_SPECIFIC
260        // List dependency information
261# endif   
262       
263#endif
264      }
265    log_end(Core_Glue,FUNCTION);
266  };
267   
268#undef  FUNCTION
269#define FUNCTION "Core_Glue::~Core_Glue"
270  Core_Glue::~Core_Glue (void)
271  {
272    log_begin(Core_Glue,FUNCTION);
273
274#ifdef STATISTICS
275    if (usage_is_set(_usage,USE_STATISTICS))
276      {
277        statistics_deallocation();
278      }
279#endif
280
281    log_printf(INFO,Core_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str());
282    deallocation ();
283
284    log_end(Core_Glue,FUNCTION);
285  };
286
287}; // end namespace core_glue
288}; // end namespace core
289
290}; // end namespace behavioural
291}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.