source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit.cpp @ 121

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

1) Commit_unit : remove read information of ROB

  • Property svn:keywords set to Id
File size: 11.0 KB
Line 
1/*
2 * $Id: Commit_unit.cpp 121 2009-05-27 10:13:56Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h"
9#include "Behavioural/include/Simulation.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace commit_unit {
17
18
19#undef  FUNCTION
20#define FUNCTION "Commit_unit::Commit_unit"
21  Commit_unit::Commit_unit
22  (
23#ifdef SYSTEMC
24   sc_module_name name,
25#else
26   string name,
27#endif
28#ifdef STATISTICS
29   morpheo::behavioural::Parameters_Statistics * param_statistics,
30#endif
31   morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::Parameters * param,
32   morpheo::behavioural::Tusage_t usage
33   ):
34    _name              (name)
35    ,_param            (param)
36    ,_usage            (usage)
37  {
38    log_begin(Commit_unit,FUNCTION);
39
40    usage_environment(_usage);
41
42#if DEBUG_Commit_unit == true
43    log_printf(TRACE,Commit_unit,FUNCTION,_("<%s> Parameters"),_name.c_str());
44
45    std::cout << *param << std::endl;
46#endif
47
48    log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Allocation"),_name.c_str());
49
50    allocation (
51#ifdef STATISTICS
52                param_statistics
53#endif
54                );
55
56#ifdef STATISTICS
57    if (usage_is_set(_usage,USE_STATISTICS))
58      { 
59        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Allocation of statistics"),_name.c_str());
60
61        statistics_allocation(param_statistics);
62      }
63#endif
64
65#ifdef VHDL
66    if (usage_is_set(_usage,USE_VHDL))
67      {
68        // generate the vhdl
69        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Generate the vhdl"),_name.c_str());
70       
71        vhdl();
72      }
73#endif
74
75#ifdef SYSTEMC
76    if (usage_is_set(_usage,USE_SYSTEMC))
77      {
78        // Constant
79        for (uint32_t i=0; i<_param->_nb_front_end; i++)
80          for (uint32_t j=0; j<_param->_nb_context [i]; j++)
81            {
82              internal_EVENT_ACK [i][j] = 1;
83              PORT_WRITE(out_EVENT_ACK [i][j], internal_EVENT_ACK [i][j]);
84
85              internal_RETIRE_EVENT_VAL [i][j] = 1;
86              PORT_WRITE(out_RETIRE_EVENT_VAL [i][j], internal_RETIRE_EVENT_VAL [i][j]);
87            }
88
89        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - transition"),_name.c_str());
90
91        SC_METHOD (transition);
92        dont_initialize ();
93        sensitive << (*(in_CLOCK)).pos();
94       
95# ifdef SYSTEMCASS_SPECIFIC
96        // List dependency information
97# endif   
98
99        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMoore"),_name.c_str());
100
101        SC_METHOD (genMoore);
102        dont_initialize ();
103        sensitive << (*(in_CLOCK)).neg(); // need internal register
104       
105# ifdef SYSTEMCASS_SPECIFIC
106        // List dependency information
107# endif   
108
109        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_insert"),_name.c_str());
110
111        SC_METHOD (genMealy_insert);
112        dont_initialize ();
113        sensitive << (*(in_CLOCK)).neg(); // need internal register
114//      for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
115//        for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
116//          sensitive << (*(in_INSERT_VAL [i][j]));
117
118# ifdef SYSTEMCASS_SPECIFIC
119        // List dependency information
120//      for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
121//        for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
122//          for (uint32_t x=0; x<_param->_nb_rename_unit; x++)
123//            for (uint32_t y=0; y<_param->_nb_inst_insert[x]; y++)
124//              {
125//                (*(out_INSERT_ACK       [i][j])) (*(in_INSERT_VAL [x][y]));
126//                if (_param->_have_port_rob_ptr)
127//                (*(out_INSERT_PACKET_ID [i][j])) (*(in_INSERT_VAL [x][y]));
128//              }
129# endif   
130
131        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_retire"),_name.c_str());
132
133        SC_METHOD (genMealy_retire);
134        dont_initialize ();
135        sensitive << (*(in_CLOCK)).neg(); // need internal register
136        for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
137          for (uint32_t j=0; j<_param->_nb_inst_retire[i]; j++)
138            sensitive << (*(in_RETIRE_ACK [i][j]));
139
140        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
141          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
142            sensitive << (*(in_SPR_WRITE_ACK [i][j]));
143
144# ifdef SYSTEMCASS_SPECIFIC
145        // List dependency information
146        for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
147          for (uint32_t j=0; j<_param->_nb_inst_retire[i]; j++)
148            {
149              for (uint32_t x=0; x<_param->_nb_rename_unit; x++)
150                for (uint32_t y=0; y<_param->_nb_inst_retire[x]; y++)
151                  {
152                    (*(out_RETIRE_VAL                   [i][j])) (*(in_RETIRE_ACK [x][y]));
153                    if (_param->_have_port_front_end_id)
154                    (*(out_RETIRE_FRONT_END_ID          [i][j])) (*(in_RETIRE_ACK [x][y]));
155                    if (_param->_have_port_context_id)
156                    (*(out_RETIRE_CONTEXT_ID            [i][j])) (*(in_RETIRE_ACK [x][y]));
157//                  (*(out_RETIRE_RENAME_UNIT_ID        [i][j])) (*(in_RETIRE_ACK [x][y]));
158                    (*(out_RETIRE_USE_STORE_QUEUE       [i][j])) (*(in_RETIRE_ACK [x][y]));
159                    (*(out_RETIRE_USE_LOAD_QUEUE        [i][j])) (*(in_RETIRE_ACK [x][y]));
160                    (*(out_RETIRE_STORE_QUEUE_PTR_WRITE [i][j])) (*(in_RETIRE_ACK [x][y]));
161                    if (_param->_have_port_load_queue_ptr)
162                    (*(out_RETIRE_LOAD_QUEUE_PTR_WRITE  [i][j])) (*(in_RETIRE_ACK [x][y]));
163//                  (*(out_RETIRE_READ_RA               [i][j])) (*(in_RETIRE_ACK [x][y]));
164//                  (*(out_RETIRE_NUM_REG_RA_PHY        [i][j])) (*(in_RETIRE_ACK [x][y]));
165//                  (*(out_RETIRE_READ_RB               [i][j])) (*(in_RETIRE_ACK [x][y]));
166//                  (*(out_RETIRE_NUM_REG_RB_PHY        [i][j])) (*(in_RETIRE_ACK [x][y]));
167//                  (*(out_RETIRE_READ_RC               [i][j])) (*(in_RETIRE_ACK [x][y]));
168//                  (*(out_RETIRE_NUM_REG_RC_PHY        [i][j])) (*(in_RETIRE_ACK [x][y]));
169                    (*(out_RETIRE_WRITE_RD              [i][j])) (*(in_RETIRE_ACK [x][y]));
170                    (*(out_RETIRE_NUM_REG_RD_LOG        [i][j])) (*(in_RETIRE_ACK [x][y]));
171                    (*(out_RETIRE_NUM_REG_RD_PHY_OLD    [i][j])) (*(in_RETIRE_ACK [x][y]));
172                    (*(out_RETIRE_NUM_REG_RD_PHY_NEW    [i][j])) (*(in_RETIRE_ACK [x][y]));
173                    (*(out_RETIRE_WRITE_RE              [i][j])) (*(in_RETIRE_ACK [x][y]));
174                    (*(out_RETIRE_NUM_REG_RE_LOG        [i][j])) (*(in_RETIRE_ACK [x][y]));
175                    (*(out_RETIRE_NUM_REG_RE_PHY_OLD    [i][j])) (*(in_RETIRE_ACK [x][y]));
176                    (*(out_RETIRE_NUM_REG_RE_PHY_NEW    [i][j])) (*(in_RETIRE_ACK [x][y]));
177                  }
178
179              for (uint32_t x=0; x<_param->_nb_front_end; ++x)
180                for (uint32_t y=0; y<_param->_nb_context[x]; ++y)
181                  {
182                    (*(out_RETIRE_VAL                   [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
183                    if (_param->_have_port_front_end_id)
184                    (*(out_RETIRE_FRONT_END_ID          [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
185                    if (_param->_have_port_context_id)
186                    (*(out_RETIRE_CONTEXT_ID            [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
187//                  (*(out_RETIRE_RENAME_UNIT_ID        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
188                    (*(out_RETIRE_USE_STORE_QUEUE       [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
189                    (*(out_RETIRE_USE_LOAD_QUEUE        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
190                    (*(out_RETIRE_STORE_QUEUE_PTR_WRITE [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
191                    if (_param->_have_port_load_queue_ptr)
192                    (*(out_RETIRE_LOAD_QUEUE_PTR_WRITE  [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
193//                  (*(out_RETIRE_READ_RA               [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
194//                  (*(out_RETIRE_NUM_REG_RA_PHY        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
195//                  (*(out_RETIRE_READ_RB               [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
196//                  (*(out_RETIRE_NUM_REG_RB_PHY        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
197//                  (*(out_RETIRE_READ_RC               [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
198//                  (*(out_RETIRE_NUM_REG_RC_PHY        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
199                    (*(out_RETIRE_WRITE_RD              [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
200                    (*(out_RETIRE_NUM_REG_RD_LOG        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
201                    (*(out_RETIRE_NUM_REG_RD_PHY_OLD    [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
202                    (*(out_RETIRE_NUM_REG_RD_PHY_NEW    [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
203                    (*(out_RETIRE_WRITE_RE              [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
204                    (*(out_RETIRE_NUM_REG_RE_LOG        [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
205                    (*(out_RETIRE_NUM_REG_RE_PHY_OLD    [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
206                    (*(out_RETIRE_NUM_REG_RE_PHY_NEW    [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
207                  }
208            }
209
210        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
211          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
212            {
213              for (uint32_t x=0; x<_param->_nb_rename_unit; x++)
214                for (uint32_t y=0; y<_param->_nb_inst_retire[x]; y++)
215                  {
216                    (*(out_SPR_WRITE_VAL       [i][j])) (*(in_RETIRE_ACK [x][y]));
217                    (*(out_SPR_WRITE_SR_F_VAL  [i][j])) (*(in_RETIRE_ACK [x][y]));
218                    (*(out_SPR_WRITE_SR_F      [i][j])) (*(in_RETIRE_ACK [x][y]));
219                    (*(out_SPR_WRITE_SR_CY_VAL [i][j])) (*(in_RETIRE_ACK [x][y]));
220                    (*(out_SPR_WRITE_SR_CY     [i][j])) (*(in_RETIRE_ACK [x][y]));
221                    (*(out_SPR_WRITE_SR_OV_VAL [i][j])) (*(in_RETIRE_ACK [x][y]));
222                    (*(out_SPR_WRITE_SR_OV     [i][j])) (*(in_RETIRE_ACK [x][y]));
223                  }
224
225              for (uint32_t x=0; x<_param->_nb_front_end; ++x)
226                for (uint32_t y=0; y<_param->_nb_context[x]; ++y)
227                  {
228                    (*(out_SPR_WRITE_VAL       [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
229                    (*(out_SPR_WRITE_SR_F_VAL  [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
230                    (*(out_SPR_WRITE_SR_F      [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
231                    (*(out_SPR_WRITE_SR_CY_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
232                    (*(out_SPR_WRITE_SR_CY     [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
233                    (*(out_SPR_WRITE_SR_OV_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
234                    (*(out_SPR_WRITE_SR_OV     [i][j])) (*(in_SPR_WRITE_ACK [x][y]));
235                  }
236            }
237# endif   
238
239        log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_commit"),_name.c_str());
240
241        SC_METHOD (genMealy_commit);
242        dont_initialize ();
243        sensitive << (*(in_CLOCK)).neg(); // need internal register
244        for (uint32_t j=0; j<_param->_nb_inst_commit; j++)
245          {
246            sensitive << (*(in_COMMIT_VAL [j]));
247            if (_param->_have_port_rob_ptr)
248              sensitive << (*(in_COMMIT_PACKET_ID [j]));
249          }
250
251# ifdef SYSTEMCASS_SPECIFIC
252        // List dependency information
253        for (uint32_t j=0; j<_param->_nb_inst_commit; j++)
254          for (uint32_t y=0; y<_param->_nb_inst_commit; y++)
255            {
256              (*(out_COMMIT_ACK [j])) (*(in_COMMIT_VAL       [y]));
257              if (_param->_have_port_rob_ptr)
258                (*(out_COMMIT_ACK [j])) (*(in_COMMIT_PACKET_ID [y]));
259            }
260# endif   
261       
262#endif
263
264        // Init stop condition
265        while (_simulation_nb_instruction_commited.size() < _param->_nb_thread)
266          _simulation_nb_instruction_commited.push_back(0);
267      }
268    log_end(Commit_unit,FUNCTION);
269  };
270   
271#undef  FUNCTION
272#define FUNCTION "Commit_unit::~Commit_unit"
273  Commit_unit::~Commit_unit (void)
274  {
275    log_begin(Commit_unit,FUNCTION);
276
277#ifdef STATISTICS
278    if (usage_is_set(_usage,USE_STATISTICS))
279      {
280        statistics_deallocation();
281      }
282#endif
283
284    log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Deallocation"),_name.c_str());
285    deallocation ();
286
287    log_end(Commit_unit,FUNCTION);
288  };
289
290}; // end namespace commit_unit
291}; // end namespace ooo_engine
292}; // end namespace multi_ooo_engine
293}; // end namespace core
294
295}; // end namespace behavioural
296}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.