source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/src/Read_queue_transition.cpp @ 97

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

1) Update Prediction Table : statistics
2) Size instruction address on 30 bits
3) Change Log File
4) Add debug_level in simulation configuration file

  • Property svn:keywords set to Id
File size: 10.3 KB
Line 
1#ifdef SYSTEMC
2//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id: Read_queue_transition.cpp 97 2008-12-19 15:34:00Z rosiere $
5 *
6 * [ Description ]
7 *
8 */
9
10#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/include/Read_queue.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace core {
15namespace multi_execute_loop {
16namespace execute_loop {
17namespace multi_read_unit {
18namespace read_unit {
19namespace read_queue {
20
21
22#undef  FUNCTION
23#define FUNCTION "Read_queue::transition"
24  void Read_queue::transition (void)
25  {
26    log_begin(Read_queue,FUNCTION);
27    log_function(Read_queue,FUNCTION,_name.c_str());
28
29    if (PORT_READ(in_NRESET) == 0)
30      {
31        // Flush queue
32        // FIXME "queue reset"
33        // > 1) flush one slot by cycle
34        // > 2) flush all slot in one cycle
35
36        _queue->clear();
37
38        // Init, else error in registerfile
39        _queue_head->_ooo_engine_id = 0;
40      }
41    else
42      {
43//      cout << "Transition Begin  : Print queue_head" << endl;
44//      if (_queue->empty ())
45//        cout << "queue is empty !!!" << endl;
46//      else
47//        cout << (*_queue_head) << endl;
48
49        log_printf(TRACE,Read_queue,FUNCTION,"  * Read_queue size (begin) : %d",(int)_queue->size());
50        // Write to read_queue
51
52        bool not_full      = not (_queue->size() == _param->_size_queue);
53        bool     empty     =     _queue->empty();
54        bool need_new_head = false;
55       
56        log_printf(TRACE,Read_queue,FUNCTION,"    * test transaction READ_QUEUE_IN  : %d,%d",PORT_READ(in_READ_QUEUE_IN_VAL), not_full);
57        if ((PORT_READ(in_READ_QUEUE_IN_VAL) == 1) and not_full)
58          {
59            Tread_queue_entry_t * entry = new Tread_queue_entry_t;
60
61            if(_param->_have_port_context_id   )
62              entry->_context_id   = PORT_READ(in_READ_QUEUE_IN_CONTEXT_ID  );
63            if(_param->_have_port_front_end_id )
64              entry->_front_end_id = PORT_READ(in_READ_QUEUE_IN_FRONT_END_ID);
65            if(_param->_have_port_ooo_engine_id)
66              entry->_ooo_engine_id= PORT_READ(in_READ_QUEUE_IN_OOO_ENGINE_ID);
67            if(_param->_have_port_rob_ptr      )
68              entry->_rob_id       = PORT_READ(in_READ_QUEUE_IN_ROB_ID      );
69            entry->_operation    = PORT_READ(in_READ_QUEUE_IN_OPERATION   );
70            entry->_type         = PORT_READ(in_READ_QUEUE_IN_TYPE        );
71            entry->_store_queue_ptr_write = PORT_READ(in_READ_QUEUE_IN_STORE_QUEUE_PTR_WRITE);
72            if (_param->_have_port_load_queue_ptr)
73            entry->_load_queue_ptr_write  = PORT_READ(in_READ_QUEUE_IN_LOAD_QUEUE_PTR_WRITE );
74            entry->_has_immediat = PORT_READ(in_READ_QUEUE_IN_HAS_IMMEDIAT);
75            entry->_immediat     = PORT_READ(in_READ_QUEUE_IN_IMMEDIAT    );
76            entry->_read_ra      = PORT_READ(in_READ_QUEUE_IN_READ_RA     );
77            entry->_num_reg_ra   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RA  );
78            entry->_read_rb      = PORT_READ(in_READ_QUEUE_IN_READ_RB     );
79            entry->_num_reg_rb   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RB  );
80            entry->_read_rc      = PORT_READ(in_READ_QUEUE_IN_READ_RC     );
81            entry->_num_reg_rc   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RC  );
82            entry->_write_rd     = PORT_READ(in_READ_QUEUE_IN_WRITE_RD    );
83            entry->_num_reg_rd   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RD  );
84            entry->_write_re     = PORT_READ(in_READ_QUEUE_IN_WRITE_RE    );
85            entry->_num_reg_re   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RE  );
86
87            log_printf(TRACE,Read_queue,FUNCTION,"    * push (id : %d-%d)",entry->_context_id, entry->_rob_id);
88            _queue->push_back(entry);
89
90            // read next new head
91            if (empty)
92              {
93                log_printf(TRACE,Read_queue,FUNCTION,"    * queue was    empty");
94                need_new_head = true;
95              }
96          }
97
98        // Read from read_queue
99        log_printf(TRACE,Read_queue,FUNCTION,"  * test transaction READ_QUEUE_OUT : %d,%d",internal_READ_QUEUE_OUT_VAL, PORT_READ(in_READ_QUEUE_OUT_ACK));
100        if ((    internal_READ_QUEUE_OUT_VAL  == 1) and
101            (PORT_READ(in_READ_QUEUE_OUT_ACK) == 1))
102          {
103            // Pop the entry
104            log_printf(TRACE,Read_queue,FUNCTION,"    * pop  (id : %d-%d)",_queue->front()->_context_id, _queue->front()->_rob_id);
105            _queue->pop_front();
106
107            // read next new head
108            if (_queue->empty() == false)
109              {
110                log_printf(TRACE,Read_queue,FUNCTION,"    * queue was not empty");
111                need_new_head = true;
112              }
113          }
114        else
115          {
116            // no transaction, update queue_head
117            _queue_head->_read_ra_val = internal_READ_QUEUE_OUT_READ_RA_VAL ;
118            _queue_head->_data_ra_val = internal_READ_QUEUE_OUT_DATA_RA_VAL ;
119            _queue_head->_data_ra     = internal_READ_QUEUE_OUT_DATA_RA     ;
120
121            _queue_head->_read_rb_val = internal_READ_QUEUE_OUT_READ_RB_VAL ;
122            _queue_head->_data_rb_val = internal_READ_QUEUE_OUT_DATA_RB_VAL ;
123            _queue_head->_data_rb     = internal_READ_QUEUE_OUT_DATA_RB     ;
124
125            _queue_head->_read_rc_val = internal_READ_QUEUE_OUT_READ_RC_VAL ;
126            _queue_head->_data_rc_val = internal_READ_QUEUE_OUT_DATA_RC_VAL ;
127            _queue_head->_data_rc     = internal_READ_QUEUE_OUT_DATA_RC     ;
128          }
129
130        if (need_new_head == true)
131          {
132            log_printf(TRACE,Read_queue,FUNCTION,"  * new head");
133            (*_queue_head) = (*_queue->front());
134          }
135       
136//      cout << "Transition End    : Print queue_head" << endl;
137//      if (_queue->empty ())
138//        cout << "queue is empty !!!" << endl;
139//      else
140//        cout << (*_queue_head) << endl;
141
142#if (DEBUG >= DEBUG_TRACE) and (DEBUG_Read_queue == true)
143        log_printf(TRACE,Read_queue,FUNCTION,"  * Dump Read_queue");
144        log_printf(TRACE,Read_queue,FUNCTION,"    * size : %d",(int)_queue->size());
145
146        if (_queue->size()>0)
147          {
148//   protected : Tread_queue_head_entry_t       * _queue_head;
149//   protected : std::queue<Tread_queue_entry_t *>   * _queue;
150           
151            log_printf(TRACE,Read_queue,FUNCTION,"    * [%.4d] %.2d %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d, %.1d %.8x, %.1d %.1d %.4d %.1d %.8x, %.1d %.1d %.4d %.1d %.8x, %.1d %.1d %.4d %.1d %.2x, %.1d %.4d, %.1d %.4d (%s)",
152                       0,
153
154                       _queue_head->_context_id           ,
155                       _queue_head->_front_end_id         ,
156                       _queue_head->_ooo_engine_id        ,
157                       _queue_head->_rob_id               ,
158
159                       _queue_head->_type                 ,
160                       _queue_head->_operation            ,
161
162                       _queue_head->_store_queue_ptr_write,
163                       _queue_head->_load_queue_ptr_write ,
164
165                       _queue_head->_has_immediat         ,
166                       _queue_head->_immediat             ,
167
168                       _queue_head->_read_ra              ,
169                       _queue_head->_read_ra_val          ,
170                       _queue_head->_num_reg_ra           ,
171                       _queue_head->_data_ra_val          ,
172                       _queue_head->_data_ra              ,
173
174                       _queue_head->_read_rb              ,
175                       _queue_head->_read_rb_val          ,
176                       _queue_head->_num_reg_rb           ,
177                       _queue_head->_data_rb_val          ,
178                       _queue_head->_data_rb              ,
179
180                       _queue_head->_read_rc              ,
181                       _queue_head->_read_rc_val          ,
182                       _queue_head->_num_reg_rc           ,
183                       _queue_head->_data_rc_val          ,
184                       _queue_head->_data_rc              ,
185
186                       _queue_head->_write_rd             ,
187                       _queue_head->_num_reg_rd           ,
188                       
189                       _queue_head->_write_re             ,
190                       _queue_head->_num_reg_re           ,
191
192                       toString(_queue_head->_type).c_str());
193
194
195            std::list<Tread_queue_entry_t *>::iterator it=_queue->begin();
196            ++it; // first is already printed
197            uint32_t i=1;
198
199            for (;it!=_queue->end(); ++it)
200              {
201                log_printf(TRACE,Read_queue,FUNCTION,"    * [%.4d] %.2d %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d, %.1d %.8x, %.1d   %.4d           , %.1d   %.4d           , %.1d   %.4d     , %.1d %.4d, %.1d %.4d (%s)",
202                           i,
203                           
204                           (*it)->_context_id           ,
205                           (*it)->_front_end_id         ,
206                           (*it)->_ooo_engine_id        ,
207                           (*it)->_rob_id               ,
208                           
209                           (*it)->_type                 ,
210                           (*it)->_operation            ,
211                           
212                           (*it)->_store_queue_ptr_write,
213                           (*it)->_load_queue_ptr_write ,
214                           
215                           (*it)->_has_immediat         ,
216                           (*it)->_immediat             ,
217                           
218                           (*it)->_read_ra              ,
219//                         (*it)->_read_ra_val          ,
220                           (*it)->_num_reg_ra           ,
221//                         (*it)->_data_ra_val          ,
222//                         (*it)->_data_ra              ,
223                           
224                           (*it)->_read_rb              ,
225//                         (*it)->_read_rb_val          ,
226                           (*it)->_num_reg_rb           ,
227//                         (*it)->_data_rb_val          ,
228//                         (*it)->_data_rb              ,
229                           
230                           (*it)->_read_rc              ,
231//                         (*it)->_read_rc_val          ,
232                           (*it)->_num_reg_rc           ,
233//                         (*it)->_data_rc_val          ,
234//                         (*it)->_data_rc              ,
235                           
236                           (*it)->_write_rd             ,
237                           (*it)->_num_reg_rd           ,
238                           
239                           (*it)->_write_re             ,
240                           (*it)->_num_reg_re           ,
241
242                           toString((*it)->_type).c_str());
243
244                ++i;
245              }
246          }
247#endif
248
249
250      }
251
252#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
253        end_cycle ();
254#endif
255
256    log_end(Read_queue,FUNCTION);
257  };
258
259}; // end namespace read_queue
260}; // end namespace read_unit
261}; // end namespace multi_read_unit
262}; // end namespace execute_loop
263}; // end namespace multi_execute_loop
264}; // end namespace core
265
266}; // end namespace behavioural
267}; // end namespace morpheo             
268#endif
269//#endif
Note: See TracBrowser for help on using the repository browser.