@@ -101,14 +101,18 @@ void runTests(int argc, char** argv)
101
101
{
102
102
DEFAULTS.auto_summary_default = " off" ;
103
103
std::string input_file;
104
+ uint32_t expected_num_uops;
104
105
105
106
sparta::app::CommandLineSimulator cls (USAGE, DEFAULTS);
106
107
auto & app_opts = cls.getApplicationOptions ();
107
- app_opts.add_options ()(
108
- " input-file" ,
109
- sparta::app::named_value<std::string>(" INPUT_FILE" , &input_file)->default_value (" " ),
110
- " Provide a JSON instruction stream" ,
111
- " Provide a JSON file with instructions to run through Execute" );
108
+ app_opts.add_options ()
109
+ (" input-file" ,
110
+ sparta::app::named_value<std::string>(" INPUT_FILE" , &input_file)->default_value (" " ),
111
+ " Provide a JSON instruction stream" ,
112
+ " Provide a JSON file with instructions to run through Execute" )
113
+ (" expected-num-uops" ,
114
+ sparta::app::named_value<uint32_t >(" EXPECTED_NUM_UOPS" , &expected_num_uops)->default_value (0 ),
115
+ " " );
112
116
113
117
int err_code = 0 ;
114
118
if (!cls.parse (argc, argv, err_code))
@@ -153,6 +157,9 @@ void runTests(int argc, char** argv)
153
157
decode_tester.test_sew (8 );
154
158
decode_tester.test_vlmax (512 );
155
159
160
+ // Test Vector Uop Generation
161
+ vuop_tester.test_num_vuops_generated (expected_num_uops);
162
+
156
163
// Test Retire
157
164
rob_tester.test_num_insts_retired (2 );
158
165
// vset + 4 vadd.vv uops
@@ -171,6 +178,9 @@ void runTests(int argc, char** argv)
171
178
decode_tester.test_sew (32 );
172
179
decode_tester.test_vlmax (32 );
173
180
181
+ // Test Vector Uop Generation
182
+ vuop_tester.test_num_vuops_generated (expected_num_uops);
183
+
174
184
// Test Retire
175
185
rob_tester.test_num_insts_retired (2 );
176
186
// vset + 1 vadd.vv uop
@@ -189,6 +199,9 @@ void runTests(int argc, char** argv)
189
199
decode_tester.test_sew (64 );
190
200
decode_tester.test_vlmax (16 );
191
201
202
+ // Test Vector Uop Generation
203
+ vuop_tester.test_num_vuops_generated (expected_num_uops);
204
+
192
205
// Test Retire
193
206
rob_tester.test_num_insts_retired (2 );
194
207
// vset + 1 vadd.vv uop
@@ -206,6 +219,9 @@ void runTests(int argc, char** argv)
206
219
decode_tester.test_sew (8 );
207
220
decode_tester.test_vlmax (1024 );
208
221
222
+ // Test Vector Uop Generation
223
+ vuop_tester.test_num_vuops_generated (expected_num_uops);
224
+
209
225
// Test Retire
210
226
rob_tester.test_num_insts_retired (2 );
211
227
// vset + 8 vadd.vv uop
@@ -224,47 +240,14 @@ void runTests(int argc, char** argv)
224
240
decode_tester.test_sew (8 );
225
241
decode_tester.test_vlmax (1024 );
226
242
243
+ // Test Vector Uop Generation
244
+ vuop_tester.test_num_vuops_generated (expected_num_uops);
245
+
227
246
// Test Retire
228
247
rob_tester.test_num_insts_retired (8 );
229
248
// vset + 1 vadd.vv + vset + 2 vadd.vv + vset + 4 vadd.vv uop + vset + 8 vadd.vv
230
249
rob_tester.test_num_uops_retired (19 );
231
250
}
232
- else if (input_file.find (" vmulvx_e8m4.json" ) != std::string::npos)
233
- {
234
- cls.runSimulator (&sim);
235
-
236
- // Test Retire
237
- rob_tester.test_num_insts_retired (3 );
238
- // vadd + 4 vmul.vx uop
239
- rob_tester.test_num_uops_retired (6 );
240
- rob_tester.test_last_inst_has_tail (false );
241
-
242
- // TODO: Test source values for all uops
243
- }
244
- else if (input_file.find (" vwmulvv_e8m4.json" ) != std::string::npos)
245
- {
246
- cls.runSimulator (&sim);
247
-
248
- // Test Retire
249
- rob_tester.test_num_insts_retired (2 );
250
- // vadd + 8 vwmul.vv uop
251
- rob_tester.test_num_uops_retired (9 );
252
- rob_tester.test_last_inst_has_tail (false );
253
-
254
- // TODO: Test destination values for all uops
255
- }
256
- else if (input_file.find (" vmseqvv_e8m4.json" ) != std::string::npos)
257
- {
258
- cls.runSimulator (&sim);
259
-
260
- // Test Retire
261
- rob_tester.test_num_insts_retired (2 );
262
- // vadd + 4 vmseq.vv uops
263
- rob_tester.test_num_uops_retired (5 );
264
- rob_tester.test_last_inst_has_tail (false );
265
-
266
- // TODO: Test destination values for all uops
267
- }
268
251
else if (input_file.find (" vrgather.json" ) != std::string::npos)
269
252
{
270
253
// Unsupported vector instructions are expected to make the simulator to throw
@@ -279,115 +262,12 @@ void runTests(int argc, char** argv)
279
262
}
280
263
EXPECT_TRUE (sparta_exception_fired);
281
264
}
282
- else if (input_file.find (" vsadd.json" ) != std::string::npos)
283
- {
284
- cls.runSimulator (&sim);
285
-
286
- rob_tester.test_num_insts_retired (2 );
287
- rob_tester.test_num_uops_retired (5 );
288
- rob_tester.test_last_inst_has_tail (false );
289
-
290
- vuop_tester.test_num_vuops_generated (4 );
291
- }
292
- else if (input_file.find (" elementwise.json" ) != std::string::npos)
293
- {
294
- cls.runSimulator (&sim);
295
-
296
- decode_tester.test_lmul (4 );
297
- decode_tester.test_vl (256 );
298
- decode_tester.test_vta (false );
299
- decode_tester.test_sew (32 );
300
- decode_tester.test_vlmax (128 );
301
-
302
- vuop_tester.test_num_vuops_generated (4 );
303
- }
304
- else if (input_file.find (" widening.json" ) != std::string::npos)
305
- {
306
- cls.runSimulator (&sim);
307
-
308
- decode_tester.test_lmul (4 );
309
- decode_tester.test_vl (256 );
310
- decode_tester.test_vta (false );
311
- decode_tester.test_sew (32 );
312
- decode_tester.test_vlmax (128 );
313
-
314
- vuop_tester.test_num_vuops_generated (8 );
315
- }
316
- else if (input_file.find (" widening_mixed.json" ) != std::string::npos)
317
- {
318
- cls.runSimulator (&sim);
319
-
320
- decode_tester.test_lmul (4 );
321
- decode_tester.test_vl (256 );
322
- decode_tester.test_vta (false );
323
- decode_tester.test_sew (32 );
324
- decode_tester.test_vlmax (128 );
325
-
326
- vuop_tester.test_num_vuops_generated (8 );
327
- }
328
- else if (input_file.find (" mac.json" ) != std::string::npos)
329
- {
330
- cls.runSimulator (&sim);
331
-
332
- decode_tester.test_lmul (4 );
333
- decode_tester.test_vl (256 );
334
- decode_tester.test_vta (false );
335
- decode_tester.test_sew (32 );
336
- decode_tester.test_vlmax (128 );
337
-
338
- vuop_tester.test_num_vuops_generated (4 );
339
- }
340
- else if (input_file.find (" mac_widening.json" ) != std::string::npos)
341
- {
342
- cls.runSimulator (&sim);
343
-
344
- decode_tester.test_lmul (4 );
345
- decode_tester.test_vl (256 );
346
- decode_tester.test_vta (false );
347
- decode_tester.test_sew (32 );
348
- decode_tester.test_vlmax (128 );
349
-
350
- vuop_tester.test_num_vuops_generated (8 );
351
- }
352
- else if (input_file.find (" single_dest.json" ) != std::string::npos)
353
- {
354
- cls.runSimulator (&sim);
355
-
356
- decode_tester.test_lmul (4 );
357
- decode_tester.test_vl (256 );
358
- decode_tester.test_vta (false );
359
- decode_tester.test_sew (32 );
360
- decode_tester.test_vlmax (128 );
361
-
362
- vuop_tester.test_num_vuops_generated (4 );
363
- }
364
- else if (input_file.find (" narrowing.json" ) != std::string::npos)
365
- {
366
- cls.runSimulator (&sim);
367
-
368
- decode_tester.test_lmul (4 );
369
- decode_tester.test_vl (256 );
370
- decode_tester.test_vta (false );
371
- decode_tester.test_sew (32 );
372
- decode_tester.test_vlmax (128 );
373
-
374
- vuop_tester.test_num_vuops_generated (8 );
375
- }
376
- else if (input_file.find (" int_ext.json" ) != std::string::npos)
265
+ else
377
266
{
378
267
cls.runSimulator (&sim);
379
268
380
- decode_tester.test_lmul (4 );
381
- decode_tester.test_vl (256 );
382
- decode_tester.test_vta (false );
383
- decode_tester.test_sew (64 );
384
- decode_tester.test_vlmax (64 );
385
-
386
- vuop_tester.test_num_vuops_generated (12 );
387
- }
388
- else
389
- {
390
- sparta_assert (false , " Invalid input file: " << input_file);
269
+ // Test Vector Uop Generation
270
+ vuop_tester.test_num_vuops_generated (expected_num_uops);
391
271
}
392
272
}
393
273
0 commit comments