[77] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 122 2009-06-03 08:15:51Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Read_unit_to_Execution_unit/include/Parameters.h" |
---|
[88] | 9 | #include "Common/include/Max.h" |
---|
[77] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_execute_loop { |
---|
| 15 | namespace execute_loop { |
---|
| 16 | namespace network { |
---|
| 17 | namespace read_unit_to_execution_unit { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Read_unit_to_Execution_unit::Parameters" |
---|
| 22 | Parameters::Parameters (uint32_t nb_read_unit , |
---|
[88] | 23 | uint32_t * nb_read_unit_port , |
---|
[77] | 24 | uint32_t nb_execute_unit , |
---|
[88] | 25 | uint32_t * nb_execute_unit_port , |
---|
[77] | 26 | uint32_t nb_context , |
---|
| 27 | uint32_t nb_front_end , |
---|
| 28 | uint32_t nb_ooo_engine , |
---|
| 29 | uint32_t nb_packet , |
---|
| 30 | uint32_t size_general_data , |
---|
| 31 | uint32_t size_special_data , |
---|
| 32 | uint32_t nb_general_register , |
---|
| 33 | uint32_t nb_special_register , |
---|
| 34 | uint32_t size_store_queue , |
---|
| 35 | uint32_t size_load_queue , |
---|
| 36 | Tpriority_t priority , |
---|
[88] | 37 | bool *** table_routing , |
---|
[77] | 38 | bool ** table_execute_type , |
---|
[88] | 39 | bool ** table_execute_thread , |
---|
[120] | 40 | bool * num_thread_valid , |
---|
[88] | 41 | bool is_toplevel ) |
---|
[77] | 42 | { |
---|
| 43 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
| 44 | |
---|
[88] | 45 | _nb_read_unit = nb_read_unit ; |
---|
| 46 | _nb_read_unit_port = nb_read_unit_port ; |
---|
| 47 | _nb_execute_unit = nb_execute_unit ; |
---|
| 48 | _nb_execute_unit_port = nb_execute_unit_port; |
---|
| 49 | _nb_context = nb_context ; |
---|
| 50 | _nb_front_end = nb_front_end ; |
---|
| 51 | _nb_ooo_engine = nb_ooo_engine ; |
---|
| 52 | _nb_packet = nb_packet ; |
---|
| 53 | _nb_general_register = nb_general_register ; |
---|
| 54 | _nb_special_register = nb_special_register ; |
---|
| 55 | _priority = priority ; |
---|
| 56 | _table_routing = table_routing ; |
---|
| 57 | _table_execute_type = table_execute_type ; |
---|
| 58 | _table_execute_thread = table_execute_thread; |
---|
[120] | 59 | _num_thread_valid = num_thread_valid ; |
---|
[77] | 60 | |
---|
[122] | 61 | _nb_thread = get_nb_thread (nb_context, nb_front_end, nb_ooo_engine); |
---|
| 62 | |
---|
[109] | 63 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * table_routing [nb_read_unit][nb_execute_unit][nb_execute_unit_port]"); |
---|
| 64 | for (uint32_t i=0; i<_nb_read_unit; ++i) |
---|
| 65 | for (uint32_t j=0; j<_nb_execute_unit; ++j) |
---|
| 66 | for (uint32_t k=0; k<_nb_execute_unit_port[j]; ++k) |
---|
| 67 | if (_table_routing [i][j][k]) |
---|
| 68 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," [%d][%d][%d] -> true",i,j,k); |
---|
| 69 | |
---|
| 70 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * table_execute_type [nb_execute_unit][nb_type]"); |
---|
| 71 | for (uint32_t i=0; i<_nb_execute_unit; ++i) |
---|
| 72 | for (uint32_t j=0; j<_nb_type; ++j) |
---|
| 73 | if (_table_execute_type [i][j]) |
---|
| 74 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," [%d][%d] -> true",i,j); |
---|
| 75 | |
---|
| 76 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * table_execute_thread [nb_execute_unit][nb_thread]"); |
---|
| 77 | for (uint32_t i=0; i<_nb_execute_unit; ++i) |
---|
| 78 | for (uint32_t j=0; j<_nb_thread; ++j) |
---|
| 79 | if (_table_execute_thread [i][j]) |
---|
| 80 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," [%d][%d] -> true",i,j); |
---|
| 81 | |
---|
[88] | 82 | _max_nb_read_unit_port = max<uint32_t>(_nb_read_unit_port, _nb_read_unit); |
---|
| 83 | _max_nb_execute_unit_port= max<uint32_t>(_nb_execute_unit_port, _nb_execute_unit); |
---|
[78] | 84 | |
---|
[88] | 85 | _nb_load_store_unit = 0; |
---|
| 86 | |
---|
[77] | 87 | for (uint32_t i=0; i<nb_execute_unit; i++) |
---|
[78] | 88 | { |
---|
| 89 | if (table_execute_type[i][TYPE_MEMORY] == true) |
---|
| 90 | _nb_load_store_unit ++; |
---|
| 91 | } |
---|
[77] | 92 | // a execution_unit can't be a load_store unit and a functionnal unit |
---|
| 93 | _nb_functionnal_unit = nb_execute_unit-_nb_load_store_unit; |
---|
| 94 | |
---|
| 95 | test(); |
---|
| 96 | |
---|
[88] | 97 | if (is_toplevel) |
---|
| 98 | { |
---|
| 99 | _size_context_id = log2(nb_context ); |
---|
| 100 | _size_front_end_id = log2(nb_front_end ); |
---|
| 101 | _size_ooo_engine_id = log2(nb_ooo_engine ); |
---|
| 102 | _size_rob_ptr = log2(nb_packet ); |
---|
| 103 | _size_general_register = log2(nb_general_register); |
---|
| 104 | _size_special_register = log2(nb_special_register); |
---|
| 105 | _size_general_data = size_general_data ; |
---|
| 106 | _size_special_data = size_special_data ; |
---|
| 107 | _size_store_queue_ptr = log2(size_store_queue ); |
---|
| 108 | _size_load_queue_ptr = log2(size_load_queue ); |
---|
| 109 | |
---|
| 110 | _have_port_context_id = _size_context_id > 0; |
---|
| 111 | _have_port_front_end_id = _size_front_end_id > 0; |
---|
| 112 | _have_port_ooo_engine_id = _size_ooo_engine_id > 0; |
---|
| 113 | _have_port_rob_ptr = _size_rob_ptr > 0; |
---|
| 114 | _have_port_load_queue_ptr= _size_load_queue_ptr> 0; |
---|
| 115 | |
---|
| 116 | copy(); |
---|
| 117 | } |
---|
| 118 | |
---|
[77] | 119 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
| 120 | }; |
---|
| 121 | |
---|
[88] | 122 | // #undef FUNCTION |
---|
| 123 | // #define FUNCTION "Read_unit_to_Execution_unit::Parameters (copy)" |
---|
| 124 | // Parameters::Parameters (Parameters & param) |
---|
| 125 | // { |
---|
| 126 | // log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
[77] | 127 | |
---|
[88] | 128 | // test(); |
---|
| 129 | // log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
| 130 | // }; |
---|
[77] | 131 | |
---|
[88] | 132 | #undef FUNCTION |
---|
| 133 | #define FUNCTION "Read_unit_to_Execution_unit::~Parameters" |
---|
| 134 | Parameters::~Parameters () |
---|
[77] | 135 | { |
---|
| 136 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
| 137 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
| 138 | }; |
---|
| 139 | |
---|
| 140 | #undef FUNCTION |
---|
[88] | 141 | #define FUNCTION "Read_unit_to_Execution_unit::copy" |
---|
| 142 | void Parameters::copy (void) |
---|
[77] | 143 | { |
---|
| 144 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
| 145 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
| 146 | }; |
---|
| 147 | |
---|
| 148 | }; // end namespace read_unit_to_execution_unit |
---|
| 149 | }; // end namespace network |
---|
| 150 | }; // end namespace execute_loop |
---|
| 151 | }; // end namespace multi_execute_loop |
---|
| 152 | }; // end namespace core |
---|
| 153 | |
---|
| 154 | }; // end namespace behavioural |
---|
| 155 | }; // end namespace morpheo |
---|