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

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

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
File size: 5.5 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->_store_queue_ptr_write = PORT_READ(in_READ_QUEUE_IN_STORE_QUEUE_PTR_WRITE);
69            if (_param->_have_port_load_queue_ptr)
70            entry->_load_queue_ptr_write  = PORT_READ(in_READ_QUEUE_IN_LOAD_QUEUE_PTR_WRITE );
71            entry->_has_immediat = PORT_READ(in_READ_QUEUE_IN_HAS_IMMEDIAT);
72            entry->_immediat     = PORT_READ(in_READ_QUEUE_IN_IMMEDIAT    );
73            entry->_read_ra      = PORT_READ(in_READ_QUEUE_IN_READ_RA     );
74            entry->_num_reg_ra   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RA  );
75            entry->_read_rb      = PORT_READ(in_READ_QUEUE_IN_READ_RB     );
76            entry->_num_reg_rb   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RB  );
77            entry->_read_rc      = PORT_READ(in_READ_QUEUE_IN_READ_RC     );
78            entry->_num_reg_rc   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RC  );
79            entry->_write_rd     = PORT_READ(in_READ_QUEUE_IN_WRITE_RD    );
80            entry->_num_reg_rd   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RD  );
81            entry->_write_re     = PORT_READ(in_READ_QUEUE_IN_WRITE_RE    );
82            entry->_num_reg_re   = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RE  );
83
84            log_printf(TRACE,Read_queue,FUNCTION,"   * push (id : %d-%d)",entry->_context_id, entry->_rob_id);
85            _queue->push(entry);
86
87
88            // read next new head
89            if (empty)
90              {
91                log_printf(TRACE,Read_queue,FUNCTION,"     * queue was    empty");
92                need_new_head = true;
93              }
94          }
95
96        // Read from read_queue
97        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));
98        if ((    internal_READ_QUEUE_OUT_VAL  == 1) and
99            (PORT_READ(in_READ_QUEUE_OUT_ACK) == 1))
100          {
101            // Pop the entry
102            log_printf(TRACE,Read_queue,FUNCTION,"   * pop  (id : %d-%d)",_queue->front()->_context_id, _queue->front()->_rob_id);
103            _queue->pop();
104
105            // read next new head
106            if (_queue->empty() == false)
107              {
108                log_printf(TRACE,Read_queue,FUNCTION,"     * queue was not empty");
109                need_new_head = true;
110              }
111          }
112        else
113          {
114            // no transaction, update queue_head
115            _queue_head->_read_ra_val = internal_READ_QUEUE_OUT_READ_RA_VAL ;
116            _queue_head->_data_ra_val = internal_READ_QUEUE_OUT_DATA_RA_VAL ;
117            _queue_head->_data_ra     = internal_READ_QUEUE_OUT_DATA_RA     ;
118
119            _queue_head->_read_rb_val = internal_READ_QUEUE_OUT_READ_RB_VAL ;
120            _queue_head->_data_rb_val = internal_READ_QUEUE_OUT_DATA_RB_VAL ;
121            _queue_head->_data_rb     = internal_READ_QUEUE_OUT_DATA_RB     ;
122
123            _queue_head->_read_rc_val = internal_READ_QUEUE_OUT_READ_RC_VAL ;
124            _queue_head->_data_rc_val = internal_READ_QUEUE_OUT_DATA_RC_VAL ;
125            _queue_head->_data_rc     = internal_READ_QUEUE_OUT_DATA_RC     ;
126          }
127
128        if (need_new_head == true)
129          {
130            log_printf(TRACE,Read_queue,FUNCTION," * new head");
131            (*_queue_head) = (*_queue->front());
132          }
133       
134//      cout << "Transition End    : Print queue_head" << endl;
135//      if (_queue->empty ())
136//        cout << "queue is empty !!!" << endl;
137//      else
138//        cout << (*_queue_head) << endl;
139
140        log_printf(TRACE,Read_queue,FUNCTION,"Read_queue size (end  ) : %d",_queue->size());
141      }
142
143#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
144    end_cycle ();
145#endif
146
147    log_printf(FUNC,Read_queue,FUNCTION,"End");
148  };
149
150}; // end namespace read_queue
151}; // end namespace read_unit
152}; // end namespace multi_read_unit
153}; // end namespace execute_loop
154}; // end namespace multi_execute_loop
155}; // end namespace core
156
157}; // end namespace behavioural
158}; // end namespace morpheo             
159#endif
160//#endif
Note: See TracBrowser for help on using the repository browser.