source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Write_queue/src/Write_queue_transition.cpp @ 128

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

1) Correct bug in link two signal
2) Fix error detected with valgrind
3) modif distexe script

  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1#ifdef SYSTEMC
2//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id: Write_queue_transition.cpp 128 2009-06-26 08:43:23Z rosiere $
5 *
6 * [ Description ]
7 *
8 */
9
10#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Write_queue/include/Write_queue.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace core {
15namespace multi_execute_loop {
16namespace execute_loop {
17namespace multi_write_unit {
18namespace write_unit {
19namespace write_queue {
20
21#undef  FUNCTION
22#define FUNCTION "Write_queue::transition"
23  void Write_queue::transition (void)
24  {
25    log_begin(Write_queue,FUNCTION);
26    log_function(Write_queue,FUNCTION,_name.c_str());
27
28    if (PORT_READ(in_NRESET) == 0)
29      {
30        // Flush queue
31        // FIXME "queue reset"
32        // > 1) flush one slot by cycle
33        // > 2) flush all slot in one cycle
34
35        while (_queue->empty() == false)
36          _queue->pop_front();
37      }
38    else
39      {
40        // Test access at gpr and spr
41        if (internal_GPR_WRITE_VAL and PORT_READ(in_GPR_WRITE_ACK[0]))
42          _queue->front()->_write_rd = 0;
43        if (internal_SPR_WRITE_VAL and PORT_READ(in_SPR_WRITE_ACK[0]))
44          _queue->front()->_write_re = 0;
45
46        // Test if push
47        if (PORT_READ(in_WRITE_QUEUE_IN_VAL) and internal_WRITE_QUEUE_IN_ACK)
48          {
49            write_queue_entry_t * entry = new write_queue_entry_t
50              ((_param->_have_port_context_id   )?PORT_READ(in_WRITE_QUEUE_IN_CONTEXT_ID   ):0,
51               (_param->_have_port_front_end_id )?PORT_READ(in_WRITE_QUEUE_IN_FRONT_END_ID ):0,
52               (_param->_have_port_ooo_engine_id)?PORT_READ(in_WRITE_QUEUE_IN_OOO_ENGINE_ID):0,
53               (_param->_have_port_rob_ptr      )?PORT_READ(in_WRITE_QUEUE_IN_PACKET_ID    ):0,
54             //PORT_READ(in_WRITE_QUEUE_IN_OPERATION    ),
55             //PORT_READ(in_WRITE_QUEUE_IN_TYPE         ),
56               PORT_READ(in_WRITE_QUEUE_IN_WRITE_RD     ),
57               PORT_READ(in_WRITE_QUEUE_IN_NUM_REG_RD   ),
58               PORT_READ(in_WRITE_QUEUE_IN_DATA_RD      ),
59               PORT_READ(in_WRITE_QUEUE_IN_WRITE_RE     ),
60               PORT_READ(in_WRITE_QUEUE_IN_NUM_REG_RE   ),
61               PORT_READ(in_WRITE_QUEUE_IN_DATA_RE      ),
62               PORT_READ(in_WRITE_QUEUE_IN_EXCEPTION    ),
63               PORT_READ(in_WRITE_QUEUE_IN_NO_SEQUENCE  ),
64               PORT_READ(in_WRITE_QUEUE_IN_ADDRESS      ));
65           
66            _queue->push_back(entry);
67          }
68
69        // Test if pop :
70        //  * transaction on write_queue_out interface
71        //  * have a speculative load and all register is write in registerfile
72        if ( (internal_WRITE_QUEUE_OUT_VAL and PORT_READ(in_WRITE_QUEUE_OUT_ACK)) or
73             ((_queue->empty() == false)                                         and
74//            (_queue->front()->_type      == TYPE_MEMORY)                       and
75              (_queue->front()->_exception == EXCEPTION_MEMORY_LOAD_SPECULATIVE) and // this exception code must be uniq
76              (_queue->front()->_write_rd  == 0)                                 and
77              (_queue->front()->_write_re  == 0)))
78          {
79            delete _queue->front();
80            _queue->pop_front();
81          }
82      }
83
84#ifdef STATISTICS
85    if (usage_is_set(_usage,USE_STATISTICS))
86      *(_stat_use_queue) += _queue->size();
87#endif
88
89#if DEBUG_Write_queue and (DEBUG >= DEBUG_TRACE)
90    log_printf(TRACE,Write_queue,FUNCTION,"  * Dump Write_queue");
91    {
92      uint32_t i=0;
93     
94      for (std::list<write_queue_entry_t *>::iterator it=_queue->begin();
95           it!=_queue->end();
96           ++it)
97        {
98          log_printf(TRACE,Write_queue,FUNCTION,"  [%d] %.2d %.2d %.2d, %.4d, %.1d %.4d %.8x, %.1d %.4d %.1d, %.2d %.1d, %.8x",
99                     i,
100                     (*it)->_context_id   ,
101                     (*it)->_front_end_id ,
102                     (*it)->_ooo_engine_id,
103                     (*it)->_packet_id    ,
104                   //(*it)->_operation    ,
105                   //(*it)->_type         ,
106                     (*it)->_write_rd     ,
107                     (*it)->_num_reg_rd   ,
108                     (*it)->_data_rd      ,
109                     (*it)->_write_re     ,
110                     (*it)->_num_reg_re   ,
111                     (*it)->_data_re      ,
112                     (*it)->_exception    ,
113                     (*it)->_no_sequence  ,
114                     (*it)->_address      );
115
116//           log_printf(TRACE,Write_queue,FUNCTION,"    * context_id   : %d",  (*it)->_context_id   );
117//           log_printf(TRACE,Write_queue,FUNCTION,"    * front_end_id : %d",  (*it)->_front_end_id );
118//           log_printf(TRACE,Write_queue,FUNCTION,"    * ooo_engine_id: %d",  (*it)->_ooo_engine_id);
119//           log_printf(TRACE,Write_queue,FUNCTION,"    * packet_id    : %d",  (*it)->_packet_id    );
120//           log_printf(TRACE,Write_queue,FUNCTION,"    * write_rd     : %d",  (*it)->_write_rd     );
121//           log_printf(TRACE,Write_queue,FUNCTION,"    * num_reg_rd   : %d",  (*it)->_num_reg_rd   );
122//           log_printf(TRACE,Write_queue,FUNCTION,"    * data_rd      : %d",  (*it)->_data_rd      );
123//           log_printf(TRACE,Write_queue,FUNCTION,"    * write_re     : %d",  (*it)->_write_re     );
124//           log_printf(TRACE,Write_queue,FUNCTION,"    * num_reg_re   : %d",  (*it)->_num_reg_re   );
125//           log_printf(TRACE,Write_queue,FUNCTION,"    * data_re      : %d",  (*it)->_data_re      );
126//           log_printf(TRACE,Write_queue,FUNCTION,"    * exception    : %d",  (*it)->_exception    );
127//           log_printf(TRACE,Write_queue,FUNCTION,"    * no_sequence  : %d",  (*it)->_no_sequence  );
128//           log_printf(TRACE,Write_queue,FUNCTION,"    * address      : %d",  (*it)->_address      );
129
130          i++;
131        }
132    }
133#endif
134
135#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
136    end_cycle ();
137#endif
138
139    log_end(Write_queue,FUNCTION);
140  };
141
142}; // end namespace write_queue
143}; // end namespace write_unit
144}; // end namespace multi_write_unit
145}; // end namespace execute_loop
146}; // end namespace multi_execute_loop
147}; // end namespace core
148
149}; // end namespace behavioural
150}; // end namespace morpheo             
151#endif
152//#endif
Note: See TracBrowser for help on using the repository browser.