source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_transition.cpp @ 123

Last change on this file since 123 was 123, checked in by rosiere, 15 years ago

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 8.6 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Decod_queue_function_multi_fifo_transition.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/include/Decod_queue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace decod_unit {
17namespace decod_queue {
18
19
20#undef  FUNCTION
21#define FUNCTION "Decod_queue::function_multi_fifo_transition"
22  void Decod_queue::function_multi_fifo_transition (void)
23  {
24    log_begin(Decod_queue,FUNCTION);
25    log_function(Decod_queue,FUNCTION,_name.c_str());
26
27    if (PORT_READ(in_NRESET) == 0)
28      {
29        for (uint32_t i=0; i<_param->_nb_bank; ++i)
30          while (not reg_QUEUE[i].empty())
31            {
32              delete reg_QUEUE[i].front();
33              reg_QUEUE[i].pop_front();
34            }
35
36        for (uint32_t i=0; i<_param->_nb_context; i++)
37          {
38            reg_NB_INST       [i]=0;
39            reg_NB_INST_EVENT [i]=0;
40          }
41
42        reg_NUM_BANK_HEAD = 0;
43        reg_NUM_BANK_TAIL = 0;
44      }
45    else
46      {
47        //--------------------------------------------------------------------
48        //-----[ DECOD_IN ]---------------------------------------------------
49        //-------------------------------------------------------------------- 
50
51        {
52#ifdef STATISTICS
53          bool find = false;
54#endif
55          for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
56            if (PORT_READ(in_DECOD_IN_VAL [i]) and internal_DECOD_IN_ACK[i])
57              {
58                log_printf(TRACE,Decod_queue,FUNCTION,_("  * DECOD_IN  [%d]"),i);
59               
60                // Create entry
61                decod_queue_entry_t * entry = new decod_queue_entry_t (1);
62                reg_QUEUE[reg_NUM_BANK_TAIL].push_back(entry);
63               
64#ifdef STATISTICS
65                find = true;
66                if (usage_is_set(_usage,USE_STATISTICS))
67                  (*_stat_sum_inst_enable) ++;
68#endif
69
70                Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_IN_CONTEXT_ID [i]):0;
71
72                log_printf(TRACE,Decod_queue,FUNCTION,_("    * context : %d"),context);
73
74//              entry->_val           [0] = 1;
75                entry->_context_id    [0] = context;
76                entry->_depth         [0] = (_param->_have_port_depth)?PORT_READ(in_DECOD_IN_DEPTH [i]):0;
77                entry->_type          [0] = PORT_READ(in_DECOD_IN_TYPE          [i]);
78                entry->_operation     [0] = PORT_READ(in_DECOD_IN_OPERATION     [i]);
79                entry->_no_execute    [0] = PORT_READ(in_DECOD_IN_NO_EXECUTE    [i]);
80                entry->_is_delay_slot [0] = PORT_READ(in_DECOD_IN_IS_DELAY_SLOT [i]);
81#ifdef DEBUG
82                entry->_address       [0] = PORT_READ(in_DECOD_IN_ADDRESS       [i]);
83#endif
84                entry->_address_next  [0] = PORT_READ(in_DECOD_IN_ADDRESS_NEXT  [i]);
85                entry->_has_immediat  [0] = PORT_READ(in_DECOD_IN_HAS_IMMEDIAT  [i]);
86                entry->_immediat      [0] = PORT_READ(in_DECOD_IN_IMMEDIAT      [i]);
87                entry->_read_ra       [0] = PORT_READ(in_DECOD_IN_READ_RA       [i]);
88                entry->_num_reg_ra    [0] = PORT_READ(in_DECOD_IN_NUM_REG_RA    [i]);
89                entry->_read_rb       [0] = PORT_READ(in_DECOD_IN_READ_RB       [i]);
90                entry->_num_reg_rb    [0] = PORT_READ(in_DECOD_IN_NUM_REG_RB    [i]);
91                entry->_read_rc       [0] = PORT_READ(in_DECOD_IN_READ_RC       [i]);
92                entry->_num_reg_rc    [0] = PORT_READ(in_DECOD_IN_NUM_REG_RC    [i]);
93                entry->_write_rd      [0] = PORT_READ(in_DECOD_IN_WRITE_RD      [i]);
94                entry->_num_reg_rd    [0] = PORT_READ(in_DECOD_IN_NUM_REG_RD    [i]);
95                entry->_write_re      [0] = PORT_READ(in_DECOD_IN_WRITE_RE      [i]);
96                entry->_num_reg_re    [0] = PORT_READ(in_DECOD_IN_NUM_REG_RE    [i]);
97                entry->_exception_use [0] = PORT_READ(in_DECOD_IN_EXCEPTION_USE [i]);
98                entry->_exception     [0] = PORT_READ(in_DECOD_IN_EXCEPTION     [i]);
99
100                // Update pointer
101                reg_NUM_BANK_TAIL = (reg_NUM_BANK_TAIL+1)%_param->_nb_bank;
102                reg_NB_INST [context] ++;
103
104                log_printf(TRACE,Decod_queue,FUNCTION,_("    * nb_inst : %d"),reg_NB_INST [context]);
105                log_printf(TRACE,Decod_queue,FUNCTION,_("    * PUSH queue"));
106              }
107
108#ifdef STATISTICS
109          if (usage_is_set(_usage,USE_STATISTICS))
110            if (find)
111              (*_stat_sum_transaction_decod_in) ++;
112#endif
113        }
114
115        //--------------------------------------------------------------------
116        //-----[ DECOD_OUT ]--------------------------------------------------
117        //--------------------------------------------------------------------
118        {
119          for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
120            if (internal_DECOD_OUT_VAL [i] and internal_DECOD_OUT_ACK[i])
121              {
122                log_printf(TRACE,Decod_queue,FUNCTION,_("  * DECOD_OUT [%d]"),i);
123               
124                uint32_t num_bank = reg_NUM_BANK_HEAD;
125
126                Tcontext_t context = reg_QUEUE[num_bank].front()->_context_id [0];
127
128                log_printf(TRACE,Decod_queue,FUNCTION,_("    * context : %d"),context);
129
130                // Pop the slot
131                delete reg_QUEUE[num_bank].front();
132                reg_QUEUE[num_bank].pop_front();
133
134                // Update pointer
135                reg_NUM_BANK_HEAD = (reg_NUM_BANK_HEAD+1)%_param->_nb_bank;
136               
137                reg_NB_INST       [context] --;
138                if (reg_NB_INST_EVENT [context] > 0)
139                reg_NB_INST_EVENT [context] --;
140              }
141        }
142
143        //--------------------------------------------------------------------
144        //-----[ CONTEXT_EVENT ]----------------------------------------------
145        //--------------------------------------------------------------------
146        for (uint32_t i=0; i<_param->_nb_context; i++)
147          if (PORT_READ(in_CONTEXT_EVENT [i]))
148            reg_NB_INST_EVENT [i] = reg_NB_INST [i];
149
150        //--------------------------------------------------------------------
151        //-----[ OTHERS ]-----------------------------------------------------
152        //--------------------------------------------------------------------
153
154#if defined(DEBUG) and defined(DEBUG_Decod_queue) and (DEBUG >= DEBUG_TRACE)
155    log_printf(TRACE,Decod_queue,FUNCTION,"  * Dump decod_queue");
156    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NUM_BANK_HEAD     : %d",reg_NUM_BANK_HEAD);
157    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NUM_BANK_TAIL     : %d",reg_NUM_BANK_TAIL);
158    for (uint32_t i=0; i<_param->_nb_context; i++)
159      {
160    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NB_INST       [%d] : %d",i,reg_NB_INST [i]);
161    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NB_INST_EVENT [%d] : %d",i,reg_NB_INST_EVENT [i]);
162      }
163    for (uint32_t i=0; i<_param->_nb_bank; ++i)
164      {
165        uint32_t x=0;
166        uint32_t num_bank = (reg_NUM_BANK_HEAD+i)%_param->_nb_bank;
167        for (std::list<decod_queue_entry_t*>::iterator it=reg_QUEUE[num_bank].begin();
168             it!=reg_QUEUE[num_bank].end();
169             it++)
170          {
171            log_printf(TRACE,Decod_queue,FUNCTION,"    * [%.4d][%.4d] %.3d %.2d, %.2d %.3d %.1d %.1d, 0x%.8x (0x%.8x), %.1d 0x%.8x, %.1d %.2d, %.1d %.2d, %.1d %.2d, %.1d %.2d, %.1d %.2d, %.1d %.2d"
172                       ,i
173                       ,x
174                       ,(*it)->_context_id    [0]
175                       ,(*it)->_depth         [0]
176                       ,(*it)->_type          [0]
177                       ,(*it)->_operation     [0]
178                       ,(*it)->_no_execute    [0]
179                       ,(*it)->_is_delay_slot [0]
180                       ,(*it)->_address       [0]
181                       ,(*it)->_address       [0]<<2
182                       ,(*it)->_has_immediat  [0]
183                       ,(*it)->_immediat      [0]
184                       ,(*it)->_read_ra       [0]
185                       ,(*it)->_num_reg_ra    [0]
186                       ,(*it)->_read_rb       [0]
187                       ,(*it)->_num_reg_rb    [0]
188                       ,(*it)->_read_rc       [0]
189                       ,(*it)->_num_reg_rc    [0]
190                       ,(*it)->_write_rd      [0]
191                       ,(*it)->_num_reg_rd    [0]
192                       ,(*it)->_write_re      [0]
193                       ,(*it)->_num_reg_re    [0]
194                       ,(*it)->_exception_use [0]
195                       ,(*it)->_exception     [0]
196                       );
197            x++;
198          }
199      }
200#endif
201   
202#ifdef STATISTICS
203    if (usage_is_set(_usage,USE_STATISTICS))
204      { 
205        for (uint32_t i=0; i<_param->_nb_bank; ++i)
206          *(_stat_use_queue) += reg_QUEUE[i].size();
207        for (uint32_t i=0; i<_param->_nb_context; i++)
208          *(_stat_nb_inst [i]) += reg_NB_INST [i];
209      }
210#endif
211      }
212
213    log_end(Decod_queue,FUNCTION);
214  };
215 
216}; // end namespace decod_queue
217}; // end namespace decod_unit
218}; // end namespace front_end
219}; // end namespace multi_front_end
220}; // end namespace core
221
222}; // end namespace behavioural
223}; // end namespace morpheo             
224#endif
Note: See TracBrowser for help on using the repository browser.