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