1 | /* |
---|
2 | * $Id: test.cpp 82 2008-05-01 16:48:45Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | * Test |
---|
7 | */ |
---|
8 | |
---|
9 | #define NB_ITERATION 256 |
---|
10 | #define CYCLE_MAX (128*NB_ITERATION) |
---|
11 | |
---|
12 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_translation_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_ooo_engine::ooo_engine::rename_unit::register_translation_unit::register_translation_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 | Register_translation_unit_Glue * _Register_translation_unit_Glue = new Register_translation_unit_Glue |
---|
26 | (name.c_str(), |
---|
27 | #ifdef STATISTICS |
---|
28 | _parameters_statistics, |
---|
29 | #endif |
---|
30 | _param, |
---|
31 | USE_ALL); |
---|
32 | |
---|
33 | #ifdef SYSTEMC |
---|
34 | /********************************************************************* |
---|
35 | * Déclarations des signaux |
---|
36 | *********************************************************************/ |
---|
37 | string rename; |
---|
38 | |
---|
39 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
40 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
41 | |
---|
42 | ALLOC1_SC_SIGNAL( in_INSERT_RENAME_VAL ," in_INSERT_RENAME_VAL ",Tcontrol_t,_param->_nb_inst_insert); |
---|
43 | ALLOC1_SC_SIGNAL(out_INSERT_RENAME_ACK ,"out_INSERT_RENAME_ACK ",Tcontrol_t,_param->_nb_inst_insert); |
---|
44 | ALLOC1_SC_SIGNAL(out_INSERT_INSERT_VAL ,"out_INSERT_INSERT_VAL ",Tcontrol_t,_param->_nb_inst_insert); |
---|
45 | ALLOC1_SC_SIGNAL( in_INSERT_INSERT_ACK ," in_INSERT_INSERT_ACK ",Tcontrol_t,_param->_nb_inst_insert); |
---|
46 | ALLOC1_SC_SIGNAL(out_INSERT_RAT_INSERT_VAL,"out_INSERT_RAT_INSERT_VAL",Tcontrol_t,_param->_nb_inst_insert); |
---|
47 | ALLOC1_SC_SIGNAL( in_INSERT_RAT_RENAME_ACK," in_INSERT_RAT_RENAME_ACK",Tcontrol_t,_param->_nb_inst_insert); |
---|
48 | ALLOC1_SC_SIGNAL( in_INSERT_RAT_INSERT_ACK," in_INSERT_RAT_INSERT_ACK",Tcontrol_t,_param->_nb_inst_insert); |
---|
49 | ALLOC1_SC_SIGNAL(out_INSERT_FREE_LIST_VAL ,"out_INSERT_FREE_LIST_VAL ",Tcontrol_t,_param->_nb_inst_insert); |
---|
50 | ALLOC1_SC_SIGNAL( in_INSERT_FREE_LIST_ACK ," in_INSERT_FREE_LIST_ACK ",Tcontrol_t,_param->_nb_inst_insert); |
---|
51 | ALLOC1_SC_SIGNAL(out_INSERT_STAT_LIST_VAL ,"out_INSERT_STAT_LIST_VAL ",Tcontrol_t,_param->_nb_inst_insert); |
---|
52 | ALLOC1_SC_SIGNAL( in_INSERT_STAT_LIST_ACK ," in_INSERT_STAT_LIST_ACK ",Tcontrol_t,_param->_nb_inst_insert); |
---|
53 | ALLOC1_SC_SIGNAL( in_RETIRE_VAL ," in_RETIRE_VAL ",Tcontrol_t,_param->_nb_inst_retire); |
---|
54 | ALLOC1_SC_SIGNAL(out_RETIRE_ACK ,"out_RETIRE_ACK ",Tcontrol_t,_param->_nb_inst_retire); |
---|
55 | ALLOC1_SC_SIGNAL(out_RETIRE_RAT_VAL ,"out_RETIRE_RAT_VAL ",Tcontrol_t,_param->_nb_inst_retire); |
---|
56 | ALLOC1_SC_SIGNAL( in_RETIRE_RAT_ACK ," in_RETIRE_RAT_ACK ",Tcontrol_t,_param->_nb_inst_retire); |
---|
57 | ALLOC1_SC_SIGNAL(out_RETIRE_STAT_LIST_VAL ,"out_RETIRE_STAT_LIST_VAL ",Tcontrol_t,_param->_nb_inst_retire); |
---|
58 | ALLOC1_SC_SIGNAL( in_RETIRE_STAT_LIST_ACK ," in_RETIRE_STAT_LIST_ACK ",Tcontrol_t,_param->_nb_inst_retire); |
---|
59 | |
---|
60 | /******************************************************** |
---|
61 | * Instanciation |
---|
62 | ********************************************************/ |
---|
63 | |
---|
64 | msg(_("<%s> : Instanciation of _Register_translation_unit_Glue.\n"),name.c_str()); |
---|
65 | |
---|
66 | (*(_Register_translation_unit_Glue->in_CLOCK)) (*(in_CLOCK)); |
---|
67 | (*(_Register_translation_unit_Glue->in_NRESET)) (*(in_NRESET)); |
---|
68 | |
---|
69 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_INSERT_RENAME_VAL ,_param->_nb_inst_insert); |
---|
70 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_INSERT_RENAME_ACK ,_param->_nb_inst_insert); |
---|
71 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_INSERT_INSERT_VAL ,_param->_nb_inst_insert); |
---|
72 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_INSERT_INSERT_ACK ,_param->_nb_inst_insert); |
---|
73 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_INSERT_RAT_INSERT_VAL,_param->_nb_inst_insert); |
---|
74 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_INSERT_RAT_RENAME_ACK,_param->_nb_inst_insert); |
---|
75 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_INSERT_RAT_INSERT_ACK,_param->_nb_inst_insert); |
---|
76 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_INSERT_FREE_LIST_VAL ,_param->_nb_inst_insert); |
---|
77 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_INSERT_FREE_LIST_ACK ,_param->_nb_inst_insert); |
---|
78 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_INSERT_STAT_LIST_VAL ,_param->_nb_inst_insert); |
---|
79 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_INSERT_STAT_LIST_ACK ,_param->_nb_inst_insert); |
---|
80 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_RETIRE_VAL ,_param->_nb_inst_retire); |
---|
81 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_RETIRE_ACK ,_param->_nb_inst_retire); |
---|
82 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_RETIRE_RAT_VAL ,_param->_nb_inst_retire); |
---|
83 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_RETIRE_RAT_ACK ,_param->_nb_inst_retire); |
---|
84 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue,out_RETIRE_STAT_LIST_VAL ,_param->_nb_inst_retire); |
---|
85 | INSTANCE1_SC_SIGNAL(_Register_translation_unit_Glue, in_RETIRE_STAT_LIST_ACK ,_param->_nb_inst_retire); |
---|
86 | |
---|
87 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
88 | |
---|
89 | Time * _time = new Time(); |
---|
90 | |
---|
91 | /******************************************************** |
---|
92 | * Simulation - Begin |
---|
93 | ********************************************************/ |
---|
94 | |
---|
95 | // Initialisation |
---|
96 | |
---|
97 | const uint32_t seed = 0; |
---|
98 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
99 | |
---|
100 | srand(seed); |
---|
101 | |
---|
102 | SC_START(0); |
---|
103 | LABEL("Initialisation"); |
---|
104 | |
---|
105 | LABEL("Reset"); |
---|
106 | in_NRESET->write(0); |
---|
107 | SC_START(5); |
---|
108 | in_NRESET->write(1); |
---|
109 | |
---|
110 | LABEL("Loop of Test"); |
---|
111 | |
---|
112 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
113 | { |
---|
114 | LABEL("Iteration %d",iteration); |
---|
115 | |
---|
116 | for (uint32_t i=0; i<_param->_nb_inst_insert;i++) |
---|
117 | { |
---|
118 | in_INSERT_RENAME_VAL [i]->write(rand()%2); |
---|
119 | in_INSERT_INSERT_ACK [i]->write(rand()%2); |
---|
120 | in_INSERT_RAT_RENAME_ACK[i]->write(rand()%2); |
---|
121 | in_INSERT_RAT_INSERT_ACK[i]->write(rand()%2); |
---|
122 | in_INSERT_FREE_LIST_ACK [i]->write(rand()%2); |
---|
123 | in_INSERT_STAT_LIST_ACK [i]->write(rand()%2); |
---|
124 | } |
---|
125 | |
---|
126 | for (uint32_t i=0; i<_param->_nb_inst_retire;i++) |
---|
127 | { |
---|
128 | in_RETIRE_VAL [i]->write(rand()%2); |
---|
129 | in_RETIRE_RAT_ACK [i]->write(rand()%2); |
---|
130 | in_RETIRE_STAT_LIST_ACK [i]->write(rand()%2); |
---|
131 | } |
---|
132 | |
---|
133 | SC_START(0); |
---|
134 | |
---|
135 | for (uint32_t i=0; i<_param->_nb_inst_insert;i++) |
---|
136 | { |
---|
137 | TEST(Tcontrol_t,out_INSERT_RENAME_ACK [i]->read(),(in_INSERT_INSERT_ACK [i]->read() and |
---|
138 | in_INSERT_RAT_RENAME_ACK [i]->read() and |
---|
139 | in_INSERT_RAT_INSERT_ACK [i]->read() and |
---|
140 | in_INSERT_FREE_LIST_ACK [i]->read() and |
---|
141 | in_INSERT_STAT_LIST_ACK [i]->read() )); |
---|
142 | TEST(Tcontrol_t,out_INSERT_INSERT_VAL [i]->read(),(in_INSERT_RENAME_VAL [i]->read() and |
---|
143 | in_INSERT_RAT_RENAME_ACK [i]->read() and |
---|
144 | in_INSERT_RAT_INSERT_ACK [i]->read() and |
---|
145 | in_INSERT_FREE_LIST_ACK [i]->read() and |
---|
146 | in_INSERT_STAT_LIST_ACK [i]->read() )); |
---|
147 | TEST(Tcontrol_t,out_INSERT_RAT_INSERT_VAL [i]->read(),(in_INSERT_RENAME_VAL [i]->read() and |
---|
148 | in_INSERT_INSERT_ACK [i]->read() and |
---|
149 | in_INSERT_RAT_RENAME_ACK [i]->read() and |
---|
150 | in_INSERT_FREE_LIST_ACK [i]->read() and |
---|
151 | in_INSERT_STAT_LIST_ACK [i]->read() )); |
---|
152 | TEST(Tcontrol_t,out_INSERT_FREE_LIST_VAL [i]->read(),(in_INSERT_RENAME_VAL [i]->read() and |
---|
153 | in_INSERT_INSERT_ACK [i]->read() and |
---|
154 | in_INSERT_RAT_RENAME_ACK [i]->read() and |
---|
155 | in_INSERT_RAT_INSERT_ACK [i]->read() and |
---|
156 | in_INSERT_STAT_LIST_ACK [i]->read() )); |
---|
157 | TEST(Tcontrol_t,out_INSERT_STAT_LIST_VAL [i]->read(),(in_INSERT_RENAME_VAL [i]->read() and |
---|
158 | in_INSERT_INSERT_ACK [i]->read() and |
---|
159 | in_INSERT_RAT_RENAME_ACK [i]->read() and |
---|
160 | in_INSERT_RAT_INSERT_ACK [i]->read() and |
---|
161 | in_INSERT_FREE_LIST_ACK [i]->read() )); |
---|
162 | } |
---|
163 | |
---|
164 | for (uint32_t i=0; i<_param->_nb_inst_retire;i++) |
---|
165 | { |
---|
166 | TEST(Tcontrol_t,out_RETIRE_ACK [i]->read(),(in_RETIRE_RAT_ACK [i]->read() and |
---|
167 | in_RETIRE_STAT_LIST_ACK [i]->read())); |
---|
168 | TEST(Tcontrol_t,out_RETIRE_RAT_VAL [i]->read(),(in_RETIRE_VAL [i]->read() and |
---|
169 | in_RETIRE_STAT_LIST_ACK [i]->read())); |
---|
170 | TEST(Tcontrol_t,out_RETIRE_STAT_LIST_VAL [i]->read(),(in_RETIRE_VAL [i]->read() and |
---|
171 | in_RETIRE_RAT_ACK [i]->read())); |
---|
172 | } |
---|
173 | |
---|
174 | SC_START(1); |
---|
175 | } |
---|
176 | |
---|
177 | /******************************************************** |
---|
178 | * Simulation - End |
---|
179 | ********************************************************/ |
---|
180 | |
---|
181 | TEST_OK ("End of Simulation"); |
---|
182 | delete _time; |
---|
183 | |
---|
184 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
185 | |
---|
186 | delete in_CLOCK; |
---|
187 | delete in_NRESET; |
---|
188 | |
---|
189 | delete [] in_INSERT_RENAME_VAL ; |
---|
190 | delete [] out_INSERT_RENAME_ACK ; |
---|
191 | delete [] out_INSERT_INSERT_VAL ; |
---|
192 | delete [] in_INSERT_INSERT_ACK ; |
---|
193 | delete [] out_INSERT_RAT_INSERT_VAL; |
---|
194 | delete [] in_INSERT_RAT_RENAME_ACK; |
---|
195 | delete [] in_INSERT_RAT_INSERT_ACK; |
---|
196 | delete [] out_INSERT_FREE_LIST_VAL ; |
---|
197 | delete [] in_INSERT_FREE_LIST_ACK ; |
---|
198 | delete [] out_INSERT_STAT_LIST_VAL ; |
---|
199 | delete [] in_INSERT_STAT_LIST_ACK ; |
---|
200 | delete [] in_RETIRE_VAL ; |
---|
201 | delete [] out_RETIRE_ACK ; |
---|
202 | delete [] out_RETIRE_RAT_VAL ; |
---|
203 | delete [] in_RETIRE_RAT_ACK ; |
---|
204 | delete [] out_RETIRE_STAT_LIST_VAL ; |
---|
205 | delete [] in_RETIRE_STAT_LIST_ACK ; |
---|
206 | |
---|
207 | #endif |
---|
208 | |
---|
209 | delete _Register_translation_unit_Glue; |
---|
210 | #ifdef STATISTICS |
---|
211 | delete _parameters_statistics; |
---|
212 | #endif |
---|
213 | } |
---|