1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | * Test |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/@DIRECTORY/SelfTest/include/test.h" |
---|
10 | #include "Behavioural/include/Allocation.h" |
---|
11 | |
---|
12 | void test (string name, |
---|
13 | morpheo::behavioural::@NAMESPACE_USE::Parameters * _param) |
---|
14 | { |
---|
15 | msg(_("<%s> : Simulation SystemC.\n"),name.c_str()); |
---|
16 | |
---|
17 | if (setlocale (LC_ALL, "") == NULL) |
---|
18 | msg(_("setlocale ko.\n")); |
---|
19 | |
---|
20 | #ifdef STATISTICS |
---|
21 | morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,CYCLE_MAX); |
---|
22 | #endif |
---|
23 | |
---|
24 | Tusage_t _usage = USE_ALL; |
---|
25 | |
---|
26 | // _usage = usage_unset(_usage,USE_SYSTEMC ); |
---|
27 | // _usage = usage_unset(_usage,USE_VHDL ); |
---|
28 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH ); |
---|
29 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
30 | // _usage = usage_unset(_usage,USE_POSITION ); |
---|
31 | // _usage = usage_unset(_usage,USE_STATISTICS ); |
---|
32 | // _usage = usage_unset(_usage,USE_INFORMATION ); |
---|
33 | |
---|
34 | @COMPONENT * _@COMPONENT = new @COMPONENT |
---|
35 | (name.c_str(), |
---|
36 | #ifdef STATISTICS |
---|
37 | _parameters_statistics, |
---|
38 | #endif |
---|
39 | _param, |
---|
40 | _usage); |
---|
41 | |
---|
42 | #ifdef SYSTEMC |
---|
43 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
44 | { |
---|
45 | /********************************************************************* |
---|
46 | * Déclarations des signaux |
---|
47 | *********************************************************************/ |
---|
48 | string rename; |
---|
49 | |
---|
50 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
51 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
52 | |
---|
53 | /******************************************************** |
---|
54 | * Instanciation |
---|
55 | ********************************************************/ |
---|
56 | |
---|
57 | msg(_("<%s> : Instanciation of _@COMPONENT.\n"),name.c_str()); |
---|
58 | |
---|
59 | (*(_@COMPONENT->in_CLOCK)) (*(in_CLOCK)); |
---|
60 | (*(_@COMPONENT->in_NRESET)) (*(in_NRESET)); |
---|
61 | |
---|
62 | |
---|
63 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
64 | |
---|
65 | Time * _time = new Time(); |
---|
66 | |
---|
67 | /******************************************************** |
---|
68 | * Simulation - Begin |
---|
69 | ********************************************************/ |
---|
70 | |
---|
71 | // Initialisation |
---|
72 | |
---|
73 | const uint32_t seed = 0; |
---|
74 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
75 | |
---|
76 | srand(seed); |
---|
77 | |
---|
78 | SC_START(0); |
---|
79 | LABEL("Initialisation"); |
---|
80 | |
---|
81 | LABEL("Reset"); |
---|
82 | in_NRESET->write(0); |
---|
83 | SC_START(5); |
---|
84 | in_NRESET->write(1); |
---|
85 | |
---|
86 | LABEL("Loop of Test"); |
---|
87 | |
---|
88 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
89 | { |
---|
90 | LABEL("Iteration %d",iteration); |
---|
91 | |
---|
92 | SC_START(1); |
---|
93 | } |
---|
94 | |
---|
95 | /******************************************************** |
---|
96 | * Simulation - End |
---|
97 | ********************************************************/ |
---|
98 | |
---|
99 | TEST_OK ("End of Simulation"); |
---|
100 | delete _time; |
---|
101 | |
---|
102 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
103 | |
---|
104 | delete in_CLOCK; |
---|
105 | delete in_NRESET; |
---|
106 | } |
---|
107 | #endif |
---|
108 | |
---|
109 | delete _@COMPONENT; |
---|
110 | #ifdef STATISTICS |
---|
111 | delete _parameters_statistics; |
---|
112 | #endif |
---|
113 | } |
---|