source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Free_List_unit/src/Free_List_unit_transition.cpp @ 112

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

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

  • Property svn:keywords set to Id
File size: 7.4 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Free_List_unit_transition.cpp 112 2009-03-18 22:36:26Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Free_List_unit/include/Free_List_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace rename_unit {
17namespace register_translation_unit {
18namespace free_list_unit {
19
20
21#undef  FUNCTION
22#define FUNCTION "Free_List_unit::transition"
23  void Free_List_unit::transition (void)
24  {
25    log_begin(Free_List_unit,FUNCTION);
26    log_function(Free_List_unit,FUNCTION,_name.c_str());
27
28    if (PORT_READ(in_NRESET) == 0)
29      {
30        _priority_gpr->reset();
31        _priority_spr->reset();
32
33        for (uint32_t i=0; i<_param->_nb_bank; i++)
34          {
35            _gpr_list[i].clear();
36            _spr_list[i].clear();
37          }
38      }
39    else
40      {
41        _priority_gpr->transition();
42        _priority_spr->transition();
43
44        // ==================================================
45        // =====[ POP ]======================================
46        // ==================================================
47        for (uint32_t i=0; i<_param->_nb_pop; i++)
48          if (PORT_READ(in_POP_VAL[i]) and internal_POP_ACK [i])
49            {
50              log_printf(TRACE,Free_List_unit,FUNCTION,"  * POP [%d]",i);
51
52#ifdef STATISTICS
53              if (usage_is_set(_usage,USE_STATISTICS))
54                (*_stat_nb_inst_pop) ++;
55#endif
56
57              if (PORT_READ(in_POP_GPR_VAL [i]))
58                {
59#ifdef STATISTICS
60                  if (usage_is_set(_usage,USE_STATISTICS))
61                    (*_stat_nb_inst_pop_gpr) ++;
62#endif
63                  _gpr_list [internal_POP_GPR_BANK[i]].pop_front();
64                }
65         
66              if (PORT_READ(in_POP_SPR_VAL [i]))
67                {
68#ifdef STATISTICS
69                  if (usage_is_set(_usage,USE_STATISTICS))
70                    (*_stat_nb_inst_pop_spr) ++;
71#endif
72                  _spr_list [internal_POP_SPR_BANK[i]].pop_front();
73                }
74            }
75
76        // ==================================================
77        // =====[ PUSH_GPR ]=================================
78        // ==================================================
79        for (uint32_t i=0; i<_param->_nb_push; i++)
80          if (PORT_READ(in_PUSH_GPR_VAL[i]) and internal_PUSH_GPR_ACK [i])
81            {
82              log_printf(TRACE,Free_List_unit,FUNCTION,"  * PUSH_GPR[%d]",i);
83              log_printf(TRACE,Free_List_unit,FUNCTION,"    * bank    : %d",internal_PUSH_GPR_BANK[i]);
84              log_printf(TRACE,Free_List_unit,FUNCTION,"    * num_reg : %d",PORT_READ(in_PUSH_GPR_NUM_REG [i]));
85
86#ifdef STATISTICS
87              if (usage_is_set(_usage,USE_STATISTICS))
88                (*_stat_nb_inst_push_gpr) ++;
89#endif
90
91              _gpr_list [internal_PUSH_GPR_BANK[i]].push_back(PORT_READ(in_PUSH_GPR_NUM_REG [i]));
92            }
93        // ==================================================
94        // =====[ PUSH_SPR ]=================================
95        // ==================================================
96        for (uint32_t i=0; i<_param->_nb_push; i++)
97          if (PORT_READ(in_PUSH_SPR_VAL[i]) and internal_PUSH_SPR_ACK [i])
98            {
99              log_printf(TRACE,Free_List_unit,FUNCTION,"  * PUSH_SPR[%d]",i);
100              log_printf(TRACE,Free_List_unit,FUNCTION,"    * bank    : %d",internal_PUSH_SPR_BANK[i]);
101              log_printf(TRACE,Free_List_unit,FUNCTION,"    * num_reg : %d",PORT_READ(in_PUSH_SPR_NUM_REG [i]));
102
103#ifdef STATISTICS
104              if (usage_is_set(_usage,USE_STATISTICS))
105                (*_stat_nb_inst_push_spr) ++;
106#endif
107
108              _spr_list [internal_PUSH_SPR_BANK[i]].push_back(PORT_READ(in_PUSH_SPR_NUM_REG [i]));
109            }
110
111#ifdef STATISTICS
112        if (usage_is_set(_usage,USE_STATISTICS))
113          for (uint32_t i=0; i<_param->_nb_bank; ++i)
114            {
115             
116              (*(_stat_bank_gpr_nb_elt [i])) += _gpr_list[i].size();
117              (*(_stat_bank_spr_nb_elt [i])) += _spr_list[i].size();
118            }
119#endif
120
121#if (DEBUG >= DEBUG_TRACE) and (DEBUG_Free_List_unit == true)
122        {
123          uint32_t limit = 4;
124     
125          log_printf(TRACE,Free_List_unit,FUNCTION,"  * Dump Free List");
126          for (uint32_t i=0; i<_param->_nb_bank; ++i)
127            {
128              log_printf(TRACE,Free_List_unit,FUNCTION,"    * GPR [%d] - NB_ELT : %d",i,_gpr_list[i].size());
129
130              uint32_t j=0;
131              for (std::list<Tgeneral_address_t>::iterator it=_gpr_list[i].begin();
132                   it!=_gpr_list[i].end();
133                   )
134                {
135                  std::string str = "";
136             
137                  for (uint32_t x=0; x<limit; x++)
138                    {
139                      if (it==_gpr_list[i].end())
140                        break;
141                      else
142                        str+=toString("GPR[%.4d][%.4d] : %.5d | ",i,j,*it);
143                      ++it;
144                      ++j;
145                    }
146                  log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * %s",str.c_str());
147                }
148            }
149
150          for (uint32_t i=0; i<_param->_nb_bank; ++i)
151            {
152              log_printf(TRACE,Free_List_unit,FUNCTION,"    * SPR [%d] - NB_ELT : %d",i,_spr_list[i].size());
153
154              uint32_t j=0;
155              for (std::list<Tspecial_address_t>::iterator it=_spr_list[i].begin();
156                   it!=_spr_list[i].end();
157                   )
158                {
159                  std::string str = "";
160
161                  for (uint32_t x=0; x<limit; x++)
162                    {
163                      if (it==_spr_list[i].end())
164                        break;
165                      else
166                        str+=toString("SPR[%.4d][%.4d] : %.5d | ",i,j,*it);
167                      ++it;
168                      ++j;
169                    }
170                  log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * %s",str.c_str());
171                }
172            }
173        }
174#endif
175
176#ifdef DEBUG_TEST
177        if (1)
178          for (uint32_t i=0; i<_param->_nb_bank; ++i)
179            {
180            for (std::list<Tgeneral_address_t>::iterator it1=_gpr_list[i].begin();
181                 it1!=_gpr_list[i].end();
182                 ++it1
183                 )
184              {
185                std::list<Tgeneral_address_t>::iterator it2 = it1;
186
187                it2 ++;
188                while (it2 != _gpr_list[i].end())
189                  {
190                    if (*it1 == *it2)
191                      throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same GPR (%d)"),*it1));
192                    it2 ++;
193                  }
194              }
195
196            for (std::list<Tspecial_address_t>::iterator it1=_spr_list[i].begin();
197                 it1!=_spr_list[i].end();
198                 ++it1
199                 )
200              {
201                std::list<Tspecial_address_t>::iterator it2 = it1;
202
203                it2 ++;
204                while (it2 != _spr_list[i].end())
205                  {
206                    if (*it1 == *it2)
207                      throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same SPR (%d)"),*it1));
208                    it2 ++;
209                  }
210              }
211          }
212#endif
213
214      }
215
216#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
217    end_cycle ();
218#endif
219
220    log_end(Free_List_unit,FUNCTION);
221  };
222
223}; // end namespace free_list_unit
224}; // end namespace register_translation_unit
225}; // end namespace rename_unit
226}; // end namespace ooo_engine
227}; // end namespace multi_ooo_engine
228}; // end namespace core
229
230}; // end namespace behavioural
231}; // end namespace morpheo             
232#endif
Note: See TracBrowser for help on using the repository browser.