source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/src/Functionnal_unit_transition.cpp @ 117

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

1) Platforms : add new organization for test
2) Load_Store_Unit : add array to count nb_check in store_queue
3) Issue_queue and Core_Glue : rewrite the issue network
4) Special_Register_Unit : add reset value to register CID
5) Softwares : add multicontext test
6) Softwares : add SPECINT
7) Softwares : add MiBench?
7) Read_queue : inhib access for r0
8) Change Core_Glue (network) - dont yet support priority and load balancing scheme

  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Functionnal_unit_transition.cpp 117 2009-05-16 14:42:39Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/include/Functionnal_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_execute_loop {
15namespace execute_loop {
16namespace multi_execute_unit {
17namespace execute_unit {
18namespace functionnal_unit {
19
20
21#undef  FUNCTION
22#define FUNCTION "Functionnal_unit::transition"
23  void Functionnal_unit::transition (void)
24  {
25    log_begin(Functionnal_unit,FUNCTION);
26    log_function(Functionnal_unit,FUNCTION,_name.c_str());
27
28    if (PORT_READ(in_NRESET) == 0)
29      {
30        reg_BUSY_IN  = false;
31        reg_BUSY_OUT = false;
32       
33        for (uint32_t i=0; i<_param->_nb_context; i++)
34          for (uint32_t j=0; j<_param->_nb_front_end; j++)
35            for (uint32_t k=0; k<_param->_nb_ooo_engine; k++)
36              {
37//              uint32_t num_thread = get_num_thread(i,_param->_size_context_id,
38//                                                   j,_param->_size_front_end_id,
39//                                                   k,_param->_size_ooo_engine_id);
40               
41                for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++)
42                  {
43                    function_execute_end_cycle_t * fct = (_param->_get_custom_information()._get_custom_execute_reset(x));
44                   
45                    if (fct != NULL)
46                      (* fct) (_execute_register[i][j][k], _execute_param);
47                  }
48              }
49      }
50    else
51      {
52        // Test if pop
53        if (internal_EXECUTE_OUT_VAL and PORT_READ(in_EXECUTE_OUT_ACK))
54          {
55            log_printf(TRACE,Functionnal_unit,FUNCTION,"  * EXECUTE_OUT : Transaction Accepted");
56            // transaction
57            reg_BUSY_OUT = false;
58          }
59       
60
61        if (reg_BUSY_IN and not reg_BUSY_OUT)
62          {
63            reg_BUSY_OUT = reg_BUSY_IN;
64            reg_BUSY_IN  = false;
65
66            _execute_operation_out->_timing        = _execute_operation_in->_timing       ;
67            _execute_operation_out->_context_id    = _execute_operation_in->_context_id   ;
68            _execute_operation_out->_front_end_id  = _execute_operation_in->_front_end_id ;
69            _execute_operation_out->_ooo_engine_id = _execute_operation_in->_ooo_engine_id;
70            _execute_operation_out->_packet_id     = _execute_operation_in->_packet_id    ;
71            _execute_operation_out->_operation     = _execute_operation_in->_operation    ;
72            _execute_operation_out->_type          = _execute_operation_in->_type         ;
73            _execute_operation_out->_has_immediat  = _execute_operation_in->_has_immediat ;
74            _execute_operation_out->_immediat      = _execute_operation_in->_immediat     ;
75            _execute_operation_out->_data_ra       = _execute_operation_in->_data_ra      ;
76            _execute_operation_out->_data_rb       = _execute_operation_in->_data_rb      ;
77            _execute_operation_out->_data_rc       = _execute_operation_in->_data_rc      ;
78            _execute_operation_out->_data_rd       = _execute_operation_in->_data_rd      ;
79            _execute_operation_out->_data_re       = _execute_operation_in->_data_re      ;
80            _execute_operation_out->_write_rd      = _execute_operation_in->_write_rd     ;
81            _execute_operation_out->_num_reg_rd    = _execute_operation_in->_num_reg_rd   ;
82            _execute_operation_out->_write_re      = _execute_operation_in->_write_re     ;
83            _execute_operation_out->_num_reg_re    = _execute_operation_in->_num_reg_re   ;
84            _execute_operation_out->_exception     = _execute_operation_in->_exception    ;
85            _execute_operation_out->_no_sequence   = _execute_operation_in->_no_sequence  ;
86            _execute_operation_out->_address       = _execute_operation_in->_address      ;
87          }
88
89
90
91        // Test if push
92        execute_register_t * execute_register = NULL;
93
94        if (PORT_READ(in_EXECUTE_IN_VAL) and internal_EXECUTE_IN_ACK)
95          {
96            log_printf(TRACE,Functionnal_unit,FUNCTION,"  * EXECUTE_IN : Transaction Accepted");
97
98            reg_BUSY_IN = true;
99
100            Tcontext_t   context_id    = (_param->_have_port_context_id   )?PORT_READ(in_EXECUTE_IN_CONTEXT_ID   ):0;
101            Tcontext_t   front_end_id  = (_param->_have_port_front_end_id )?PORT_READ(in_EXECUTE_IN_FRONT_END_ID ):0;
102            Tcontext_t   ooo_engine_id = (_param->_have_port_ooo_engine_id)?PORT_READ(in_EXECUTE_IN_OOO_ENGINE_ID):0;
103            Tcontext_t   packet_id     = (_param->_have_port_rob_ptr      )?PORT_READ(in_EXECUTE_IN_PACKET_ID    ):0;
104            Toperation_t operation     = PORT_READ(in_EXECUTE_IN_OPERATION);
105            Ttype_t      type          = PORT_READ(in_EXECUTE_IN_TYPE);
106           
107            _execute_operation_in->_context_id    = context_id   ;
108            _execute_operation_in->_front_end_id  = front_end_id ;
109            _execute_operation_in->_ooo_engine_id = ooo_engine_id;
110            _execute_operation_in->_packet_id     = packet_id    ;
111            _execute_operation_in->_operation     = operation    ;
112            _execute_operation_in->_type          = type         ;
113            _execute_operation_in->_has_immediat  = PORT_READ(in_EXECUTE_IN_HAS_IMMEDIAT);
114            _execute_operation_in->_immediat      = PORT_READ(in_EXECUTE_IN_IMMEDIAT    );
115            _execute_operation_in->_data_ra       = PORT_READ(in_EXECUTE_IN_DATA_RA     );
116            _execute_operation_in->_data_rb       = PORT_READ(in_EXECUTE_IN_DATA_RB     );
117            _execute_operation_in->_data_rc       = PORT_READ(in_EXECUTE_IN_DATA_RC     );
118            _execute_operation_in->_write_rd      = PORT_READ(in_EXECUTE_IN_WRITE_RD    );
119            _execute_operation_in->_num_reg_rd    = PORT_READ(in_EXECUTE_IN_NUM_REG_RD  );
120            _execute_operation_in->_data_rd       = 0; // no necessaray
121            _execute_operation_in->_write_re      = PORT_READ(in_EXECUTE_IN_WRITE_RE    );
122            _execute_operation_in->_num_reg_re    = PORT_READ(in_EXECUTE_IN_NUM_REG_RE  );
123            _execute_operation_in->_data_re       = 0; // no necessaray
124
125            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * context_id    : %d",_execute_operation_in->_context_id   );
126            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * front_end_id  : %d",_execute_operation_in->_front_end_id );
127            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * ooo_engine_id : %d",_execute_operation_in->_ooo_engine_id);
128            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * packet_id     : %d",_execute_operation_in->_packet_id    );
129            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * operation     : %d",_execute_operation_in->_operation    );
130            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * type          : %s",toString(_execute_operation_in->_type).c_str());
131            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * has_immediat  : %d",_execute_operation_in->_has_immediat );
132            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * immediat      : %.8x",_execute_operation_in->_immediat     );
133            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * data_ra       : %.8x",_execute_operation_in->_data_ra      );
134            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * data_rb       : %.8x",_execute_operation_in->_data_rb      );
135            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * data_rc       : %.8x",_execute_operation_in->_data_rc      );
136            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * write_rd      : %d"  ,_execute_operation_in->_write_rd     );
137            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * num_reg_rd    : %d"  ,_execute_operation_in->_num_reg_rd   );
138            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * write_re      : %d"  ,_execute_operation_in->_write_re     );
139            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * num_reg_re    : %d"  ,_execute_operation_in->_num_reg_re   );
140           
141#ifdef DEBUG_TEST
142            if (type >= _param->_nb_type)
143              throw ERRORMORPHEO(FUNCTION,"Invalid type : '"+toString(type)+"' is higher that _nb_type");
144            if (operation >= _param->_nb_operation)
145              throw ERRORMORPHEO(FUNCTION,"Invalid operation : '"+toString(operation)+"' is higher that _nb_operation");
146#endif
147
148            // execute the operation
149            execute_register = _execute_register[context_id][front_end_id][ooo_engine_id];
150
151            // Test if operation is a custom
152            if (type == TYPE_CUSTOM)
153              {
154//              uint32_t num_thread = get_num_thread(context_id   ,_param->_size_context_id,
155//                                                   front_end_id ,_param->_size_front_end_id,
156//                                                   ooo_engine_id,_param->_size_ooo_engine_id);
157
158                (*(_param->_get_custom_information()._get_custom_execute_genMoore(operation))) (_execute_operation_in, execute_register, _execute_param);
159              }
160            else
161              (*(_function_execute[type][operation])) (_execute_operation_in, execute_register, _execute_param);
162
163
164            log_printf(TRACE,Functionnal_unit,FUNCTION,"    -----------------");
165            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * latence       : %.8x",_execute_operation_in->_timing._latence);
166            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * delay         : %.8x",_execute_operation_in->_timing._delay);
167            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * data_rd       : %.8x",_execute_operation_in->_data_rd    );
168            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * data_re       : %.8x",_execute_operation_in->_data_re    );
169            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * exception     : %d"  ,_execute_operation_in->_exception  );
170            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * no_sequence   : %d"  ,_execute_operation_in->_no_sequence);
171            log_printf(TRACE,Functionnal_unit,FUNCTION,"    * address       : %.8x (%.8x)",_execute_operation_in->_address,_execute_operation_in->_address<<2);
172
173#ifdef STATISTICS
174            if (usage_is_set(_usage,USE_STATISTICS))
175              {
176                (*_stat_use_functionnal_unit) ++;
177                (*_stat_sum_delay)   += _execute_operation_in->_timing._delay;
178                (*_stat_sum_latence) += _execute_operation_in->_timing._latence;
179              }
180#endif
181          }
182       
183        // End cycle
184        {
185          for (uint32_t i=0; i<_param->_nb_context; i++)
186            for (uint32_t j=0; j<_param->_nb_front_end; j++)
187              for (uint32_t k=0; k<_param->_nb_ooo_engine; k++)
188                {
189//                uint32_t num_thread = get_num_thread(i,_param->_size_context_id,
190//                                                     j,_param->_size_front_end_id,
191//                                                     k,_param->_size_ooo_engine_id);
192
193                  for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++)
194                    {
195                      function_execute_end_cycle_t * fct = (_param->_get_custom_information()._get_custom_execute_transition(x));
196                     
197                      if (fct != NULL)
198                        (* fct) (_execute_register[i][j][k], _execute_param);
199                    }
200                }
201
202          // Update status
203          if (execute_register != NULL)
204            {
205              // They have an access
206              execute_register->_i_write_spr = false;
207              execute_register->_i_read_spr  = false;
208            }
209        }
210
211       
212        // each cycle : decrease the latence
213        if (reg_BUSY_OUT and (_execute_operation_out->_timing._latence > 0))
214          _execute_operation_out->_timing._latence --;
215      }
216   
217#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
218    end_cycle ();
219#endif
220
221    log_end(Functionnal_unit,FUNCTION);
222  };
223
224}; // end namespace functionnal_unit
225}; // end namespace execute_unit
226}; // end namespace multi_execute_unit
227}; // end namespace execute_loop
228}; // end namespace multi_execute_loop
229}; // end namespace core
230
231}; // end namespace behavioural
232}; // end namespace morpheo             
233#endif
Note: See TracBrowser for help on using the repository browser.