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

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

1) decod_queue : add reg_LAST_SLOT.
2) Commit : insert on event -> to pop decod_queue. Head test : add information (speculative or not)
3) Context State / UPT : Branch miss and Load miss in same cycle.
4) Free List : Bank is on LSB not MSB.
5) Platforms : move data

  • Property svn:keywords set to Id
File size: 6.4 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Free_List_unit_transition.cpp 108 2009-02-12 11:55:06Z 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        reg_BANK_PRIORITY = 0;
31        for (uint32_t i=0; i<_param->_nb_bank; i++)
32          {
33            _gpr_list[i].clear();
34            _spr_list[i].clear();
35          }
36      }
37    else
38      {
39        // ==================================================
40        // =====[ POP ]======================================
41        // ==================================================
42        for (uint32_t i=0; i<_param->_nb_pop; i++)
43          if (PORT_READ(in_POP_VAL[i]) and internal_POP_ACK [i])
44            {
45              log_printf(TRACE,Free_List_unit,FUNCTION,"  * POP [%d]",i);
46
47              if (PORT_READ(in_POP_GPR_VAL [i]))
48                _gpr_list [internal_POP_GPR_BANK[i]].pop_front();
49         
50              if (PORT_READ(in_POP_SPR_VAL [i]))
51                _spr_list [internal_POP_SPR_BANK[i]].pop_front();
52            }
53
54        // ==================================================
55        // =====[ PUSH_GPR ]=================================
56        // ==================================================
57        for (uint32_t i=0; i<_param->_nb_push; i++)
58          if (PORT_READ(in_PUSH_GPR_VAL[i]) and internal_PUSH_GPR_ACK [i])
59            {
60              log_printf(TRACE,Free_List_unit,FUNCTION,"  * PUSH_GPR[%d]",i);
61              log_printf(TRACE,Free_List_unit,FUNCTION,"    * bank    : %d",internal_PUSH_GPR_BANK[i]);
62              log_printf(TRACE,Free_List_unit,FUNCTION,"    * num_reg : %d",PORT_READ(in_PUSH_GPR_NUM_REG [i]));
63
64              _gpr_list [internal_PUSH_GPR_BANK[i]].push_back(PORT_READ(in_PUSH_GPR_NUM_REG [i]));
65            }
66        // ==================================================
67        // =====[ PUSH_SPR ]=================================
68        // ==================================================
69        for (uint32_t i=0; i<_param->_nb_push; i++)
70          if (PORT_READ(in_PUSH_SPR_VAL[i]) and internal_PUSH_SPR_ACK [i])
71            {
72              log_printf(TRACE,Free_List_unit,FUNCTION,"  * PUSH_SPR[%d]",i);
73              log_printf(TRACE,Free_List_unit,FUNCTION,"    * bank    : %d",internal_PUSH_SPR_BANK[i]);
74              log_printf(TRACE,Free_List_unit,FUNCTION,"    * num_reg : %d",PORT_READ(in_PUSH_SPR_NUM_REG [i]));
75
76              _spr_list [internal_PUSH_SPR_BANK[i]].push_back(PORT_READ(in_PUSH_SPR_NUM_REG [i]));
77            }
78
79        if (_param->_priority == PRIORITY_ROUND_ROBIN)
80          reg_BANK_PRIORITY = (reg_BANK_PRIORITY+1)%_param->_nb_bank_by_pop;
81
82#if (DEBUG >= DEBUG_TRACE) and (DEBUG_Free_List_unit == true)
83        {
84          uint32_t limit = 4;
85     
86          log_printf(TRACE,Free_List_unit,FUNCTION,"  * Dump Free List");
87          for (uint32_t i=0; i<_param->_nb_bank; ++i)
88            {
89              log_printf(TRACE,Free_List_unit,FUNCTION,"    * GPR [%d] - NB_ELT : %d",i,_gpr_list[i].size());
90
91              uint32_t j=0;
92              for (std::list<Tgeneral_address_t>::iterator it=_gpr_list[i].begin();
93                   it!=_gpr_list[i].end();
94                   )
95                {
96                  std::string str = "";
97             
98                  for (uint32_t x=0; x<limit; x++)
99                    {
100                      if (it==_gpr_list[i].end())
101                        break;
102                      else
103                        str+=toString("GPR[%.4d][%.4d] : %.5d | ",i,j,*it);
104                      ++it;
105                      ++j;
106                    }
107                  log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * %s",str.c_str());
108                }
109            }
110
111          for (uint32_t i=0; i<_param->_nb_bank; ++i)
112            {
113              log_printf(TRACE,Free_List_unit,FUNCTION,"    * SPR [%d] - NB_ELT : %d",i,_spr_list[i].size());
114
115              uint32_t j=0;
116              for (std::list<Tspecial_address_t>::iterator it=_spr_list[i].begin();
117                   it!=_spr_list[i].end();
118                   )
119                {
120                  std::string str = "";
121
122                  for (uint32_t x=0; x<limit; x++)
123                    {
124                      if (it==_spr_list[i].end())
125                        break;
126                      else
127                        str+=toString("SPR[%.4d][%.4d] : %.5d | ",i,j,*it);
128                      ++it;
129                      ++j;
130                    }
131                  log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"      * %s",str.c_str());
132                }
133            }
134        }
135#endif
136
137#ifdef DEBUG_TEST
138        if (1)
139          for (uint32_t i=0; i<_param->_nb_bank; ++i)
140          {
141            for (std::list<Tgeneral_address_t>::iterator it1=_gpr_list[i].begin();
142                 it1!=_gpr_list[i].end();
143                 ++it1
144                 )
145              {
146                std::list<Tgeneral_address_t>::iterator it2 = it1;
147
148                it2 ++;
149                while (it2 != _gpr_list[i].end())
150                  {
151                    if (*it1 == *it2)
152                      throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same GPR (%d)"),*it1));
153                    it2 ++;
154                  }
155              }
156
157            for (std::list<Tspecial_address_t>::iterator it1=_spr_list[i].begin();
158                 it1!=_spr_list[i].end();
159                 ++it1
160                 )
161              {
162                std::list<Tspecial_address_t>::iterator it2 = it1;
163
164                it2 ++;
165                while (it2 != _spr_list[i].end())
166                  {
167                    if (*it1 == *it2)
168                      throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same SPR (%d)"),*it1));
169                    it2 ++;
170                  }
171              }
172          }
173#endif
174
175      }
176
177#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
178    end_cycle ();
179#endif
180
181    log_end(Free_List_unit,FUNCTION);
182  };
183
184}; // end namespace free_list_unit
185}; // end namespace register_translation_unit
186}; // end namespace rename_unit
187}; // end namespace ooo_engine
188}; // end namespace multi_ooo_engine
189}; // end namespace core
190
191}; // end namespace behavioural
192}; // end namespace morpheo             
193#endif
Note: See TracBrowser for help on using the repository browser.