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