1 | /* |
---|
2 | * $Id: test.cpp 112 2009-03-18 22:36:26Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | * Test |
---|
7 | */ |
---|
8 | |
---|
9 | #define NB_ITERATION 1 |
---|
10 | #define CYCLE_MAX (128*NB_ITERATION) |
---|
11 | |
---|
12 | #include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_unit_Glue/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::ifetch_unit::ifetch_unit_glue::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 | 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 | Ifetch_unit_Glue * _Ifetch_unit_Glue = new Ifetch_unit_Glue |
---|
36 | (name.c_str(), |
---|
37 | #ifdef STATISTICS |
---|
38 | _parameters_statistics, |
---|
39 | #endif |
---|
40 | _param, |
---|
41 | _usage); |
---|
42 | |
---|
43 | #ifdef SYSTEMC |
---|
44 | /********************************************************************* |
---|
45 | * Déclarations des signaux |
---|
46 | *********************************************************************/ |
---|
47 | string rename; |
---|
48 | |
---|
49 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
50 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
51 | |
---|
52 | ALLOC0_SC_SIGNAL(out_ICACHE_REQ_VAL ,"out_ICACHE_REQ_VAL ",Tcontrol_t); |
---|
53 | ALLOC0_SC_SIGNAL( in_ICACHE_REQ_ADDRESS_VAL," in_ICACHE_REQ_ADDRESS_VAL",Tcontrol_t); |
---|
54 | ALLOC0_SC_SIGNAL(out_ICACHE_REQ_QUEUE_VAL ,"out_ICACHE_REQ_QUEUE_VAL ",Tcontrol_t); |
---|
55 | ALLOC0_SC_SIGNAL( in_ICACHE_REQ_ACK ," in_ICACHE_REQ_ACK ",Tcontrol_t); |
---|
56 | ALLOC0_SC_SIGNAL(out_ICACHE_REQ_ADDRESS_ACK,"out_ICACHE_REQ_ADDRESS_ACK",Tcontrol_t); |
---|
57 | ALLOC0_SC_SIGNAL( in_ICACHE_REQ_QUEUE_ACK ," in_ICACHE_REQ_QUEUE_ACK ",Tcontrol_t); |
---|
58 | ALLOC0_SC_SIGNAL(out_ICACHE_REQ_TYPE ,"out_ICACHE_REQ_TYPE ",Ticache_type_t); |
---|
59 | ALLOC0_SC_SIGNAL(out_ICACHE_REQ_ADDRESS ,"out_ICACHE_REQ_ADDRESS ",Taddress_t); |
---|
60 | ALLOC0_SC_SIGNAL( in_ICACHE_REQ_ADDRESS_ADDRESS," in_ICACHE_REQ_ADDRESS_ADDRESS",Taddress_t); |
---|
61 | ALLOC0_SC_SIGNAL(out_ICACHE_REQ_QUEUE_ADDRESS ,"out_ICACHE_REQ_QUEUE_ADDRESS ",Taddress_t); |
---|
62 | ALLOC0_SC_SIGNAL( in_EVENT_VAL ," in_EVENT_VAL ",Tcontrol_t); |
---|
63 | ALLOC0_SC_SIGNAL(out_EVENT_ADDRESS_VAL ,"out_EVENT_ADDRESS_VAL ",Tcontrol_t); |
---|
64 | ALLOC0_SC_SIGNAL(out_EVENT_QUEUE_VAL ,"out_EVENT_QUEUE_VAL ",Tcontrol_t); |
---|
65 | ALLOC0_SC_SIGNAL(out_EVENT_ACK ,"out_EVENT_ACK ",Tcontrol_t); |
---|
66 | ALLOC0_SC_SIGNAL( in_EVENT_ADDRESS_ACK ," in_EVENT_ADDRESS_ACK ",Tcontrol_t); |
---|
67 | ALLOC0_SC_SIGNAL( in_EVENT_QUEUE_ACK ," in_EVENT_QUEUE_ACK ",Tcontrol_t); |
---|
68 | |
---|
69 | /******************************************************** |
---|
70 | * Instanciation |
---|
71 | ********************************************************/ |
---|
72 | |
---|
73 | msg(_("<%s> : Instanciation of _Ifetch_unit_Glue.\n"),name.c_str()); |
---|
74 | |
---|
75 | (*(_Ifetch_unit_Glue->in_CLOCK)) (*(in_CLOCK)); |
---|
76 | (*(_Ifetch_unit_Glue->in_NRESET)) (*(in_NRESET)); |
---|
77 | |
---|
78 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_VAL ); |
---|
79 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_ADDRESS_VAL); |
---|
80 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_QUEUE_VAL ); |
---|
81 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_ACK ); |
---|
82 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_ADDRESS_ACK); |
---|
83 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_QUEUE_ACK ); |
---|
84 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_ADDRESS ); |
---|
85 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_ADDRESS_ADDRESS); |
---|
86 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_QUEUE_ADDRESS ); |
---|
87 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_TYPE ); |
---|
88 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_EVENT_VAL ); |
---|
89 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_EVENT_ADDRESS_VAL ); |
---|
90 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_EVENT_QUEUE_VAL ); |
---|
91 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue,out_EVENT_ACK ); |
---|
92 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_EVENT_ADDRESS_ACK ); |
---|
93 | INSTANCE0_SC_SIGNAL(_Ifetch_unit_Glue, in_EVENT_QUEUE_ACK ); |
---|
94 | |
---|
95 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
96 | |
---|
97 | Time * _time = new Time(); |
---|
98 | |
---|
99 | /******************************************************** |
---|
100 | * Simulation - Begin |
---|
101 | ********************************************************/ |
---|
102 | |
---|
103 | // Initialisation |
---|
104 | |
---|
105 | const uint32_t seed = 0; |
---|
106 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
107 | |
---|
108 | srand(seed); |
---|
109 | |
---|
110 | SC_START(0); |
---|
111 | LABEL("Initialisation"); |
---|
112 | |
---|
113 | LABEL("Reset"); |
---|
114 | in_NRESET->write(0); |
---|
115 | SC_START(5); |
---|
116 | in_NRESET->write(1); |
---|
117 | |
---|
118 | LABEL("Loop of Test"); |
---|
119 | |
---|
120 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
121 | { |
---|
122 | LABEL("Iteration %d",iteration); |
---|
123 | |
---|
124 | SC_START(1); |
---|
125 | } |
---|
126 | |
---|
127 | /******************************************************** |
---|
128 | * Simulation - End |
---|
129 | ********************************************************/ |
---|
130 | |
---|
131 | TEST_OK ("End of Simulation"); |
---|
132 | delete _time; |
---|
133 | |
---|
134 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
135 | |
---|
136 | delete in_CLOCK; |
---|
137 | delete in_NRESET; |
---|
138 | |
---|
139 | delete out_ICACHE_REQ_VAL ; |
---|
140 | delete in_ICACHE_REQ_ADDRESS_VAL; |
---|
141 | delete out_ICACHE_REQ_QUEUE_VAL ; |
---|
142 | delete in_ICACHE_REQ_ACK ; |
---|
143 | delete out_ICACHE_REQ_ADDRESS_ACK; |
---|
144 | delete in_ICACHE_REQ_QUEUE_ACK ; |
---|
145 | delete out_ICACHE_REQ_ADDRESS ; |
---|
146 | delete in_ICACHE_REQ_ADDRESS_ADDRESS; |
---|
147 | delete out_ICACHE_REQ_QUEUE_ADDRESS ; |
---|
148 | delete out_ICACHE_REQ_TYPE ; |
---|
149 | delete in_EVENT_VAL ; |
---|
150 | delete out_EVENT_ADDRESS_VAL ; |
---|
151 | delete out_EVENT_QUEUE_VAL ; |
---|
152 | delete out_EVENT_ACK ; |
---|
153 | delete in_EVENT_ADDRESS_ACK ; |
---|
154 | delete in_EVENT_QUEUE_ACK ; |
---|
155 | #endif |
---|
156 | |
---|
157 | delete _Ifetch_unit_Glue; |
---|
158 | #ifdef STATISTICS |
---|
159 | delete _parameters_statistics; |
---|
160 | #endif |
---|
161 | } |
---|