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