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