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 @ 101

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

1) Add soc test
2) fix bug (Pc management, Decod and execute, Update prediction ...)

  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1#ifdef SYSTEMC
2//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id: Write_queue_transition.cpp 101 2009-01-15 17:19:08Z 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
22#undef  FUNCTION
23#define FUNCTION "Write_queue::transition"
24  void Write_queue::transition (void)
25  {
26    log_begin(Write_queue,FUNCTION);
27    log_function(Write_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        while (_queue->empty() == false)
37          _queue->pop_front();
38      }
39    else
40      {
41        // Test access at gpr and spr
42        if (internal_GPR_WRITE_VAL and PORT_READ(in_GPR_WRITE_ACK[0]))
43          _queue->front()->_write_rd = 0;
44        if (internal_SPR_WRITE_VAL and PORT_READ(in_SPR_WRITE_ACK[0]))
45          _queue->front()->_write_re = 0;
46
47        // Test if push
48        if (PORT_READ(in_WRITE_QUEUE_IN_VAL) and internal_WRITE_QUEUE_IN_ACK)
49          {
50            write_queue_entry_t * entry = new write_queue_entry_t
51              ((_param->_have_port_context_id   )?PORT_READ(in_WRITE_QUEUE_IN_CONTEXT_ID   ):0,
52               (_param->_have_port_front_end_id )?PORT_READ(in_WRITE_QUEUE_IN_FRONT_END_ID ):0,
53               (_param->_have_port_ooo_engine_id)?PORT_READ(in_WRITE_QUEUE_IN_OOO_ENGINE_ID):0,
54               (_param->_have_port_rob_ptr      )?PORT_READ(in_WRITE_QUEUE_IN_PACKET_ID    ):0,
55             //PORT_READ(in_WRITE_QUEUE_IN_OPERATION    ),
56             //PORT_READ(in_WRITE_QUEUE_IN_TYPE         ),
57               PORT_READ(in_WRITE_QUEUE_IN_WRITE_RD     ),
58               PORT_READ(in_WRITE_QUEUE_IN_NUM_REG_RD   ),
59               PORT_READ(in_WRITE_QUEUE_IN_DATA_RD      ),
60               PORT_READ(in_WRITE_QUEUE_IN_WRITE_RE     ),
61               PORT_READ(in_WRITE_QUEUE_IN_NUM_REG_RE   ),
62               PORT_READ(in_WRITE_QUEUE_IN_DATA_RE      ),
63               PORT_READ(in_WRITE_QUEUE_IN_EXCEPTION    ),
64               PORT_READ(in_WRITE_QUEUE_IN_NO_SEQUENCE  ),
65               PORT_READ(in_WRITE_QUEUE_IN_ADDRESS      ));
66           
67            _queue->push_back(entry);
68          }
69
70        // Test if pop :
71        //  * transaction on write_queue_out interface
72        //  * have a speculative load and all register is write in registerfile
73        if ( (internal_WRITE_QUEUE_OUT_VAL and PORT_READ(in_WRITE_QUEUE_OUT_ACK)) or
74             ((_queue->empty() == false)                                         and
75//            (_queue->front()->_type      == TYPE_MEMORY)                       and
76              (_queue->front()->_exception == EXCEPTION_MEMORY_LOAD_SPECULATIVE) and // this exception code must be uniq
77              (_queue->front()->_write_rd  == 0)                                 and
78              (_queue->front()->_write_re  == 0)))
79          {
80            delete _queue->front();
81            _queue->pop_front();
82          }
83      }
84
85#ifdef STATISTICS
86    if (usage_is_set(_usage,USE_STATISTICS))
87      *(_stat_use_queue) += _queue->size();
88#endif
89
90#if DEBUG_Write_queue and (DEBUG >= DEBUG_TRACE)
91    log_printf(TRACE,Write_queue,FUNCTION,"  * Dump Write_queue");
92    {
93      uint32_t i=0;
94     
95      for (std::list<write_queue_entry_t *>::iterator it=_queue->begin();
96           it!=_queue->end();
97           ++it)
98        {
99          log_printf(TRACE,Write_queue,FUNCTION,"  [%d] %.2d %.2d %.2d, %.4d, %.1d %.4d %.8x, %.1d %.4d %.1d, %.2d %.1d, %.8x",
100                     i,
101                     (*it)->_context_id   ,
102                     (*it)->_front_end_id ,
103                     (*it)->_ooo_engine_id,
104                     (*it)->_packet_id    ,
105                   //(*it)->_operation    ,
106                   //(*it)->_type         ,
107                     (*it)->_write_rd     ,
108                     (*it)->_num_reg_rd   ,
109                     (*it)->_data_rd      ,
110                     (*it)->_write_re     ,
111                     (*it)->_num_reg_re   ,
112                     (*it)->_data_re      ,
113                     (*it)->_exception    ,
114                     (*it)->_no_sequence  ,
115                     (*it)->_address      );
116          i++;
117        }
118    }
119#endif
120
121#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
122    end_cycle ();
123#endif
124
125    log_end(Write_queue,FUNCTION);
126  };
127
128}; // end namespace write_queue
129}; // end namespace write_unit
130}; // end namespace multi_write_unit
131}; // end namespace execute_loop
132}; // end namespace multi_execute_loop
133}; // end namespace core
134
135}; // end namespace behavioural
136}; // end namespace morpheo             
137#endif
138//#endif
Note: See TracBrowser for help on using the repository browser.