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