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