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

Last change on this file since 77 was 77, checked in by rosiere, 16 years ago
  • Add two component :
    • network between read unit and execute unit
    • network between execute unit and write unit
  • remove parameters "nb_operation" and "nb_type"
  • in write_queue add the special case : load_speculative
File size: 5.7 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
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_printf(FUNC,Functionnal_unit,FUNCTION,"Begin");
26
27    if (PORT_READ(in_NRESET) == 0)
28      {
29        reg_BUSY = false;
30       
31        for (uint32_t i=0; i<_param->_nb_context; i++)
32          for (uint32_t j=0; j<_param->_nb_front_end; j++)
33            for (uint32_t k=0; k<_param->_nb_ooo_engine; k++)
34              {
35                uint32_t num_thread = get_num_thread(i,_param->_size_context_id,
36                                                     j,_param->_size_front_end_id,
37                                                     k,_param->_size_ooo_engine_id);
38               
39                for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++)
40                  {
41                    function_execute_end_cycle_t * fct = (_param->_get_custom_information(num_thread)._get_custom_execute_reset(x));
42                   
43                    if (fct != NULL)
44                      (* fct) (_execute_register[i][j][k], _execute_param);
45                  }
46              }
47      }
48    else
49      {
50        // Test if pop
51        if (internal_EXECUTE_OUT_VAL and PORT_READ(in_EXECUTE_OUT_ACK))
52          {
53            // transaction
54            reg_BUSY = false;
55          }
56       
57        // Test if push
58        execute_register_t * execute_register = NULL;
59
60        if (PORT_READ(in_EXECUTE_IN_VAL) and internal_EXECUTE_IN_ACK)
61          {
62            reg_BUSY = true;
63
64            Tcontext_t   context_id    = (_param->_have_port_context_id   )?PORT_READ(in_EXECUTE_IN_CONTEXT_ID   ):0;
65            Tcontext_t   front_end_id  = (_param->_have_port_front_end_id )?PORT_READ(in_EXECUTE_IN_FRONT_END_ID ):0;
66            Tcontext_t   ooo_engine_id = (_param->_have_port_ooo_engine_id)?PORT_READ(in_EXECUTE_IN_OOO_ENGINE_ID):0;
67            Tcontext_t   packet_id     = (_param->_have_port_packet_id    )?PORT_READ(in_EXECUTE_IN_PACKET_ID    ):0;
68            Toperation_t operation     = PORT_READ(in_EXECUTE_IN_OPERATION);
69            Ttype_t      type          = PORT_READ(in_EXECUTE_IN_TYPE);
70           
71            _execute_operation->_context_id    = context_id   ;
72            _execute_operation->_front_end_id  = front_end_id ;
73            _execute_operation->_ooo_engine_id = ooo_engine_id;
74            _execute_operation->_packet_id     = packet_id    ;
75            _execute_operation->_operation     = operation    ;
76            _execute_operation->_type          = type         ;
77            _execute_operation->_has_immediat  = PORT_READ(in_EXECUTE_IN_HAS_IMMEDIAT);
78            _execute_operation->_immediat      = PORT_READ(in_EXECUTE_IN_IMMEDIAT    );
79            _execute_operation->_data_ra       = PORT_READ(in_EXECUTE_IN_DATA_RA     );
80            _execute_operation->_data_rb       = PORT_READ(in_EXECUTE_IN_DATA_RB     );
81            _execute_operation->_data_rc       = PORT_READ(in_EXECUTE_IN_DATA_RC     );
82            _execute_operation->_write_rd      = PORT_READ(in_EXECUTE_IN_WRITE_RD    );
83            _execute_operation->_num_reg_rd    = PORT_READ(in_EXECUTE_IN_NUM_REG_RD  );
84            _execute_operation->_write_re      = PORT_READ(in_EXECUTE_IN_WRITE_RE    );
85            _execute_operation->_num_reg_re    = PORT_READ(in_EXECUTE_IN_NUM_REG_RE  );
86
87#ifdef DEBUG_TEST
88            if (type >= _param->_nb_type)
89              throw ERRORMORPHEO(FUNCTION,"Invalid type : '"+toString(type)+"' is higher that _nb_type");
90            if (operation >= _param->_nb_operation)
91              throw ERRORMORPHEO(FUNCTION,"Invalid operation : '"+toString(operation)+"' is higher that _nb_operation");
92#endif
93
94            // execute the operation
95            execute_register = _execute_register[context_id][front_end_id][ooo_engine_id];
96
97            // Test if operation is a custom
98            if (type == TYPE_CUSTOM)
99              {
100                uint32_t num_thread = get_num_thread(context_id   ,_param->_size_context_id,
101                                                     front_end_id ,_param->_size_front_end_id,
102                                                     ooo_engine_id,_param->_size_ooo_engine_id);
103
104                (*(_param->_get_custom_information(num_thread)._get_custom_execute_genMoore(operation))) (_execute_operation, execute_register, _execute_param);
105              }
106            else
107              (*(_function_execute[type][operation])) (_execute_operation, execute_register, _execute_param);
108
109
110#ifdef STATISTICS
111            (*_stat_use_functionnal_unit) ++;
112            (*_stat_sum_delay)   += _execute_operation->_timing._delay;
113            (*_stat_sum_latence) += _execute_operation->_timing._latence;
114#endif
115          }
116       
117        // End cycle
118        {
119          for (uint32_t i=0; i<_param->_nb_context; i++)
120            for (uint32_t j=0; j<_param->_nb_front_end; j++)
121              for (uint32_t k=0; k<_param->_nb_ooo_engine; k++)
122                {
123                  uint32_t num_thread = get_num_thread(i,_param->_size_context_id,
124                                                       j,_param->_size_front_end_id,
125                                                       k,_param->_size_ooo_engine_id);
126
127                  for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++)
128                    {
129                      function_execute_end_cycle_t * fct = (_param->_get_custom_information(num_thread)._get_custom_execute_transition(x));
130                     
131                      if (fct != NULL)
132                        (* fct) (_execute_register[i][j][k], _execute_param);
133                    }
134                }
135
136          // Update status
137          if (execute_register != NULL)
138            {
139              // They have an access
140              execute_register->_i_write_spr = false;
141              execute_register->_i_read_spr  = false;
142            }
143        }
144      }
145
146    // each cycle : decrease the latence
147    if (reg_BUSY and (_execute_operation->_timing._latence > 0))
148      _execute_operation->_timing._latence --;
149
150#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
151    end_cycle ();
152#endif
153
154    log_printf(FUNC,Functionnal_unit,FUNCTION,"End");
155  };
156
157}; // end namespace functionnal_unit
158}; // end namespace execute_unit
159}; // end namespace multi_execute_unit
160}; // end namespace execute_loop
161}; // end namespace multi_execute_loop
162}; // end namespace core
163
164}; // end namespace behavioural
165}; // end namespace morpheo             
166#endif
Note: See TracBrowser for help on using the repository browser.