[77] | 1 | /* |
---|
| 2 | * $Id: Parameters_msg_error.cpp 109 2009-02-16 20:28:31Z 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 | |
---|
| 44 | bool type_present [_nb_thread][_nb_type]; |
---|
| 45 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 46 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
| 47 | type_present [i][j] = false; |
---|
| 48 | |
---|
| 49 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 50 | for (uint32_t j=0; j<_nb_thread; j++) |
---|
| 51 | if (_table_execute_thread [i][j] == true) |
---|
| 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++) |
---|
| 68 | if (type_present [i][j]) |
---|
[97] | 69 | 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] | 70 | |
---|
| 71 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[109] | 72 | if (is_type_valid(j) and not is_type_optionnal(j)) |
---|
[77] | 73 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 74 | if (not type_present [i][j]) |
---|
[97] | 75 | 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] | 76 | |
---|
| 77 | // Test all excluve type |
---|
| 78 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
[88] | 79 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[109] | 80 | if (is_type_exclusive(j) and _table_execute_type[i][j]) |
---|
[88] | 81 | for (Ttype_t k=0; k<_nb_type; k++) |
---|
[77] | 82 | if ((j != k) and (_table_execute_type[i][k] == true)) |
---|
| 83 | { |
---|
[97] | 84 | 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] | 85 | break; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 89 | { |
---|
| 90 | uint32_t j; |
---|
| 91 | for (j=0; j<_nb_thread; j++) |
---|
| 92 | if (_table_execute_thread [i][j] == true) |
---|
| 93 | break; |
---|
| 94 | |
---|
| 95 | if (j == _nb_thread) |
---|
[88] | 96 | test.error(toString(_("The execute_unit [%d] have none source's thread.\n"),i)); |
---|
[77] | 97 | } |
---|
| 98 | |
---|
[78] | 99 | if ( (_priority != PRIORITY_STATIC ) and |
---|
| 100 | (_priority != PRIORITY_ROUND_ROBIN)) |
---|
[88] | 101 | test.error(_("Unsupported priority scheme. It must be Static or Round Robin.\n")); |
---|
[78] | 102 | |
---|
[77] | 103 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
[78] | 104 | |
---|
| 105 | return test; |
---|
[77] | 106 | }; |
---|
| 107 | |
---|
| 108 | }; // end namespace read_unit_to_execution_unit |
---|
| 109 | }; // end namespace network |
---|
| 110 | }; // end namespace execute_loop |
---|
| 111 | }; // end namespace multi_execute_loop |
---|
| 112 | }; // end namespace core |
---|
| 113 | |
---|
| 114 | }; // end namespace behavioural |
---|
| 115 | }; // end namespace morpheo |
---|