[77] | 1 | /* |
---|
| 2 | * $Id: Parameters_msg_error.cpp 122 2009-06-03 08:15:51Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/include/Types.h" |
---|
| 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Read_unit_to_Execution_unit/include/Parameters.h" |
---|
| 10 | #include <sstream> |
---|
| 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_execute_loop { |
---|
| 16 | namespace execute_loop { |
---|
| 17 | namespace network { |
---|
| 18 | namespace read_unit_to_execution_unit { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Read_unit_to_Execution_unit::msg_error" |
---|
[78] | 23 | Parameters_test Parameters::msg_error(void) |
---|
[77] | 24 | { |
---|
| 25 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
| 26 | |
---|
[78] | 27 | Parameters_test test ("Read_unit_to_Execution_unit"); |
---|
[77] | 28 | |
---|
| 29 | // TYPE | multiple? | Optionnal? | Exclusive? | Comment |
---|
| 30 | //--------------+-----------+------------+------------+--------- |
---|
| 31 | // TYPE_ALU | X | | | |
---|
| 32 | // TYPE_SHIFT | X | | | ror is optionnal |
---|
| 33 | // TYPE_MOVE | X | | | cmov is optionnal |
---|
| 34 | // TYPE_TEST | X | | | |
---|
[88] | 35 | // TYPE_MUL | X | | | |
---|
| 36 | // TYPE_DIV | X | X | | |
---|
[77] | 37 | // TYPE_EXTEND | X | X | | |
---|
| 38 | // TYPE_FIND | X | X | | |
---|
| 39 | // TYPE_SPECIAL | | | | mac unit is optionnal |
---|
| 40 | // TYPE_CUSTOM | | X | | |
---|
| 41 | // TYPE_BRANCH | X | | | |
---|
| 42 | // TYPE_MEMORY | | | X | |
---|
| 43 | bool type_present [_nb_thread][_nb_type]; |
---|
| 44 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 45 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
| 46 | type_present [i][j] = false; |
---|
| 47 | |
---|
| 48 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 49 | for (uint32_t j=0; j<_nb_thread; j++) |
---|
[120] | 50 | if (_num_thread_valid [j] and |
---|
| 51 | (_table_execute_thread [i][j] == true)) |
---|
[77] | 52 | // this execute_unit execute this thread ! |
---|
[88] | 53 | for (Ttype_t k=0; k<_nb_type; k++) |
---|
| 54 | if (_table_execute_type[i][k] == true) |
---|
| 55 | { |
---|
| 56 | // test.information(toString(_("Execute_unit [%d], Thread [%d], Type [%d], type_valid %d, type_present %d, type_uniq %d\n"),i,j,k,type_valid[k],type_present[j][k],type_uniq[k])); |
---|
| 57 | |
---|
| 58 | // Test uniq type |
---|
[109] | 59 | if (type_present [j][k] and is_type_uniq(k)) |
---|
[97] | 60 | test.error(toString(_("The execute_unit '%d' can execute operation of type '%s' at the thread '%d'. But an another execute_unit can be execute the same type for the same thread. And the type must be single !.\n"),i,toString(k).c_str(),j)); |
---|
[88] | 61 | |
---|
| 62 | type_present [j][k] = true; |
---|
| 63 | } |
---|
[77] | 64 | |
---|
| 65 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[109] | 66 | if (not is_type_valid(j)) |
---|
[88] | 67 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
[122] | 68 | if (_num_thread_valid [i] and |
---|
[120] | 69 | (type_present [i][j])) |
---|
[97] | 70 | test.error(toString(_("The thread '%d' can execute the type's operation '%s' but this type is invalid.\n"),i,toString(j).c_str())); |
---|
[88] | 71 | |
---|
| 72 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[109] | 73 | if (is_type_valid(j) and not is_type_optionnal(j)) |
---|
[77] | 74 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
[120] | 75 | if (_num_thread_valid [i] and |
---|
| 76 | (not type_present [i][j])) |
---|
[97] | 77 | test.error(toString(_("The thread '%d' can't access at the execute_unit to execute the type's operation '%s' (and this type is not optional !).\n"),i,toString(j).c_str())); |
---|
[77] | 78 | |
---|
| 79 | // Test all excluve type |
---|
| 80 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
[88] | 81 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[109] | 82 | if (is_type_exclusive(j) and _table_execute_type[i][j]) |
---|
[88] | 83 | for (Ttype_t k=0; k<_nb_type; k++) |
---|
[77] | 84 | if ((j != k) and (_table_execute_type[i][k] == true)) |
---|
| 85 | { |
---|
[97] | 86 | test.error(toString(_("The execute_unit [%d] implement the type '%s', and this type is exclusive with all others type.\n"),i,toString(j).c_str())); |
---|
[77] | 87 | break; |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 91 | { |
---|
| 92 | uint32_t j; |
---|
| 93 | for (j=0; j<_nb_thread; j++) |
---|
| 94 | if (_table_execute_thread [i][j] == true) |
---|
| 95 | break; |
---|
| 96 | |
---|
| 97 | if (j == _nb_thread) |
---|
[88] | 98 | test.error(toString(_("The execute_unit [%d] have none source's thread.\n"),i)); |
---|
[77] | 99 | } |
---|
| 100 | |
---|
[78] | 101 | if ( (_priority != PRIORITY_STATIC ) and |
---|
| 102 | (_priority != PRIORITY_ROUND_ROBIN)) |
---|
[88] | 103 | test.error(_("Unsupported priority scheme. It must be Static or Round Robin.\n")); |
---|
[78] | 104 | |
---|
[77] | 105 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
[78] | 106 | |
---|
| 107 | return test; |
---|
[77] | 108 | }; |
---|
| 109 | |
---|
| 110 | }; // end namespace read_unit_to_execution_unit |
---|
| 111 | }; // end namespace network |
---|
| 112 | }; // end namespace execute_loop |
---|
| 113 | }; // end namespace multi_execute_loop |
---|
| 114 | }; // end namespace core |
---|
| 115 | |
---|
| 116 | }; // end namespace behavioural |
---|
| 117 | }; // end namespace morpheo |
---|