[77] | 1 | /* |
---|
| 2 | * $Id: Parameters_msg_error.cpp 88 2008-12-10 18:31:39Z 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_valid [_nb_type]; |
---|
| 45 | bool type_uniq [_nb_type]; // one thread can have multiple destination for this type ? |
---|
| 46 | bool type_optionnal [_nb_type]; // this type is optionnal ? |
---|
| 47 | bool type_exclusive [_nb_type]; // a unit that implement this type must be implement an another type ? |
---|
| 48 | |
---|
| 49 | for (Ttype_t i=0; i<_nb_type; i++) |
---|
| 50 | { |
---|
| 51 | type_valid [i] = false; |
---|
| 52 | type_uniq [i] = false; |
---|
| 53 | type_optionnal [i] = false; |
---|
| 54 | type_exclusive [i] = false; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | type_valid [TYPE_ALU ] = true; |
---|
| 58 | type_valid [TYPE_SHIFT ] = true; |
---|
| 59 | type_valid [TYPE_MOVE ] = true; |
---|
| 60 | type_valid [TYPE_TEST ] = true; |
---|
[88] | 61 | type_valid [TYPE_MUL ] = true; |
---|
| 62 | type_valid [TYPE_DIV ] = true; |
---|
[77] | 63 | type_valid [TYPE_EXTEND ] = true; |
---|
| 64 | type_valid [TYPE_FIND ] = true; |
---|
| 65 | type_valid [TYPE_SPECIAL] = true; |
---|
| 66 | type_valid [TYPE_CUSTOM ] = true; |
---|
| 67 | type_valid [TYPE_BRANCH ] = true; |
---|
| 68 | type_valid [TYPE_MEMORY ] = true; |
---|
| 69 | |
---|
| 70 | type_uniq [TYPE_SPECIAL] = true; |
---|
| 71 | type_uniq [TYPE_CUSTOM ] = true; |
---|
| 72 | type_uniq [TYPE_MEMORY ] = true; |
---|
| 73 | |
---|
[88] | 74 | type_optionnal [TYPE_DIV ] = true; |
---|
[77] | 75 | type_optionnal [TYPE_EXTEND ] = true; |
---|
| 76 | type_optionnal [TYPE_FIND ] = true; |
---|
| 77 | type_optionnal [TYPE_CUSTOM ] = true; |
---|
| 78 | |
---|
| 79 | type_exclusive [TYPE_MEMORY ] = true; |
---|
| 80 | |
---|
| 81 | bool type_present [_nb_thread][_nb_type]; |
---|
| 82 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 83 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
| 84 | type_present [i][j] = false; |
---|
| 85 | |
---|
| 86 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 87 | for (uint32_t j=0; j<_nb_thread; j++) |
---|
| 88 | if (_table_execute_thread [i][j] == true) |
---|
| 89 | // this execute_unit execute this thread ! |
---|
[88] | 90 | for (Ttype_t k=0; k<_nb_type; k++) |
---|
| 91 | if (_table_execute_type[i][k] == true) |
---|
| 92 | { |
---|
| 93 | // 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])); |
---|
| 94 | |
---|
| 95 | // Test uniq type |
---|
| 96 | if (type_present [j][k] and type_uniq[k]) |
---|
| 97 | 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_type(k).c_str(),j)); |
---|
| 98 | |
---|
| 99 | type_present [j][k] = true; |
---|
| 100 | } |
---|
[77] | 101 | |
---|
| 102 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[88] | 103 | if (not type_valid [j]) |
---|
| 104 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 105 | if (type_present [i][j]) |
---|
| 106 | test.error(toString(_("The thread '%d' can execute the type's operation '%s' but this type is invalid.\n"),i,toString_type(j).c_str())); |
---|
| 107 | |
---|
| 108 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[77] | 109 | if (type_valid [j] and not type_optionnal[j]) |
---|
| 110 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 111 | if (not type_present [i][j]) |
---|
[88] | 112 | 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_type(j).c_str())); |
---|
[77] | 113 | |
---|
| 114 | // Test all excluve type |
---|
| 115 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
[88] | 116 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
[77] | 117 | if (type_exclusive [j] and _table_execute_type[i][j]) |
---|
[88] | 118 | for (Ttype_t k=0; k<_nb_type; k++) |
---|
[77] | 119 | if ((j != k) and (_table_execute_type[i][k] == true)) |
---|
| 120 | { |
---|
[88] | 121 | test.error(toString(_("The execute_unit [%d] implement the type '%s', and this type is exclusive with all others type.\n"),i,toString_type(j).c_str())); |
---|
[77] | 122 | break; |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 126 | { |
---|
| 127 | uint32_t j; |
---|
| 128 | for (j=0; j<_nb_thread; j++) |
---|
| 129 | if (_table_execute_thread [i][j] == true) |
---|
| 130 | break; |
---|
| 131 | |
---|
| 132 | if (j == _nb_thread) |
---|
[88] | 133 | test.error(toString(_("The execute_unit [%d] have none source's thread.\n"),i)); |
---|
[77] | 134 | } |
---|
| 135 | |
---|
[78] | 136 | if ( (_priority != PRIORITY_STATIC ) and |
---|
| 137 | (_priority != PRIORITY_ROUND_ROBIN)) |
---|
[88] | 138 | test.error(_("Unsupported priority scheme. It must be Static or Round Robin.\n")); |
---|
[78] | 139 | |
---|
[77] | 140 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
[78] | 141 | |
---|
| 142 | return test; |
---|
[77] | 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 |
---|