source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/src/Read_queue_transition.cpp @ 75

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

Update all component (except front_end) to :

  • new statistics model
  • no namespace std
File size: 5.3 KB
Line 
1#ifdef SYSTEMC
2//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id$
5 *
6 * [ Description ]
7 *
8 */
9
10#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/include/Read_queue.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace core {
15namespace multi_execute_loop {
16namespace execute_loop {
17namespace multi_read_unit {
18namespace read_unit {
19namespace read_queue {
20
21
22#undef  FUNCTION
23#define FUNCTION "Read_queue::transition"
24  void Read_queue::transition (void)
25  {
26    log_printf(FUNC,Read_queue,FUNCTION,"Begin");
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();
37      }
38    else
39      {
40//      cout << "Transition Begin  : Print queue_head" << endl;
41//      if (_queue->empty ())
42//        cout << "queue is empty !!!" << endl;
43//      else
44//        cout << (*_queue_head) << endl;
45
46        log_printf(TRACE,Read_queue,FUNCTION,"Read_queue size (begin) : %d",_queue->size());
47        // Write to read_queue
48
49        bool not_full      = not (_queue->size() == _param->_size_queue);
50        bool     empty     =     _queue->empty();
51        bool need_new_head = false;
52       
53        log_printf(TRACE,Read_queue,FUNCTION," * test transaction READ_QUEUE_IN  : %d,%d",PORT_READ(in_READ_QUEUE_IN_VAL), not_full);
54        if ((PORT_READ(in_READ_QUEUE_IN_VAL) == 1) and not_full)
55          {
56            Tread_queue_entry_t * entry = new Tread_queue_entry_t;
57
58            if(_param->_have_port_context_id   )
59              entry->_context_id   = PORT_READ(in_READ_QUEUE_IN_CONTEXT_ID  );
60            if(_param->_have_port_front_end_id )
61              entry->_front_end_id = PORT_READ(in_READ_QUEUE_IN_FRONT_END_ID);
62            if(_param->_have_port_ooo_engine_id)
63              entry->_ooo_engine_id= PORT_READ(in_READ_QUEUE_IN_OOO_ENGINE_ID);
64            if(_param->_have_port_rob_id       )
65              entry->_rob_id       = PORT_READ(in_READ_QUEUE_IN_ROB_ID      );
66            entry->_operation    = PORT_READ(in_READ_QUEUE_IN_OPERATION   );
67            entry->_type         = PORT_READ(in_READ_QUEUE_IN_TYPE        );
68            entry->_has_immediat = PORT_READ(in_READ_QUEUE_IN_HAS_IMMEDIAT);
69            entry->_immediat     = PORT_READ(in_READ_QUEUE_IN_IMMEDIAT    );
70            entry->_read_ra      = PORT_READ(in_READ_QUEUE_IN_READ_RA     );
71            entry->_num_reg_ra   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RA  );
72            entry->_read_rb      = PORT_READ(in_READ_QUEUE_IN_READ_RB     );
73            entry->_num_reg_rb   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RB  );
74            entry->_read_rc      = PORT_READ(in_READ_QUEUE_IN_READ_RC     );
75            entry->_num_reg_rc   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RC  );
76            entry->_write_rd     = PORT_READ(in_READ_QUEUE_IN_WRITE_RD    );
77            entry->_num_reg_rd   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RD  );
78            entry->_write_re     = PORT_READ(in_READ_QUEUE_IN_WRITE_RE    );
79            entry->_num_reg_re   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RE  );
80
81            log_printf(TRACE,Read_queue,FUNCTION,"   * push (id : %d-%d)",entry->_context_id, entry->_rob_id);
82            _queue->push(entry);
83
84
85            // read next new head
86            if (empty)
87              {
88                log_printf(TRACE,Read_queue,FUNCTION,"     * queue was    empty");
89                need_new_head = true;
90              }
91          }
92
93        // Read from read_queue
94        log_printf(TRACE,Read_queue,FUNCTION," * test transaction READ_QUEUE_OUT : %d,%d",internal_READ_QUEUE_OUT_VAL, PORT_READ(in_READ_QUEUE_OUT_ACK));
95        if ((    internal_READ_QUEUE_OUT_VAL  == 1) and
96            (PORT_READ(in_READ_QUEUE_OUT_ACK) == 1))
97          {
98            // Pop the entry
99            log_printf(TRACE,Read_queue,FUNCTION,"   * pop  (id : %d-%d)",_queue->front()->_context_id, _queue->front()->_rob_id);
100            _queue->pop();
101
102            // read next new head
103            if (_queue->empty() == false)
104              {
105                log_printf(TRACE,Read_queue,FUNCTION,"     * queue was not empty");
106                need_new_head = true;
107              }
108          }
109        else
110          {
111            // no transaction, update queue_head
112            _queue_head->_read_ra_val = internal_READ_QUEUE_OUT_READ_RA_VAL ;
113            _queue_head->_data_ra_val = internal_READ_QUEUE_OUT_DATA_RA_VAL ;
114            _queue_head->_data_ra     = internal_READ_QUEUE_OUT_DATA_RA     ;
115
116            _queue_head->_read_rb_val = internal_READ_QUEUE_OUT_READ_RB_VAL ;
117            _queue_head->_data_rb_val = internal_READ_QUEUE_OUT_DATA_RB_VAL ;
118            _queue_head->_data_rb     = internal_READ_QUEUE_OUT_DATA_RB     ;
119
120            _queue_head->_read_rc_val = internal_READ_QUEUE_OUT_READ_RC_VAL ;
121            _queue_head->_data_rc_val = internal_READ_QUEUE_OUT_DATA_RC_VAL ;
122            _queue_head->_data_rc     = internal_READ_QUEUE_OUT_DATA_RC     ;
123          }
124
125        if (need_new_head == true)
126          {
127            log_printf(TRACE,Read_queue,FUNCTION," * new head");
128            (*_queue_head) = (*_queue->front());
129          }
130       
131//      cout << "Transition End    : Print queue_head" << endl;
132//      if (_queue->empty ())
133//        cout << "queue is empty !!!" << endl;
134//      else
135//        cout << (*_queue_head) << endl;
136
137        log_printf(TRACE,Read_queue,FUNCTION,"Read_queue size (end  ) : %d",_queue->size());
138      }
139
140#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
141    end_cycle ();
142#endif
143
144    log_printf(FUNC,Read_queue,FUNCTION,"End");
145  };
146
147}; // end namespace read_queue
148}; // end namespace read_unit
149}; // end namespace multi_read_unit
150}; // end namespace execute_loop
151}; // end namespace multi_execute_loop
152}; // end namespace core
153
154}; // end namespace behavioural
155}; // end namespace morpheo             
156#endif
157//#endif
Note: See TracBrowser for help on using the repository browser.