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
RevLine 
[78]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  {
[88]25    log_begin(Free_List_unit,FUNCTION);
26    log_function(Free_List_unit,FUNCTION,_name.c_str());
[78]27
28    if (PORT_READ(in_NRESET) == 0)
29      {
[109]30        _priority_gpr->reset();
31        _priority_spr->reset();
32
[78]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      {
[109]41        _priority_gpr->transition();
42        _priority_spr->transition();
43
[78]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            {
[88]50              log_printf(TRACE,Free_List_unit,FUNCTION,"  * POP [%d]",i);
51
[110]52#ifdef STATISTICS
[112]53              if (usage_is_set(_usage,USE_STATISTICS))
54                (*_stat_nb_inst_pop) ++;
[110]55#endif
56
[78]57              if (PORT_READ(in_POP_GPR_VAL [i]))
[110]58                {
59#ifdef STATISTICS
[112]60                  if (usage_is_set(_usage,USE_STATISTICS))
61                    (*_stat_nb_inst_pop_gpr) ++;
[110]62#endif
63                  _gpr_list [internal_POP_GPR_BANK[i]].pop_front();
64                }
[78]65         
66              if (PORT_READ(in_POP_SPR_VAL [i]))
[110]67                {
68#ifdef STATISTICS
[112]69                  if (usage_is_set(_usage,USE_STATISTICS))
70                    (*_stat_nb_inst_pop_spr) ++;
[110]71#endif
72                  _spr_list [internal_POP_SPR_BANK[i]].pop_front();
73                }
[78]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])
[88]81            {
82              log_printf(TRACE,Free_List_unit,FUNCTION,"  * PUSH_GPR[%d]",i);
[108]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]));
[78]85
[110]86#ifdef STATISTICS
[112]87              if (usage_is_set(_usage,USE_STATISTICS))
88                (*_stat_nb_inst_push_gpr) ++;
[110]89#endif
90
[108]91              _gpr_list [internal_PUSH_GPR_BANK[i]].push_back(PORT_READ(in_PUSH_GPR_NUM_REG [i]));
[88]92            }
[78]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])
[88]98            {
99              log_printf(TRACE,Free_List_unit,FUNCTION,"  * PUSH_SPR[%d]",i);
[108]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]));
[78]102
[110]103#ifdef STATISTICS
[112]104              if (usage_is_set(_usage,USE_STATISTICS))
105                (*_stat_nb_inst_push_spr) ++;
[110]106#endif
107
[108]108              _spr_list [internal_PUSH_SPR_BANK[i]].push_back(PORT_READ(in_PUSH_SPR_NUM_REG [i]));
[88]109            }
110
[110]111#ifdef STATISTICS
[112]112        if (usage_is_set(_usage,USE_STATISTICS))
[110]113          for (uint32_t i=0; i<_param->_nb_bank; ++i)
114            {
[112]115             
[110]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
[88]121#if (DEBUG >= DEBUG_TRACE) and (DEBUG_Free_List_unit == true)
[106]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            {
[108]128              log_printf(TRACE,Free_List_unit,FUNCTION,"    * GPR [%d] - NB_ELT : %d",i,_gpr_list[i].size());
129
[106]130              uint32_t j=0;
[108]131              for (std::list<Tgeneral_address_t>::iterator it=_gpr_list[i].begin();
132                   it!=_gpr_list[i].end();
[106]133                   )
134                {
135                  std::string str = "";
136             
137                  for (uint32_t x=0; x<limit; x++)
138                    {
[108]139                      if (it==_gpr_list[i].end())
[106]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            }
[88]149
[106]150          for (uint32_t i=0; i<_param->_nb_bank; ++i)
151            {
[108]152              log_printf(TRACE,Free_List_unit,FUNCTION,"    * SPR [%d] - NB_ELT : %d",i,_spr_list[i].size());
153
[106]154              uint32_t j=0;
[108]155              for (std::list<Tspecial_address_t>::iterator it=_spr_list[i].begin();
156                   it!=_spr_list[i].end();
[106]157                   )
158                {
159                  std::string str = "";
160
161                  for (uint32_t x=0; x<limit; x++)
162                    {
[108]163                      if (it==_spr_list[i].end())
[106]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)
[108]178          for (uint32_t i=0; i<_param->_nb_bank; ++i)
[110]179            {
[108]180            for (std::list<Tgeneral_address_t>::iterator it1=_gpr_list[i].begin();
181                 it1!=_gpr_list[i].end();
[106]182                 ++it1
183                 )
[88]184              {
[106]185                std::list<Tgeneral_address_t>::iterator it2 = it1;
186
187                it2 ++;
[108]188                while (it2 != _gpr_list[i].end())
[106]189                  {
190                    if (*it1 == *it2)
191                      throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same GPR (%d)"),*it1));
192                    it2 ++;
193                  }
[88]194              }
[106]195
[108]196            for (std::list<Tspecial_address_t>::iterator it1=_spr_list[i].begin();
197                 it1!=_spr_list[i].end();
[106]198                 ++it1
199                 )
[88]200              {
[106]201                std::list<Tspecial_address_t>::iterator it2 = it1;
202
203                it2 ++;
[108]204                while (it2 != _spr_list[i].end())
[106]205                  {
206                    if (*it1 == *it2)
207                      throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same SPR (%d)"),*it1));
208                    it2 ++;
209                  }
[88]210              }
211          }
[106]212#endif
[88]213
[78]214      }
215
216#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
217    end_cycle ();
218#endif
219
[88]220    log_end(Free_List_unit,FUNCTION);
[78]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.