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" |
---|
23 | Parameters_test Parameters::msg_error(void) |
---|
24 | { |
---|
25 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
26 | |
---|
27 | Parameters_test test ("Read_unit_to_Execution_unit"); |
---|
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 | | | |
---|
35 | // TYPE_MUL | X | | | |
---|
36 | // TYPE_DIV | X | X | | |
---|
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++) |
---|
50 | if (_num_thread_valid [j] and |
---|
51 | (_table_execute_thread [i][j] == true)) |
---|
52 | // this execute_unit execute this thread ! |
---|
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 |
---|
59 | if (type_present [j][k] and is_type_uniq(k)) |
---|
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)); |
---|
61 | |
---|
62 | type_present [j][k] = true; |
---|
63 | } |
---|
64 | |
---|
65 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
66 | if (not is_type_valid(j)) |
---|
67 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
68 | if (_num_thread_valid [i] and |
---|
69 | (type_present [i][j])) |
---|
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())); |
---|
71 | |
---|
72 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
73 | if (is_type_valid(j) and not is_type_optionnal(j)) |
---|
74 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
75 | if (_num_thread_valid [i] and |
---|
76 | (not type_present [i][j])) |
---|
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())); |
---|
78 | |
---|
79 | // Test all excluve type |
---|
80 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
81 | for (Ttype_t j=0; j<_nb_type; j++) |
---|
82 | if (is_type_exclusive(j) and _table_execute_type[i][j]) |
---|
83 | for (Ttype_t k=0; k<_nb_type; k++) |
---|
84 | if ((j != k) and (_table_execute_type[i][k] == true)) |
---|
85 | { |
---|
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())); |
---|
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) |
---|
98 | test.error(toString(_("The execute_unit [%d] have none source's thread.\n"),i)); |
---|
99 | } |
---|
100 | |
---|
101 | if ( (_priority != PRIORITY_STATIC ) and |
---|
102 | (_priority != PRIORITY_ROUND_ROBIN)) |
---|
103 | test.error(_("Unsupported priority scheme. It must be Static or Round Robin.\n")); |
---|
104 | |
---|
105 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
106 | |
---|
107 | return test; |
---|
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 |
---|