[2] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | * Test |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #define NB_ITERATION 1 |
---|
| 10 | |
---|
[15] | 11 | #define LABEL(str) do {cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} " << str << endl; _@COMPONENT->vhdl_testbench_label(str);} while (0) |
---|
| 12 | |
---|
[2] | 13 | #include "Behavioural/@DIRECTORY/SelfTest/include/test.h" |
---|
| 14 | #include "Include/Test.h" |
---|
| 15 | |
---|
| 16 | void test (string name, |
---|
[15] | 17 | morpheo::behavioural::@NAMESPACE_USE::Parameters _param) |
---|
[2] | 18 | { |
---|
| 19 | cout << "<" << name << "> : Simulation SystemC" << endl; |
---|
| 20 | |
---|
| 21 | @COMPONENT * _@COMPONENT = new @COMPONENT (name.c_str(), |
---|
| 22 | #ifdef STATISTICS |
---|
| 23 | morpheo::behavioural::Parameters_Statistics(5,50), |
---|
| 24 | #endif |
---|
[15] | 25 | _param); |
---|
[2] | 26 | |
---|
| 27 | #ifdef SYSTEMC |
---|
| 28 | /********************************************************************* |
---|
| 29 | * Déclarations des signaux |
---|
| 30 | *********************************************************************/ |
---|
| 31 | sc_clock * CLOCK; |
---|
[15] | 32 | sc_signal<Tcontrol_t> * NRESET; |
---|
[2] | 33 | |
---|
| 34 | string rename; |
---|
| 35 | |
---|
| 36 | CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
[15] | 37 | NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
[2] | 38 | |
---|
| 39 | /******************************************************** |
---|
| 40 | * Instanciation |
---|
| 41 | ********************************************************/ |
---|
| 42 | |
---|
| 43 | cout << "<" << name << "> Instanciation of _@COMPONENT" << endl; |
---|
| 44 | |
---|
| 45 | (*(_@COMPONENT->in_CLOCK)) (*(CLOCK)); |
---|
[15] | 46 | (*(_@COMPONENT->in_NRESET)) (*(NRESET)); |
---|
[2] | 47 | |
---|
[15] | 48 | |
---|
| 49 | cout << "<" << name << "> Start Simulation ............" << endl; |
---|
| 50 | |
---|
[2] | 51 | /******************************************************** |
---|
| 52 | * Simulation - Begin |
---|
| 53 | ********************************************************/ |
---|
| 54 | |
---|
| 55 | // Initialisation |
---|
| 56 | |
---|
| 57 | const uint32_t seed = 0; |
---|
| 58 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 59 | |
---|
| 60 | srand(seed); |
---|
| 61 | |
---|
| 62 | sc_start(0); |
---|
[15] | 63 | LABEL("Initialisation"); |
---|
[2] | 64 | |
---|
[15] | 65 | LABEL("Loop of Test"); |
---|
[2] | 66 | |
---|
| 67 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
| 68 | { |
---|
[15] | 69 | LABEL("Iteration "+toString(iteration)); |
---|
[2] | 70 | |
---|
| 71 | sc_start(1); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | /******************************************************** |
---|
| 75 | * Simulation - End |
---|
| 76 | ********************************************************/ |
---|
| 77 | |
---|
| 78 | cout << "<" << name << "> ............ Stop Simulation" << endl; |
---|
| 79 | |
---|
[15] | 80 | delete CLOCK; |
---|
| 81 | delete NRESET; |
---|
[2] | 82 | #endif |
---|
| 83 | |
---|
| 84 | delete _@COMPONENT; |
---|
| 85 | } |
---|