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

Last change on this file since 103 was 103, checked in by moulu, 15 years ago

1) write queue vhdl
2) bug fix : in generic queue

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