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

Last change on this file since 73 was 73, checked in by rosiere, 16 years ago

add two component :

  • Write Queue (in Moore version)
  • Execute Queue

add macro to help the interface allocation : Allocation.h

File size: 4.5 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
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_printf(FUNC,Write_queue,FUNCTION,"Begin");
26   
27    // -----[ Interface "Write_queue_in" ]--------------------------------
28    {
29      internal_WRITE_QUEUE_IN_ACK = _queue->size() < _param->_size_queue;
30     
31      PORT_WRITE(out_WRITE_QUEUE_IN_ACK, internal_WRITE_QUEUE_IN_ACK);
32    }
33
34    // -----[ Interface "Write_queue_out" ]--------------------------------
35    {
36      // TODO : make a genMealy version
37      internal_WRITE_QUEUE_OUT_VAL = ((not _queue->empty()           ) and
38                                      (not _queue->front()->_write_rd) and
39                                      (not _queue->front()->_write_re));
40     
41      PORT_WRITE(out_WRITE_QUEUE_OUT_VAL, internal_WRITE_QUEUE_OUT_VAL);
42
43      if (internal_WRITE_QUEUE_OUT_VAL)
44        {
45          if (_param->_have_port_context_id)
46          PORT_WRITE(out_WRITE_QUEUE_OUT_CONTEXT_ID   , _queue->front()->_context_id   );
47          if (_param->_have_port_front_end_id)
48          PORT_WRITE(out_WRITE_QUEUE_OUT_FRONT_END_ID , _queue->front()->_front_end_id );
49          if (_param->_have_port_ooo_engine_id)
50          PORT_WRITE(out_WRITE_QUEUE_OUT_OOO_ENGINE_ID, _queue->front()->_ooo_engine_id);
51          if (_param->_have_port_packet_id)
52          PORT_WRITE(out_WRITE_QUEUE_OUT_PACKET_ID    , _queue->front()->_packet_id    );
53//        PORT_WRITE(out_WRITE_QUEUE_OUT_OPERATION    , _queue->front()->_operation    );
54//        PORT_WRITE(out_WRITE_QUEUE_OUT_TYPE         , _queue->front()->_type         );
55          PORT_WRITE(out_WRITE_QUEUE_OUT_FLAGS        , _queue->front()->_data_re      );
56          PORT_WRITE(out_WRITE_QUEUE_OUT_EXCEPTION    , _queue->front()->_exception    );
57          PORT_WRITE(out_WRITE_QUEUE_OUT_NO_SEQUENCE  , _queue->front()->_no_sequence  );
58          PORT_WRITE(out_WRITE_QUEUE_OUT_ADDRESS      , _queue->front()->_address      );
59        }
60    }
61
62    // -----[ Interface "gpr_write" ]-------------------------------------
63    // -----[ Interface "spr_write" ]-------------------------------------
64    {
65      bool val = not _queue->empty();
66
67      internal_GPR_WRITE_VAL = val and _queue->front()->_write_rd;
68      internal_SPR_WRITE_VAL = val and _queue->front()->_write_re;
69     
70      PORT_WRITE(out_GPR_WRITE_VAL [0], internal_GPR_WRITE_VAL);
71      PORT_WRITE(out_SPR_WRITE_VAL [0], internal_SPR_WRITE_VAL);
72
73      if (val)
74        {
75          if (_param->_have_port_ooo_engine_id)
76          {
77          PORT_WRITE(out_GPR_WRITE_OOO_ENGINE_ID [0], _queue->front()->_ooo_engine_id);
78          PORT_WRITE(out_SPR_WRITE_OOO_ENGINE_ID [0], _queue->front()->_ooo_engine_id);
79          }
80          PORT_WRITE(out_GPR_WRITE_NUM_REG       [0], _queue->front()->_num_reg_rd);
81          PORT_WRITE(out_GPR_WRITE_DATA          [0], _queue->front()->_data_rd   );
82          PORT_WRITE(out_SPR_WRITE_NUM_REG       [0], _queue->front()->_num_reg_re);
83          PORT_WRITE(out_SPR_WRITE_DATA          [0], _queue->front()->_data_re   );
84        }
85    }
86    // -----[ Interface "bypass_write" ]----------------------------------
87    {
88      list<write_queue_entry_t *>::iterator it = _queue->begin();
89      for (uint32_t i=0; i<_param->_nb_bypass_write; i++)
90        {
91          bool val     = i < _queue->size();
92         
93          if (val)
94            {
95              if (_param->_have_port_ooo_engine_id)
96              PORT_WRITE(out_BYPASS_WRITE_OOO_ENGINE_ID [i], (*it)->_ooo_engine_id);
97              PORT_WRITE(out_BYPASS_WRITE_GPR_NUM_REG   [i], (*it)->_num_reg_rd);
98              PORT_WRITE(out_BYPASS_WRITE_GPR_DATA      [i], (*it)->_data_rd   );
99              PORT_WRITE(out_BYPASS_WRITE_SPR_NUM_REG   [i], (*it)->_num_reg_re);
100              PORT_WRITE(out_BYPASS_WRITE_SPR_DATA      [i], (*it)->_data_re   );
101              PORT_WRITE(out_BYPASS_WRITE_SPR_DATA      [i], (*it)->_data_re   );
102            }
103          PORT_WRITE(out_BYPASS_WRITE_GPR_VAL       [i], val and (*it)->_write_rd  );
104          PORT_WRITE(out_BYPASS_WRITE_SPR_VAL       [i], val and (*it)->_write_re  );
105         
106          if (it != _queue->end())
107            it++;
108        }
109    }
110    log_printf(FUNC,Write_queue,FUNCTION,"End");
111  };
112
113}; // end namespace write_queue
114}; // end namespace write_unit
115}; // end namespace multi_write_unit
116}; // end namespace execute_loop
117}; // end namespace multi_execute_loop
118}; // end namespace core
119
120}; // end namespace behavioural
121}; // end namespace morpheo             
122#endif
Note: See TracBrowser for help on using the repository browser.