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