1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | * Test |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/SelfTest/include/test.h" |
---|
10 | #include "Common/include/Test.h" |
---|
11 | #include "Common/include/Max.h" |
---|
12 | #include "Behavioural/include/Allocation.h" |
---|
13 | |
---|
14 | #define NB_ITERATION 64 |
---|
15 | #define CYCLE_MAX (1024*NB_ITERATION) |
---|
16 | |
---|
17 | #define LABEL(str...) \ |
---|
18 | { \ |
---|
19 | msg (_("{%d} "),static_cast<uint32_t>(sc_simulation_time())); \ |
---|
20 | msg (str); \ |
---|
21 | msg (_("\n")); \ |
---|
22 | } while(0) |
---|
23 | |
---|
24 | #define SC_START(cycle_offset) \ |
---|
25 | do \ |
---|
26 | { \ |
---|
27 | /*cout << "SC_START (begin)" << endl;*/ \ |
---|
28 | \ |
---|
29 | uint32_t cycle_current = static_cast<uint32_t>(sc_simulation_time()); \ |
---|
30 | if (cycle_offset != 0) \ |
---|
31 | { \ |
---|
32 | cout << "##########[ cycle "<< cycle_current+cycle_offset << " ]" << endl; \ |
---|
33 | } \ |
---|
34 | \ |
---|
35 | if (cycle_current > CYCLE_MAX) \ |
---|
36 | { \ |
---|
37 | TEST_KO("Maximal cycles Reached"); \ |
---|
38 | } \ |
---|
39 | \ |
---|
40 | sc_start(cycle_offset); \ |
---|
41 | \ |
---|
42 | /*cout << "SC_START (end )" << endl;*/ \ |
---|
43 | } while(0) |
---|
44 | |
---|
45 | void test (string name, |
---|
46 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::register_translation_unit::register_address_translation_unit::Parameters * _param) |
---|
47 | { |
---|
48 | msg(_("<%s> : Simulation SystemC.\n"),name.c_str()); |
---|
49 | |
---|
50 | #ifdef STATISTICS |
---|
51 | morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50); |
---|
52 | #endif |
---|
53 | |
---|
54 | Register_Address_Translation_unit * _Register_Address_Translation_unit = new Register_Address_Translation_unit (name.c_str(), |
---|
55 | #ifdef STATISTICS |
---|
56 | _parameters_statistics, |
---|
57 | #endif |
---|
58 | _param); |
---|
59 | |
---|
60 | #ifdef SYSTEMC |
---|
61 | /********************************************************************* |
---|
62 | * Déclarations des signaux |
---|
63 | *********************************************************************/ |
---|
64 | string rename; |
---|
65 | |
---|
66 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
67 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
68 | |
---|
69 | ALLOC1_SC_SIGNAL( in_RENAME_VAL ," in_RENAME_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
70 | ALLOC1_SC_SIGNAL(out_RENAME_ACK ,"out_RENAME_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
71 | ALLOC1_SC_SIGNAL( in_RENAME_FRONT_END_ID ," in_RENAME_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
72 | ALLOC1_SC_SIGNAL( in_RENAME_CONTEXT_ID ," in_RENAME_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
73 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RA_LOG ," in_RENAME_NUM_REG_RA_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
74 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RB_LOG ," in_RENAME_NUM_REG_RB_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
75 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RC_LOG ," in_RENAME_NUM_REG_RC_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
76 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RD_LOG ," in_RENAME_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
77 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RE_LOG ," in_RENAME_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
78 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RA_PHY ,"out_RENAME_NUM_REG_RA_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
79 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RB_PHY ,"out_RENAME_NUM_REG_RB_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
80 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RC_PHY ,"out_RENAME_NUM_REG_RC_PHY ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
81 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RD_PHY_OLD,"out_RENAME_NUM_REG_RD_PHY_OLD",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
82 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RE_PHY_OLD,"out_RENAME_NUM_REG_RE_PHY_OLD",Tspecial_address_t,_param->_nb_inst_insert); |
---|
83 | |
---|
84 | ALLOC1_SC_SIGNAL( in_INSERT_VAL ," in_INSERT_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
85 | ALLOC1_SC_SIGNAL(out_INSERT_ACK ,"out_INSERT_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
86 | //ALLOC1_SC_SIGNAL( in_INSERT_FRONT_END_ID ," in_INSERT_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
87 | //ALLOC1_SC_SIGNAL( in_INSERT_CONTEXT_ID ," in_INSERT_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
88 | ALLOC1_SC_SIGNAL( in_INSERT_WRITE_RD ," in_INSERT_WRITE_RD ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
89 | ALLOC1_SC_SIGNAL( in_INSERT_WRITE_RE ," in_INSERT_WRITE_RE ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
90 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RD_LOG ," in_INSERT_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
91 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RE_LOG ," in_INSERT_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
92 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RD_PHY ," in_INSERT_NUM_REG_RD_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
93 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RE_PHY ," in_INSERT_NUM_REG_RE_PHY ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
94 | |
---|
95 | ALLOC1_SC_SIGNAL( in_RETIRE_VAL ," in_RETIRE_VAL ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
96 | ALLOC1_SC_SIGNAL(out_RETIRE_ACK ,"out_RETIRE_ACK ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
97 | ALLOC1_SC_SIGNAL( in_RETIRE_FRONT_END_ID ," in_RETIRE_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_retire); |
---|
98 | ALLOC1_SC_SIGNAL( in_RETIRE_CONTEXT_ID ," in_RETIRE_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_retire); |
---|
99 | ALLOC1_SC_SIGNAL( in_RETIRE_EVENT_STATE ," in_RETIRE_EVENT_STATE ",Tevent_state_t ,_param->_nb_inst_retire); |
---|
100 | ALLOC1_SC_SIGNAL( in_RETIRE_WRITE_RD ," in_RETIRE_WRITE_RD ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
101 | ALLOC1_SC_SIGNAL( in_RETIRE_WRITE_RE ," in_RETIRE_WRITE_RE ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
102 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RD_LOG ," in_RETIRE_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_retire); |
---|
103 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RE_LOG ," in_RETIRE_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_retire); |
---|
104 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RD_PHY_OLD," in_RETIRE_NUM_REG_RD_PHY_OLD",Tgeneral_address_t,_param->_nb_inst_retire); |
---|
105 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RE_PHY_OLD," in_RETIRE_NUM_REG_RE_PHY_OLD",Tspecial_address_t,_param->_nb_inst_retire); |
---|
106 | |
---|
107 | /******************************************************** |
---|
108 | * Instanciation |
---|
109 | ********************************************************/ |
---|
110 | |
---|
111 | msg(_("<%s> : Instanciation of _Register_Address_Translation_unit.\n"),name.c_str()); |
---|
112 | |
---|
113 | (*(_Register_Address_Translation_unit->in_CLOCK)) (*(in_CLOCK)); |
---|
114 | (*(_Register_Address_Translation_unit->in_NRESET)) (*(in_NRESET)); |
---|
115 | |
---|
116 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_VAL ,_param->_nb_inst_insert); |
---|
117 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_ACK ,_param->_nb_inst_insert); |
---|
118 | if (_param->_have_port_front_end_id) |
---|
119 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
120 | if (_param->_have_port_context_id) |
---|
121 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
122 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RA_LOG ,_param->_nb_inst_insert); |
---|
123 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RB_LOG ,_param->_nb_inst_insert); |
---|
124 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RC_LOG ,_param->_nb_inst_insert); |
---|
125 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RD_LOG ,_param->_nb_inst_insert); |
---|
126 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RE_LOG ,_param->_nb_inst_insert); |
---|
127 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RA_PHY ,_param->_nb_inst_insert); |
---|
128 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RB_PHY ,_param->_nb_inst_insert); |
---|
129 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RC_PHY ,_param->_nb_inst_insert); |
---|
130 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RD_PHY_OLD,_param->_nb_inst_insert); |
---|
131 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RE_PHY_OLD,_param->_nb_inst_insert); |
---|
132 | |
---|
133 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_VAL ,_param->_nb_inst_insert); |
---|
134 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_INSERT_ACK ,_param->_nb_inst_insert); |
---|
135 | //if (_param->_have_port_front_end_id) |
---|
136 | //INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
137 | //if (_param->_have_port_context_id) |
---|
138 | //INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
139 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_WRITE_RD ,_param->_nb_inst_insert); |
---|
140 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_WRITE_RE ,_param->_nb_inst_insert); |
---|
141 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RD_LOG ,_param->_nb_inst_insert); |
---|
142 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RE_LOG ,_param->_nb_inst_insert); |
---|
143 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RD_PHY ,_param->_nb_inst_insert); |
---|
144 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RE_PHY ,_param->_nb_inst_insert); |
---|
145 | |
---|
146 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_VAL ,_param->_nb_inst_retire); |
---|
147 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RETIRE_ACK ,_param->_nb_inst_retire); |
---|
148 | if (_param->_have_port_front_end_id) |
---|
149 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_FRONT_END_ID ,_param->_nb_inst_retire); |
---|
150 | if (_param->_have_port_context_id) |
---|
151 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_CONTEXT_ID ,_param->_nb_inst_retire); |
---|
152 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_EVENT_STATE ,_param->_nb_inst_retire); |
---|
153 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_WRITE_RD ,_param->_nb_inst_retire); |
---|
154 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_WRITE_RE ,_param->_nb_inst_retire); |
---|
155 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RD_LOG ,_param->_nb_inst_retire); |
---|
156 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RE_LOG ,_param->_nb_inst_retire); |
---|
157 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RD_PHY_OLD,_param->_nb_inst_retire); |
---|
158 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RE_PHY_OLD,_param->_nb_inst_retire); |
---|
159 | |
---|
160 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
161 | |
---|
162 | Time * _time = new Time(); |
---|
163 | |
---|
164 | /******************************************************** |
---|
165 | * Simulation - Begin |
---|
166 | ********************************************************/ |
---|
167 | |
---|
168 | // Initialisation |
---|
169 | |
---|
170 | const uint32_t seed = 0; |
---|
171 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
172 | |
---|
173 | srand(seed); |
---|
174 | |
---|
175 | const int32_t percent_transaction_insert = 75; |
---|
176 | const int32_t percent_transaction_retire = 75; |
---|
177 | |
---|
178 | uint32_t max_nb_context = max(_param->_nb_context,_param->_nb_front_end); |
---|
179 | |
---|
180 | Tgeneral_address_t rat_gpr [_param->_nb_front_end][max_nb_context][_param->_nb_general_register_logic]; |
---|
181 | Tspecial_address_t rat_spr [_param->_nb_front_end][max_nb_context][_param->_nb_special_register_logic]; |
---|
182 | bool rat_gpr_updt [_param->_nb_front_end][max_nb_context][_param->_nb_general_register_logic]; |
---|
183 | bool rat_spr_updt [_param->_nb_front_end][max_nb_context][_param->_nb_special_register_logic]; |
---|
184 | |
---|
185 | uint32_t gpr=1; |
---|
186 | uint32_t spr=0; |
---|
187 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
188 | for (uint32_t j=0; j<_param->_nb_context[i]; j++) |
---|
189 | { |
---|
190 | rat_gpr [i][j][0] = 0; |
---|
191 | |
---|
192 | for (uint32_t k=1; k<_param->_nb_general_register_logic; k++) |
---|
193 | { |
---|
194 | rat_gpr [i][j][k] = gpr++; |
---|
195 | rat_gpr_updt [i][j][k] = false; |
---|
196 | } |
---|
197 | for (uint32_t k=0; k<_param->_nb_special_register_logic; k++) |
---|
198 | { |
---|
199 | rat_spr [i][j][k] = spr++; |
---|
200 | rat_spr_updt [i][j][k] = false; |
---|
201 | } |
---|
202 | } |
---|
203 | |
---|
204 | SC_START(0); |
---|
205 | LABEL("Initialisation"); |
---|
206 | |
---|
207 | LABEL("Reset"); |
---|
208 | in_NRESET->write(0); |
---|
209 | SC_START(5); |
---|
210 | in_NRESET->write(1); |
---|
211 | |
---|
212 | LABEL("Loop of Test"); |
---|
213 | |
---|
214 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
215 | { |
---|
216 | int32_t nb_request; |
---|
217 | |
---|
218 | LABEL("Iteration %d",iteration); |
---|
219 | |
---|
220 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
221 | { |
---|
222 | in_RENAME_VAL [i]->write(0); |
---|
223 | in_INSERT_VAL [i]->write(0); |
---|
224 | } |
---|
225 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
226 | in_RETIRE_VAL [i]->write(0); |
---|
227 | |
---|
228 | nb_request = 32; |
---|
229 | while (nb_request > 1) |
---|
230 | { |
---|
231 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
232 | { |
---|
233 | Tcontrol_t val = (rand()%100)<percent_transaction_insert; |
---|
234 | |
---|
235 | Tcontext_t front_end_id = rand() % _param->_nb_front_end; |
---|
236 | |
---|
237 | in_RENAME_VAL [i]->write(val); |
---|
238 | in_RENAME_FRONT_END_ID [i]->write(front_end_id); |
---|
239 | in_RENAME_CONTEXT_ID [i]->write(rand() % (_param->_nb_context[front_end_id])); |
---|
240 | in_RENAME_NUM_REG_RA_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
241 | in_RENAME_NUM_REG_RB_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
242 | in_RENAME_NUM_REG_RC_LOG [i]->write( rand() % _param->_nb_special_register_logic); |
---|
243 | in_RENAME_NUM_REG_RD_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
244 | in_RENAME_NUM_REG_RE_LOG [i]->write( rand() % _param->_nb_special_register_logic); |
---|
245 | in_INSERT_VAL [i]->write(val); |
---|
246 | in_INSERT_WRITE_RD [i]->write(rand() % 2); |
---|
247 | in_INSERT_WRITE_RE [i]->write(rand() % 2); |
---|
248 | in_INSERT_NUM_REG_RD_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
249 | in_INSERT_NUM_REG_RE_LOG [i]->write( rand() % _param->_nb_special_register_logic); |
---|
250 | in_INSERT_NUM_REG_RD_PHY [i]->write(rand() % _param->_nb_general_register); |
---|
251 | in_INSERT_NUM_REG_RE_PHY [i]->write(rand() % _param->_nb_special_register); |
---|
252 | } |
---|
253 | |
---|
254 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
255 | { |
---|
256 | Tcontrol_t val = (rand()%100)<percent_transaction_retire; |
---|
257 | |
---|
258 | Tcontext_t front_end_id = rand() % _param->_nb_front_end; |
---|
259 | |
---|
260 | in_RETIRE_VAL [i]->write(val); |
---|
261 | in_RETIRE_FRONT_END_ID [i]->write(front_end_id); |
---|
262 | in_RETIRE_CONTEXT_ID [i]->write(rand() % (_param->_nb_context[front_end_id])); |
---|
263 | in_RETIRE_EVENT_STATE [i]->write(EVENT_STATE_NO_EVENT); |
---|
264 | in_RETIRE_WRITE_RD [i]->write(rand() % 2); |
---|
265 | in_RETIRE_WRITE_RE [i]->write(rand() % 2); |
---|
266 | in_RETIRE_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
267 | in_RETIRE_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
268 | in_RETIRE_NUM_REG_RD_PHY_OLD [i]->write(rand() % _param->_nb_general_register); |
---|
269 | in_RETIRE_NUM_REG_RE_PHY_OLD [i]->write(rand() % _param->_nb_special_register); |
---|
270 | } |
---|
271 | |
---|
272 | SC_START(1); |
---|
273 | |
---|
274 | |
---|
275 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
276 | { |
---|
277 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
278 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
279 | if (in_INSERT_VAL [i]->read() and out_INSERT_ACK [i]->read()) |
---|
280 | { |
---|
281 | if (in_INSERT_WRITE_RD [i]->read() == 1) |
---|
282 | rat_gpr[front_end_id][context_id][in_INSERT_NUM_REG_RD_LOG[i]->read()] = in_INSERT_NUM_REG_RD_PHY[i]->read(); |
---|
283 | if (in_INSERT_WRITE_RE [i]->read() == 1) |
---|
284 | rat_spr[front_end_id][context_id][in_INSERT_NUM_REG_RE_LOG[i]->read()] = in_INSERT_NUM_REG_RE_PHY[i]->read(); |
---|
285 | } |
---|
286 | } |
---|
287 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
288 | { |
---|
289 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
290 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
291 | if (in_RENAME_VAL [i]->read() and out_RENAME_ACK [i]->read()) |
---|
292 | { |
---|
293 | nb_request --; |
---|
294 | |
---|
295 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RA_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RA_LOG[i]->read()]); |
---|
296 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RB_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RB_LOG[i]->read()]); |
---|
297 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RC_PHY [i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RC_LOG[i]->read()]); |
---|
298 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RD_PHY_OLD[i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RD_LOG[i]->read()]); |
---|
299 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RE_PHY_OLD[i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RE_LOG[i]->read()]); |
---|
300 | } |
---|
301 | |
---|
302 | } |
---|
303 | } |
---|
304 | |
---|
305 | // Event |
---|
306 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
307 | { |
---|
308 | in_RENAME_VAL [i]->write(0); |
---|
309 | in_INSERT_VAL [i]->write(0); |
---|
310 | } |
---|
311 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
312 | in_RETIRE_VAL [i]->write(0); |
---|
313 | |
---|
314 | Tcontext_t retire_front_end_id [_param->_nb_inst_retire]; |
---|
315 | Tcontext_t retire_context_id [_param->_nb_inst_retire]; |
---|
316 | |
---|
317 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
318 | { |
---|
319 | retire_front_end_id [i] = rand() % _param->_nb_front_end; |
---|
320 | retire_context_id [i] = rand() % (_param->_nb_context[retire_front_end_id [i]]); |
---|
321 | |
---|
322 | for (uint32_t k=0; k<_param->_nb_general_register_logic; k++) |
---|
323 | rat_gpr_updt [retire_front_end_id [i]][retire_context_id [i]][k] = false; |
---|
324 | for (uint32_t k=0; k<_param->_nb_special_register_logic; k++) |
---|
325 | rat_spr_updt [retire_front_end_id [i]][retire_context_id [i]][k] = false; |
---|
326 | } |
---|
327 | |
---|
328 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
329 | { |
---|
330 | in_RETIRE_VAL [i]->write(1); |
---|
331 | in_RETIRE_FRONT_END_ID [i]->write(retire_front_end_id [i]); |
---|
332 | in_RETIRE_CONTEXT_ID [i]->write(retire_context_id [i]); |
---|
333 | in_RETIRE_EVENT_STATE [i]->write(EVENT_STATE_EVENT); |
---|
334 | in_RETIRE_WRITE_RD [i]->write(0); |
---|
335 | in_RETIRE_WRITE_RE [i]->write(0); |
---|
336 | |
---|
337 | do |
---|
338 | { |
---|
339 | SC_START(1); |
---|
340 | } |
---|
341 | while (out_RETIRE_ACK[i]->read() == 0); |
---|
342 | |
---|
343 | in_RETIRE_VAL [i]->write(0); |
---|
344 | } |
---|
345 | |
---|
346 | SC_START(1); |
---|
347 | |
---|
348 | nb_request = 32; |
---|
349 | while (nb_request > 1) |
---|
350 | { |
---|
351 | |
---|
352 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
353 | { |
---|
354 | Tcontrol_t val = (rand()%100)<percent_transaction_insert; |
---|
355 | |
---|
356 | Tcontext_t front_end_id = rand() % _param->_nb_front_end; |
---|
357 | |
---|
358 | in_RENAME_VAL [i]->write(val); |
---|
359 | in_RENAME_FRONT_END_ID [i]->write(front_end_id); |
---|
360 | in_RENAME_CONTEXT_ID [i]->write(rand() % (_param->_nb_context[front_end_id])); |
---|
361 | in_RENAME_NUM_REG_RA_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
362 | in_RENAME_NUM_REG_RB_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
363 | in_RENAME_NUM_REG_RC_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
364 | in_RENAME_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
365 | in_RENAME_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
366 | in_INSERT_VAL [i]->write(val); |
---|
367 | in_INSERT_WRITE_RD [i]->write(rand() % 2); |
---|
368 | in_INSERT_WRITE_RE [i]->write(rand() % 2); |
---|
369 | in_INSERT_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
370 | in_INSERT_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
371 | in_INSERT_NUM_REG_RD_PHY [i]->write(rand() % _param->_nb_general_register); |
---|
372 | in_INSERT_NUM_REG_RE_PHY [i]->write(rand() % _param->_nb_special_register); |
---|
373 | } |
---|
374 | |
---|
375 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
376 | { |
---|
377 | Tcontrol_t val = (rand()%100)<percent_transaction_retire; |
---|
378 | in_RETIRE_VAL [i]->write(val); |
---|
379 | in_RETIRE_FRONT_END_ID [i]->write(retire_front_end_id [i]); |
---|
380 | in_RETIRE_CONTEXT_ID [i]->write(retire_context_id [i]); |
---|
381 | in_RETIRE_EVENT_STATE [i]->write(EVENT_STATE_WAITEND); |
---|
382 | in_RETIRE_WRITE_RD [i]->write(rand() % 2); |
---|
383 | in_RETIRE_WRITE_RE [i]->write(rand() % 2); |
---|
384 | in_RETIRE_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
385 | in_RETIRE_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
386 | in_RETIRE_NUM_REG_RD_PHY_OLD [i]->write(rand() % _param->_nb_general_register); |
---|
387 | in_RETIRE_NUM_REG_RE_PHY_OLD [i]->write(rand() % _param->_nb_special_register); |
---|
388 | } |
---|
389 | |
---|
390 | SC_START(1); |
---|
391 | |
---|
392 | |
---|
393 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
394 | { |
---|
395 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
396 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
397 | if (in_INSERT_VAL [i]->read() and out_INSERT_ACK [i]->read()) |
---|
398 | { |
---|
399 | if (in_INSERT_WRITE_RD [i]->read() == 1) |
---|
400 | rat_gpr[front_end_id][context_id][in_INSERT_NUM_REG_RD_LOG[i]->read()] = in_INSERT_NUM_REG_RD_PHY[i]->read(); |
---|
401 | if (in_INSERT_WRITE_RE [i]->read() == 1) |
---|
402 | rat_spr[front_end_id][context_id][in_INSERT_NUM_REG_RE_LOG[i]->read()] = in_INSERT_NUM_REG_RE_PHY[i]->read(); |
---|
403 | } |
---|
404 | } |
---|
405 | |
---|
406 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
407 | { |
---|
408 | Tcontext_t front_end_id = in_RETIRE_FRONT_END_ID [i]->read(); |
---|
409 | Tcontext_t context_id = in_RETIRE_CONTEXT_ID [i]->read(); |
---|
410 | if (in_RETIRE_VAL [i]->read() and out_RETIRE_ACK [i]->read()) |
---|
411 | { |
---|
412 | if (in_RETIRE_WRITE_RD [i]->read() == 1) |
---|
413 | { |
---|
414 | if (rat_gpr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] == false) |
---|
415 | rat_gpr[front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] = in_RETIRE_NUM_REG_RD_PHY_OLD[i]->read(); |
---|
416 | rat_gpr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] = true; |
---|
417 | } |
---|
418 | if (in_RETIRE_WRITE_RE [i]->read() == 1) |
---|
419 | { |
---|
420 | if (rat_spr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] == false) |
---|
421 | rat_spr[front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] = in_RETIRE_NUM_REG_RE_PHY_OLD[i]->read(); |
---|
422 | rat_spr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] = true; |
---|
423 | } |
---|
424 | } |
---|
425 | } |
---|
426 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
427 | { |
---|
428 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
429 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
430 | if (in_RENAME_VAL [i]->read() and out_RENAME_ACK [i]->read()) |
---|
431 | { |
---|
432 | nb_request --; |
---|
433 | |
---|
434 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RA_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RA_LOG[i]->read()]); |
---|
435 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RB_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RB_LOG[i]->read()]); |
---|
436 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RC_PHY [i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RC_LOG[i]->read()]); |
---|
437 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RD_PHY_OLD[i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RD_LOG[i]->read()]); |
---|
438 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RE_PHY_OLD[i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RE_LOG[i]->read()]); |
---|
439 | } |
---|
440 | |
---|
441 | } |
---|
442 | } |
---|
443 | } |
---|
444 | |
---|
445 | /******************************************************** |
---|
446 | * Simulation - End |
---|
447 | ********************************************************/ |
---|
448 | |
---|
449 | TEST_OK ("End of Simulation"); |
---|
450 | delete _time; |
---|
451 | |
---|
452 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
453 | |
---|
454 | delete in_CLOCK; |
---|
455 | delete in_NRESET; |
---|
456 | |
---|
457 | delete [] in_RENAME_VAL ; |
---|
458 | delete [] out_RENAME_ACK ; |
---|
459 | if (_param->_have_port_front_end_id) |
---|
460 | delete [] in_RENAME_FRONT_END_ID ; |
---|
461 | if (_param->_have_port_context_id) |
---|
462 | delete [] in_RENAME_CONTEXT_ID ; |
---|
463 | delete [] in_RENAME_NUM_REG_RA_LOG ; |
---|
464 | delete [] in_RENAME_NUM_REG_RB_LOG ; |
---|
465 | delete [] in_RENAME_NUM_REG_RC_LOG ; |
---|
466 | delete [] in_RENAME_NUM_REG_RD_LOG ; |
---|
467 | delete [] in_RENAME_NUM_REG_RE_LOG ; |
---|
468 | delete [] out_RENAME_NUM_REG_RA_PHY ; |
---|
469 | delete [] out_RENAME_NUM_REG_RB_PHY ; |
---|
470 | delete [] out_RENAME_NUM_REG_RC_PHY ; |
---|
471 | delete [] out_RENAME_NUM_REG_RD_PHY_OLD; |
---|
472 | delete [] out_RENAME_NUM_REG_RE_PHY_OLD; |
---|
473 | |
---|
474 | delete [] in_INSERT_VAL ; |
---|
475 | delete [] out_INSERT_ACK ; |
---|
476 | //if (_param->_have_port_front_end_id) |
---|
477 | //delete [] in_INSERT_FRONT_END_ID ; |
---|
478 | //if (_param->_have_port_context_id) |
---|
479 | //delete [] in_INSERT_CONTEXT_ID ; |
---|
480 | delete [] in_INSERT_WRITE_RD ; |
---|
481 | delete [] in_INSERT_WRITE_RE ; |
---|
482 | delete [] in_INSERT_NUM_REG_RD_LOG ; |
---|
483 | delete [] in_INSERT_NUM_REG_RE_LOG ; |
---|
484 | delete [] in_INSERT_NUM_REG_RD_PHY ; |
---|
485 | delete [] in_INSERT_NUM_REG_RE_PHY ; |
---|
486 | |
---|
487 | delete [] in_RETIRE_VAL ; |
---|
488 | delete [] out_RETIRE_ACK ; |
---|
489 | if (_param->_have_port_front_end_id) |
---|
490 | delete [] in_RETIRE_FRONT_END_ID ; |
---|
491 | if (_param->_have_port_context_id) |
---|
492 | delete [] in_RETIRE_CONTEXT_ID ; |
---|
493 | delete [] in_RETIRE_EVENT_STATE ; |
---|
494 | delete [] in_RETIRE_WRITE_RD ; |
---|
495 | delete [] in_RETIRE_WRITE_RE ; |
---|
496 | delete [] in_RETIRE_NUM_REG_RD_LOG ; |
---|
497 | delete [] in_RETIRE_NUM_REG_RE_LOG ; |
---|
498 | delete [] in_RETIRE_NUM_REG_RD_PHY_OLD; |
---|
499 | delete [] in_RETIRE_NUM_REG_RE_PHY_OLD; |
---|
500 | |
---|
501 | #endif |
---|
502 | |
---|
503 | delete _Register_Address_Translation_unit; |
---|
504 | #ifdef STATISTICS |
---|
505 | delete _parameters_statistics; |
---|
506 | #endif |
---|
507 | } |
---|