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

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

1) Write queue with mealy
2) Network : fix bug
3) leak memory

  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Write_queue_genMoore.cpp 115 2009-04-20 21:29:17Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Write_queue/include/Write_queue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_execute_loop {
15namespace execute_loop {
16namespace multi_write_unit {
17namespace write_unit {
18namespace write_queue {
19
20
21#undef  FUNCTION
22#define FUNCTION "Write_queue::genMoore"
23  void Write_queue::genMoore (void)
24  {
25    log_begin(Write_queue,FUNCTION);
26    log_function(Write_queue,FUNCTION,_name.c_str());
27   
28    // -----[ Interface "bypass_write" ]----------------------------------
29    {
30      std::list<write_queue_entry_t *>::iterator it = _queue->begin();
31      for (uint32_t i=0; i<_param->_nb_bypass_write; i++)
32        {
33          bool val     = i < _queue->size();
34         
35          if (val)
36            {
37              if (_param->_have_port_ooo_engine_id)
38              PORT_WRITE(out_BYPASS_WRITE_OOO_ENGINE_ID [i], (*it)->_ooo_engine_id);
39              PORT_WRITE(out_BYPASS_WRITE_GPR_NUM_REG   [i], (*it)->_num_reg_rd);
40              PORT_WRITE(out_BYPASS_WRITE_GPR_DATA      [i], (*it)->_data_rd   );
41              PORT_WRITE(out_BYPASS_WRITE_SPR_NUM_REG   [i], (*it)->_num_reg_re);
42              PORT_WRITE(out_BYPASS_WRITE_SPR_DATA      [i], (*it)->_data_re   );
43            }
44#ifdef SYSTEMC_VHDL_COMPATIBILITY
45          else
46            {
47              if (_param->_have_port_ooo_engine_id)
48              PORT_WRITE(out_BYPASS_WRITE_OOO_ENGINE_ID [i], 0);
49              PORT_WRITE(out_BYPASS_WRITE_GPR_NUM_REG   [i], 0);
50              PORT_WRITE(out_BYPASS_WRITE_GPR_DATA      [i], 0);
51              PORT_WRITE(out_BYPASS_WRITE_SPR_NUM_REG   [i], 0);
52              PORT_WRITE(out_BYPASS_WRITE_SPR_DATA      [i], 0);
53            }
54#endif
55
56          PORT_WRITE(out_BYPASS_WRITE_GPR_VAL       [i], val and (*it)->_write_rd  );
57          PORT_WRITE(out_BYPASS_WRITE_SPR_VAL       [i], val and (*it)->_write_re  );
58         
59          if (it != _queue->end())
60            it++;
61        }
62    }
63
64    // -----[ Interface "Write_queue_in" ]--------------------------------
65    {
66      internal_WRITE_QUEUE_IN_ACK = _queue->size() < _param->_size_queue;
67     
68      PORT_WRITE(out_WRITE_QUEUE_IN_ACK, internal_WRITE_QUEUE_IN_ACK);
69    }
70
71    if (_param->_queue_scheme == WRITE_QUEUE_SCHEME_MOORE)
72      {
73    // -----[ Interface "gpr_write" ]-------------------------------------
74    // -----[ Interface "spr_write" ]-------------------------------------
75    {
76      bool val = not _queue->empty();
77
78      internal_GPR_WRITE_VAL = val and _queue->front()->_write_rd;
79      internal_SPR_WRITE_VAL = val and _queue->front()->_write_re;
80     
81      PORT_WRITE(out_GPR_WRITE_VAL [0], internal_GPR_WRITE_VAL);
82      PORT_WRITE(out_SPR_WRITE_VAL [0], internal_SPR_WRITE_VAL);
83
84      if (val)
85        {
86          if (_param->_have_port_ooo_engine_id)
87          {
88          PORT_WRITE(out_GPR_WRITE_OOO_ENGINE_ID [0], _queue->front()->_ooo_engine_id);
89          PORT_WRITE(out_SPR_WRITE_OOO_ENGINE_ID [0], _queue->front()->_ooo_engine_id);
90          }
91          PORT_WRITE(out_GPR_WRITE_NUM_REG       [0], _queue->front()->_num_reg_rd);
92          PORT_WRITE(out_GPR_WRITE_DATA          [0], _queue->front()->_data_rd   );
93          PORT_WRITE(out_SPR_WRITE_NUM_REG       [0], _queue->front()->_num_reg_re);
94          PORT_WRITE(out_SPR_WRITE_DATA          [0], _queue->front()->_data_re   );
95        }
96    }
97
98    // -----[ Interface "Write_queue_out" ]--------------------------------
99    {
100      internal_WRITE_QUEUE_OUT_VAL = ((not _queue->empty()           ) and
101                                      (not _queue->front()->_write_rd) and
102                                      (not _queue->front()->_write_re));
103     
104      PORT_WRITE(out_WRITE_QUEUE_OUT_VAL, internal_WRITE_QUEUE_OUT_VAL);
105
106      if (internal_WRITE_QUEUE_OUT_VAL)
107        {
108          if (_param->_have_port_context_id)
109          PORT_WRITE(out_WRITE_QUEUE_OUT_CONTEXT_ID   , _queue->front()->_context_id   );
110          if (_param->_have_port_front_end_id)
111          PORT_WRITE(out_WRITE_QUEUE_OUT_FRONT_END_ID , _queue->front()->_front_end_id );
112          if (_param->_have_port_ooo_engine_id)
113          PORT_WRITE(out_WRITE_QUEUE_OUT_OOO_ENGINE_ID, _queue->front()->_ooo_engine_id);
114          if (_param->_have_port_rob_ptr  )
115          PORT_WRITE(out_WRITE_QUEUE_OUT_PACKET_ID    , _queue->front()->_packet_id    );
116//        PORT_WRITE(out_WRITE_QUEUE_OUT_OPERATION    , _queue->front()->_operation    );
117//        PORT_WRITE(out_WRITE_QUEUE_OUT_TYPE         , _queue->front()->_type         );
118          PORT_WRITE(out_WRITE_QUEUE_OUT_FLAGS        , _queue->front()->_data_re      );
119          PORT_WRITE(out_WRITE_QUEUE_OUT_EXCEPTION    , _queue->front()->_exception    );
120          PORT_WRITE(out_WRITE_QUEUE_OUT_NO_SEQUENCE  , _queue->front()->_no_sequence  );
121          PORT_WRITE(out_WRITE_QUEUE_OUT_ADDRESS      , _queue->front()->_address      );
122          PORT_WRITE(out_WRITE_QUEUE_OUT_DATA         , _queue->front()->_data_rd      );
123        }
124    }
125
126      } // end WRITE_QUEUE_SCHEME_MOORE
127    log_end(Write_queue,FUNCTION);
128  };
129
130}; // end namespace write_queue
131}; // end namespace write_unit
132}; // end namespace multi_write_unit
133}; // end namespace execute_loop
134}; // end namespace multi_execute_loop
135}; // end namespace core
136
137}; // end namespace behavioural
138}; // end namespace morpheo             
139#endif
Note: See TracBrowser for help on using the repository browser.