source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/src/Parameters_msg_error.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 16.2 KB
Line 
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/include/Parameters.h"
10#include "Common/include/Max.h"
11#include <sstream>
12
13namespace morpheo                    {
14namespace behavioural {
15namespace core {
16
17
18#undef  FUNCTION
19#define FUNCTION "Core::msg_error"
20  Parameters_test Parameters::msg_error(void)
21  {
22    log_begin(Core,FUNCTION);
23
24    Parameters_test test ("Core");
25
26    // TESTER SI LES VALEURS NE DEPASSE PAS DE L'INTERVALLE AUTORISE
27
28    {
29      // initialisation
30      uint32_t nb_link_context [_nb_front_end][max<uint32_t>(_nb_context,_nb_front_end)];
31     
32      for (uint32_t i=0; i<_nb_front_end; ++i)
33        for (uint32_t j=0; j<_nb_context[i];++j)
34          nb_link_context [i][j] = 0;
35     
36      // set link
37      for (uint32_t i=0; i<_nb_thread; ++i)
38        nb_link_context[_link_context_with_thread[i].first][_link_context_with_thread[i].second] ++;
39
40      // test
41      for (uint32_t i=0; i<_nb_front_end; ++i)
42        for (uint32_t j=0; j<_nb_context[i];++j)
43          {
44            if (nb_link_context[i][j] == 0)
45              test.error(toString(_("Context [%d][%d] is not link with a thread.\n"),i,j));
46            if (nb_link_context[i][j]  > 1)
47              test.error(toString(_("Context [%d][%d] is linked with 2 or more threads.\n"),i,j));
48          }
49    }
50
51    {
52      // initialisation
53      uint32_t nb_link_decod_unit [_nb_front_end][max<uint32_t>(_nb_decod_unit,_nb_front_end)];
54     
55      for (uint32_t i=0; i<_nb_front_end; ++i)
56        for (uint32_t j=0; j<_nb_decod_unit[i];++j)
57          nb_link_decod_unit [i][j] = 0;
58     
59      // set link
60      for (uint32_t i=0; i<_nb_decod_bloc; ++i)
61        nb_link_decod_unit[_link_decod_unit_with_decod_bloc[i].first][_link_decod_unit_with_decod_bloc[i].second] ++;
62
63      // test
64      for (uint32_t i=0; i<_nb_front_end; ++i)
65        for (uint32_t j=0; j<_nb_decod_unit[i];++j)
66          {
67            if (nb_link_decod_unit[i][j] == 0)
68              test.error(toString(_("Decod_Unit [%d][%d] is not link with a decod_bloc.\n"),i,j));
69            if (nb_link_decod_unit[i][j]  > 1)
70              test.error(toString(_("Decod_Unit [%d][%d] is linked with 2 or more decod_bloc.\n"),i,j));
71          }
72    }
73
74    {
75      // initialisation
76      uint32_t nb_link_rename_unit [_nb_ooo_engine][max<uint32_t>(_nb_rename_unit,_nb_ooo_engine)];
77     
78      for (uint32_t i=0; i<_nb_ooo_engine; ++i)
79        for (uint32_t j=0; j<_nb_rename_unit[i];++j)
80          nb_link_rename_unit [i][j] = 0;
81     
82      // set link
83      for (uint32_t i=0; i<_nb_rename_bloc; ++i)
84        nb_link_rename_unit[_link_rename_unit_with_rename_bloc[i].first][_link_rename_unit_with_rename_bloc[i].second] ++;
85
86      // test
87      for (uint32_t i=0; i<_nb_ooo_engine; ++i)
88        for (uint32_t j=0; j<_nb_rename_unit[i];++j)
89          {
90            if (nb_link_rename_unit[i][j] == 0)
91              test.error(toString(_("Rename_Unit [%d][%d] is not link with a rename_bloc.\n"),i,j));
92            if (nb_link_rename_unit[i][j]  > 1)
93              test.error(toString(_("Rename_Unit [%d][%d] is linked with 2 or more rename_bloc.\n"),i,j));
94          }
95    }
96
97    {
98      // initialisation
99      uint32_t nb_link_read_unit [_nb_execute_loop][max<uint32_t>(_nb_read_unit,_nb_execute_loop)];
100     
101      for (uint32_t i=0; i<_nb_execute_loop; ++i)
102        for (uint32_t j=0; j<_nb_read_unit[i];++j)
103          nb_link_read_unit [i][j] = 0;
104     
105      // set link
106      for (uint32_t i=0; i<_nb_read_bloc; ++i)
107        nb_link_read_unit[_link_read_unit_with_read_bloc[i].first][_link_read_unit_with_read_bloc[i].second] ++;
108
109      // test
110      for (uint32_t i=0; i<_nb_execute_loop; ++i)
111        for (uint32_t j=0; j<_nb_read_unit[i];++j)
112          {
113            if (nb_link_read_unit[i][j] == 0)
114              test.error(toString(_("Read_Unit [%d][%d] is not link with a read_bloc.\n"),i,j));
115            if (nb_link_read_unit[i][j]  > 1)
116              test.error(toString(_("Read_Unit [%d][%d] is linked with 2 or more read_bloc.\n"),i,j));
117          }
118    }
119
120    {
121      // initialisation
122      uint32_t nb_link_write_unit [_nb_execute_loop][max<uint32_t>(_nb_write_unit,_nb_execute_loop)];
123     
124      for (uint32_t i=0; i<_nb_execute_loop; ++i)
125        for (uint32_t j=0; j<_nb_write_unit[i];++j)
126          nb_link_write_unit [i][j] = 0;
127     
128      // set link
129      for (uint32_t i=0; i<_nb_write_bloc; ++i)
130        nb_link_write_unit[_link_write_unit_with_write_bloc[i].first][_link_write_unit_with_write_bloc[i].second] ++;
131
132      // test
133      for (uint32_t i=0; i<_nb_execute_loop; ++i)
134        for (uint32_t j=0; j<_nb_write_unit[i];++j)
135          {
136            if (nb_link_write_unit[i][j] == 0)
137              test.error(toString(_("Write_Unit [%d][%d] is not link with a write_bloc.\n"),i,j));
138            if (nb_link_write_unit[i][j]  > 1)
139              test.error(toString(_("Write_Unit [%d][%d] is linked with 2 or more write_bloc.\n"),i,j));
140          }
141    }
142
143    {
144      // initialisation
145      uint32_t nb_link_execute_unit [_nb_execute_loop][max<uint32_t>(_nb_execute_unit,_nb_execute_loop)];
146      uint32_t nb_functionnal_unit  [_nb_execute_loop];
147      uint32_t nb_load_store_unit   [_nb_execute_loop];
148
149      for (uint32_t i=0; i<_nb_execute_loop; ++i)
150        {
151          nb_functionnal_unit [i] = 0;
152          nb_load_store_unit  [i] = 0;
153         
154          for (uint32_t j=0; j<_nb_execute_unit[i];++j)
155            nb_link_execute_unit [i][j] = 0;
156        }
157
158      // set link
159      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
160        {
161          uint32_t num_execute_loop = _link_execute_unit_with_functionnal_unit [i].first;
162          uint32_t num_execute_unit = _link_execute_unit_with_functionnal_unit [i].second;
163
164          nb_link_execute_unit [num_execute_loop][num_execute_unit] ++;
165          nb_functionnal_unit  [i] ++;
166        }
167      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
168        {
169          uint32_t num_execute_loop = _link_execute_unit_with_load_store_unit [i].first;
170          uint32_t num_execute_unit = _link_execute_unit_with_load_store_unit [i].second;
171
172          nb_link_execute_unit [num_execute_loop][num_execute_unit] ++;
173          nb_load_store_unit   [i] ++;
174        }
175
176      // test
177      for (uint32_t i=0; i<_nb_execute_loop; ++i)
178        for (uint32_t j=0; j<_nb_execute_unit[i];++j)
179          {
180            if (nb_link_execute_unit[i][j] == 0)
181              test.error(toString(_("Execute_Unit [%d][%d] is not link with a load_store_unit or functionnal_unit.\n"),i,j));
182            if (nb_link_execute_unit[i][j]  > 1)
183              test.error(toString(_("Execute_Unit [%d][%d] is linked with 2 or more time.\n"),i,j));
184          }
185
186      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
187        {
188          if (nb_functionnal_unit[i] == 0)
189            test.error(toString(_("Functionnal_Unit [%d] is not instanced.\n"),i));
190          if (nb_functionnal_unit[i]  > 1)
191            test.error(toString(_("Functionnal_Unit [%d] is linked with 2 or more time.\n"),i));
192        }
193
194      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
195        {
196          if (nb_load_store_unit[i] == 0)
197            test.error(toString(_("Load_Store_Unit [%d] is not instanced.\n"),i));
198          if (nb_load_store_unit[i]  > 1)
199            test.error(toString(_("Load_Store_Unit [%d] is linked with 2 or more time.\n"),i));
200        }
201    }
202   
203    {
204      // initialisation
205      uint32_t nb_link_slot      [_nb_ooo_engine][max<uint32_t>(_nb_inst_issue,_nb_ooo_engine)];
206      uint32_t nb_link_read_bloc [_nb_read_bloc];
207 
208      // initialisation
209      for (uint32_t i=0; i<_nb_ooo_engine; ++i)
210        for (uint32_t j=0; j<_nb_inst_issue[i]; ++j)
211          nb_link_slot [i][j] = 0;
212      for (uint32_t i=0; i<_nb_read_bloc; ++i)
213        nb_link_read_bloc [i] = 0;
214
215      // set link
216      for (uint32_t i=0; i<_nb_ooo_engine; ++i)
217        for (uint32_t j=0; j<_nb_inst_issue[i]; ++j)
218          for (uint32_t k=0; k<_nb_read_bloc; ++k)
219            if (_table_dispatch [i][j][k])
220              {
221                nb_link_slot      [i][j] ++;
222                nb_link_read_bloc [k] ++;
223              }
224     
225      // test
226      for (uint32_t i=0; i<_nb_ooo_engine; ++i)
227        for (uint32_t j=0; j<_nb_inst_issue[i]; ++j)
228          if (nb_link_slot [i][j] == 0)
229            test.error(toString(_("In Out Of Order Engine [%d], the slot issue [%d] is not link with a read_bloc.\n"),i,j));
230      for (uint32_t i=0; i<_nb_read_bloc; ++i)
231        if (nb_link_read_bloc [i] == 0)
232          test.error(toString(_("Read_bloc [%d] is not link with a issue's slot.\n"),i));
233    }
234
235    {
236      uint32_t nb_link_read_bloc        [_nb_read_bloc];
237      uint32_t nb_link_load_store_unit  [_nb_load_store_unit];
238      uint32_t nb_link_functionnal_unit [_nb_functionnal_unit];
239
240      for (uint32_t i=0; i<_nb_read_bloc; ++i)
241        nb_link_read_bloc [i] = 0;
242      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
243        nb_link_load_store_unit [i] = 0;
244      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
245        nb_link_functionnal_unit [i] = 0;
246
247      for (uint32_t i=0; i<_nb_read_bloc; ++i)
248        {
249          for (uint32_t j=0; j<_nb_load_store_unit; ++j)
250            if (_link_read_bloc_and_load_store_unit [i][j])
251              {
252                nb_link_read_bloc        [i] ++;
253                nb_link_load_store_unit  [j] ++;
254              }
255          for (uint32_t j=0; j<_nb_functionnal_unit; ++j)
256            if (_link_read_bloc_and_functionnal_unit [i][j])
257              {
258                nb_link_read_bloc        [i] ++;
259                nb_link_functionnal_unit [j] ++;
260              }
261        }
262
263      for (uint32_t i=0; i<_nb_read_bloc; ++i)
264        if (nb_link_read_bloc [i] == 0)
265          test.error(toString(_("Read_bloc [%d] is not link with an execute_unit.\n"),i));
266      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
267        if (nb_link_load_store_unit [i] == 0)
268          test.error(toString(_("load_store_unit [%d] is not link with a read_bloc.\n"),i));
269      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
270        if (nb_link_functionnal_unit [i] == 0)
271          test.error(toString(_("functionnal_unit [%d] is not link with a read_bloc.\n"),i));
272    }
273
274    {
275      uint32_t nb_link_write_bloc       [_nb_write_bloc];
276      uint32_t nb_link_load_store_unit  [_nb_load_store_unit];
277      uint32_t nb_link_functionnal_unit [_nb_functionnal_unit];
278
279      for (uint32_t i=0; i<_nb_write_bloc; ++i)
280        nb_link_write_bloc [i] = 0;
281      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
282        nb_link_load_store_unit [i] = 0;
283      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
284        nb_link_functionnal_unit [i] = 0;
285
286      for (uint32_t i=0; i<_nb_write_bloc; ++i)
287        {
288          for (uint32_t j=0; j<_nb_load_store_unit; ++j)
289            if (_link_write_bloc_and_load_store_unit [i][j])
290              {
291                nb_link_write_bloc       [i] ++;
292                nb_link_load_store_unit  [j] ++;
293              }
294          for (uint32_t j=0; j<_nb_functionnal_unit; ++j)
295            if (_link_write_bloc_and_functionnal_unit [i][j])
296              {
297                nb_link_write_bloc       [i] ++;
298                nb_link_functionnal_unit [j] ++;
299              }
300        }
301
302      for (uint32_t i=0; i<_nb_write_bloc; ++i)
303        if (nb_link_write_bloc [i] == 0)
304          test.error(toString(_("Write_bloc [%d] is not link with an execute_unit.\n"),i));
305      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
306        if (nb_link_load_store_unit [i] == 0)
307          test.error(toString(_("load_store_unit [%d] is not link with a write_bloc.\n"),i));
308      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
309        if (nb_link_functionnal_unit [i] == 0)
310          test.error(toString(_("functionnal_unit [%d] is not link with a write_bloc.\n"),i));
311    }
312
313    {
314      uint32_t nb_link_thread           [_nb_thread];
315      uint32_t nb_link_load_store_unit  [_nb_load_store_unit];
316      uint32_t nb_link_functionnal_unit [_nb_functionnal_unit];
317
318      for (uint32_t i=0; i<_nb_thread; ++i)
319        nb_link_thread [i] = 0;
320      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
321        nb_link_load_store_unit [i] = 0;
322      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
323        nb_link_functionnal_unit [i] = 0;
324     
325      for (uint32_t i=0; i<_nb_thread; ++i)
326        {
327          {
328            uint32_t num_load_store_unit = _link_load_store_unit_with_thread [i];
329           
330            nb_link_thread           [i] ++;
331            nb_link_load_store_unit  [num_load_store_unit] ++;
332          }
333
334          for (uint32_t j=0; j<_nb_functionnal_unit; ++j)
335            if (_link_thread_and_functionnal_unit [i][j])
336              {
337                nb_link_thread           [i] ++;
338                nb_link_functionnal_unit [j] ++;
339              }
340        }
341
342      for (uint32_t i=0; i<_nb_thread; ++i)
343        if (nb_link_thread [i] < 2)
344          test.error(toString(_("Thread [%d] is not link with a load_store_unit and a functionnal_unit.\n"),i));
345      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
346        if (nb_link_load_store_unit [i] == 0)
347          test.error(toString(_("Load_store_unit [%d] is not link with a thread.\n"),i));
348      for (uint32_t i=0; i<_nb_functionnal_unit; ++i)
349        if (nb_link_functionnal_unit [i] == 0)
350          test.error(toString(_("Functionnal_unit [%d] is not link with a thread.\n"),i));
351    }
352   
353    {
354      uint32_t nb_link_icache_port [_nb_icache_port];
355
356      for (uint32_t i=0; i<_nb_icache_port; ++i)
357        nb_link_icache_port [i] = 0;
358
359      for (uint32_t i=0; i<_nb_thread; ++i)
360        nb_link_icache_port [_link_icache_port_with_thread [i]] ++;
361     
362      for (uint32_t i=0; i<_nb_icache_port; ++i)
363        if (nb_link_icache_port [i] == 0)
364          test.error(toString(_("Icache port [%d] is not link with a thread.\n"),i));
365    }
366
367    {
368      uint32_t nb_link_dcache_port [_nb_dcache_port];
369
370      for (uint32_t i=0; i<_nb_dcache_port; ++i)
371        nb_link_dcache_port [i] = 0;
372         
373      for (uint32_t i=0; i<_nb_load_store_unit; ++i)
374        for (uint32_t j=0; j<_nb_cache_port[i]; ++j)
375        nb_link_dcache_port [_link_dcache_port_with_load_store_unit[i][j]] ++;
376     
377      for (uint32_t i=0; i<_nb_dcache_port; ++i)
378        if (nb_link_dcache_port [i] == 0)
379          test.error(toString(_("Dcache port [%d] is not link with a port of load store unit.\n"),i));
380    }
381
382
383//   public : pair_dual             * _link_context_with_thread                      ;//[nb_thread]
384//   public : pair_dual             * _link_decod_unit_with_decod_bloc               ;//[nb_decod_bloc]
385//   public : pair_dual             * _link_rename_unit_with_rename_bloc             ;//[nb_rename_bloc]
386//   public : pair_dual             * _link_read_unit_with_read_bloc                 ;//[nb_read_bloc]
387//   public : pair_dual             * _link_write_unit_with_write_bloc               ;//[nb_write_bloc]
388//   public : pair_dual             * _link_execute_unit_with_functionnal_unit       ;//[nb_functionnal_unit]
389//   public : pair_dual             * _link_execute_unit_with_load_store_unit        ;//[nb_load_store_unit]
390//   public : uint32_t              * _link_decod_bloc_with_thread                   ;//[nb_thread]
391//   public : uint32_t              * _link_rename_bloc_with_front_end               ;//[nb_front_end]
392//   public : bool                *** _table_dispatch                                ;//[nb_ooo_engine][nb_inst_issue][nb_read_bloc]
393//   public : bool                 ** _link_read_bloc_and_load_store_unit            ;//[nb_read_bloc][nb_load_store_unit]
394//   public : bool                 ** _link_read_bloc_and_functionnal_unit           ;//[nb_read_bloc][nb_functionnal_unit]
395//   public : bool                 ** _link_write_bloc_and_load_store_unit           ;//[nb_write_bloc][nb_load_store_unit]
396//   public : bool                 ** _link_write_bloc_and_functionnal_unit          ;//[nb_write_bloc][nb_functionnal_unit]
397//   public : uint32_t              * _link_load_store_unit_with_thread              ;//[nb_thread]
398//   public : bool                 ** _link_thread_and_functionnal_unit              ;//[nb_thread][nb_functionnal_unit]
399//   public : uint32_t              * _link_icache_port_with_thread                  ;//[nb_thread]
400//   public : uint32_t             ** _link_dcache_port_with_load_store_unit         ;//[nb_load_store_unit][nb_cache_port]
401
402    log_end(Core,FUNCTION);
403
404    return test;
405  };
406
407}; // end namespace core
408}; // end namespace behavioural
409}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.