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

Last change on this file since 66 was 66, checked in by rosiere, 17 years ago
  • un pas de plus vers la compatibilite avec systemC
  • modification de l'interface de read_queue : context_id devient context_id, front_end_id et ooo_engine_id
File size: 5.1 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 nead_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            entry->_context_id   = PORT_READ(in_READ_QUEUE_IN_CONTEXT_ID  );
59            entry->_front_end_id = PORT_READ(in_READ_QUEUE_IN_FRONT_END_ID);
60            entry->_ooo_engine_id= PORT_READ(in_READ_QUEUE_IN_OOO_ENGINE_ID);
61            entry->_rob_id       = PORT_READ(in_READ_QUEUE_IN_ROB_ID      );
62            entry->_operation    = PORT_READ(in_READ_QUEUE_IN_OPERATION   );
63            entry->_type         = PORT_READ(in_READ_QUEUE_IN_TYPE        );
64            entry->_has_immediat = PORT_READ(in_READ_QUEUE_IN_HAS_IMMEDIAT);
65            entry->_immediat     = PORT_READ(in_READ_QUEUE_IN_IMMEDIAT    );
66            entry->_read_ra      = PORT_READ(in_READ_QUEUE_IN_READ_RA     );
67            entry->_num_reg_ra   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RA  );
68            entry->_read_rb      = PORT_READ(in_READ_QUEUE_IN_READ_RB     );
69            entry->_num_reg_rb   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RB  );
70            entry->_read_rc      = PORT_READ(in_READ_QUEUE_IN_READ_RC     );
71            entry->_num_reg_rc   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RC  );
72            entry->_write_rd     = PORT_READ(in_READ_QUEUE_IN_WRITE_RD    );
73            entry->_num_reg_rd   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RD  );
74            entry->_write_re     = PORT_READ(in_READ_QUEUE_IN_WRITE_RE    );
75            entry->_num_reg_re   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RE  );
76
77            log_printf(TRACE,Read_queue,FUNCTION,"   * push (id : %d-%d)",entry->_context_id, entry->_rob_id);
78            _queue->push(entry);
79
80
81            // read next new head
82            if (empty)
83              {
84                log_printf(TRACE,Read_queue,FUNCTION,"     * queue was    empty");
85                nead_new_head = true;
86              }
87          }
88
89        // Read from read_queue
90        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));
91        if ((    internal_READ_QUEUE_OUT_VAL  == 1) and
92            (PORT_READ(in_READ_QUEUE_OUT_ACK) == 1))
93          {
94            // Pop the entry
95            log_printf(TRACE,Read_queue,FUNCTION,"   * pop  (id : %d-%d)",_queue->front()->_context_id, _queue->front()->_rob_id);
96            _queue->pop();
97
98            // read next new head
99            if (_queue->empty() == false)
100              {
101                log_printf(TRACE,Read_queue,FUNCTION,"     * queue was not empty");
102                nead_new_head = true;
103              }
104          }
105        else
106          {
107            // no transaction, update queue_head
108            _queue_head->_read_ra_val = internal_READ_QUEUE_OUT_READ_RA_VAL ;
109            _queue_head->_data_ra_val = internal_READ_QUEUE_OUT_DATA_RA_VAL ;
110            _queue_head->_data_ra     = internal_READ_QUEUE_OUT_DATA_RA     ;
111
112            _queue_head->_read_rb_val = internal_READ_QUEUE_OUT_READ_RB_VAL ;
113            _queue_head->_data_rb_val = internal_READ_QUEUE_OUT_DATA_RB_VAL ;
114            _queue_head->_data_rb     = internal_READ_QUEUE_OUT_DATA_RB     ;
115
116            _queue_head->_read_rc_val = internal_READ_QUEUE_OUT_READ_RC_VAL ;
117            _queue_head->_data_rc_val = internal_READ_QUEUE_OUT_DATA_RC_VAL ;
118            _queue_head->_data_rc     = internal_READ_QUEUE_OUT_DATA_RC     ;
119          }
120
121        if (nead_new_head == true)
122          {
123            log_printf(TRACE,Read_queue,FUNCTION," * new head");
124            (*_queue_head) = (*_queue->front());
125          }
126       
127//      cout << "Transition End    : Print queue_head" << endl;
128//      if (_queue->empty ())
129//        cout << "queue is empty !!!" << endl;
130//      else
131//        cout << (*_queue_head) << endl;
132
133        log_printf(TRACE,Read_queue,FUNCTION,"Read_queue size (end  ) : %d",_queue->size());
134      }
135
136#ifdef STATISTICS
137    _stat->add();
138#endif   
139
140#ifdef VHDL_TESTBENCH
141    vhdl_testbench_transition ();
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.