@@ -42,7 +42,7 @@ _TEST=""
42
42
_NUMBER_OF_PROCESS=" 1"
43
43
_SIM_THREADS=" 1"
44
44
_VECTORS=" 100"
45
- _TIMEOUT=" 1200 "
45
+ _TIMEOUT=" 1200s "
46
46
_ADDER_DEF=" default"
47
47
_SIM_COUNT=" 1"
48
48
_RUN_DIR_OVERRIDE=" "
@@ -117,7 +117,7 @@ printf "Called program with $INPUT
117
117
-j|--nb_of_process < N > $( _prt_cur_arg ${_NUMBER_OF_PROCESS} ) Number of process requested to be used
118
118
-s|--sim_threads < N > $( _prt_cur_arg ${_SIM_THREADS} ) Use multithreaded simulation using N threads
119
119
-V|--vectors < N > $( _prt_cur_arg ${_VECTORS} ) Use N vectors to generate per simulation
120
- -T|--timeout < N sec > $( _prt_cur_arg ${_TIMEOUT} ) Timeout a simulation/synthesis after N seconds
120
+ -T|--timeout < N[s|m|h] > $( _prt_cur_arg ${_TIMEOUT} ) Timeout a simulation/synthesis after N seconds
121
121
-a|--adder_def < /abs/path > $( _prt_cur_arg ${_ADDER_DEF} ) Use template to build adders
122
122
-n|--simulation_count < N > $( _prt_cur_arg ${_SIM_COUNT} ) Allow to run the simulation N times to benchmark the simulator
123
123
-d|--output_dir < /abs/path > $( _prt_cur_arg ${_RUN_DIR_OVERRIDE} ) Change the run directory output
@@ -145,8 +145,9 @@ printf "
145
145
*small_sweep use a small set of timing architecture
146
146
*full_sweep sweep the whole vtr directory *** WILL FAIL ***
147
147
*default use the sample_arch.xml
148
- --simulate request simulation to be ran
148
+ --disable_simulation request simulation NOT to be ran
149
149
--no_threading do not use multithreading for this test ** useful if you have large test **
150
+ --source [relative_path] change where the benchmark files are, (relative to this config file) <default: ./>
150
151
"
151
152
}
152
153
@@ -287,40 +288,10 @@ function flag_is_number() {
287
288
esac
288
289
}
289
290
290
-
291
- # boolean type flags
292
- _low_ressource_flag=" "
293
- _valgrind_flag=" "
294
- _batch_sim_flag=" "
295
- _use_best_coverage_flag=" "
296
- _perf_flag=" "
297
-
298
- # number type flags
299
- _vector_flag=" "
300
- _timeout_flag=" "
301
- _simulation_threads_flag=" "
302
-
303
- _adder_definition_flag=" "
304
-
305
291
function _set_if() {
306
292
[ " $1 " == " on" ] && echo " $2 " || echo " "
307
293
}
308
294
309
- function _set_flag() {
310
- _low_ressource_flag=$( _set_if ${_LIMIT_RESSOURCE} " --limit_ressource" )
311
- _valgrind_flag=$( _set_if ${_VALGRIND} " --tool valgrind" )
312
- _batch_sim_flag=$( _set_if ${_BATCH_SIM} " --batch" )
313
- _use_best_coverage_flag=$( _set_if ${_BEST_COVERAGE_OFF} " --best_coverage" )
314
- _perf_flag=$( _set_if ${_USE_PERF} " --tool perf" )
315
-
316
- _vector_flag=" -g ${_VECTORS} "
317
- _timeout_flag=" --time_limit ${_TIMEOUT} s"
318
- _simulation_threads_flag=$( [ " ${_SIM_THREADS} " != " 1" ] && echo " -j ${_SIM_THREADS} " )
319
-
320
- _adder_definition_flag=" --adder_type ${_ADDER_DEF} "
321
-
322
- }
323
-
324
295
function parse_args() {
325
296
while [[ " $# " > 0 ]]
326
297
do
@@ -463,10 +434,28 @@ function sim() {
463
434
arch_list=" no_arch"
464
435
with_sim=" 0"
465
436
threads=${_NUMBER_OF_PROCESS}
466
- DEFAULT_CMD_PARAM=" ${_adder_definition_flag} ${_simulation_threads_flag} ${_batch_sim_flag} "
437
+ test_src=" ./"
438
+
439
+ # default flags
440
+ _low_ressource_flag=" --limit_ressource"
441
+ _valgrind_flag=" --tool valgrind"
442
+ _batch_sim_flag=" --batch"
443
+ _best_coverage_flag=" --best_coverage"
444
+ _perf_flag=" --tool perf"
445
+
446
+ use_timeout=" --time_limit ${_TIMEOUT} "
447
+ use_valgrind=$( _set_if ${_VALGRIND} ${_valgrind_flag} )
448
+ use_low_ressource=$( _set_if ${_LIMIT_RESSOURCE} ${_low_ressource_flag} )
449
+ use_batch_sim=$( _set_if ${_BATCH_SIM} ${_batch_sim_flag} )
450
+ use_best_coverage=$( _set_if ${_BEST_COVERAGE_OFF} ${_best_coverage_flag} )
451
+ use_perf=$( _set_if ${_USE_PERF} ${_perf_flag} )
452
+
453
+ _vector_flag=" -g ${_VECTORS} "
454
+ _simulation_threads_flag=$( [ " ${_SIM_THREADS} " != " 1" ] && echo " -j ${_SIM_THREADS} " )
455
+ _adder_definition_flag=" --adder_type ${_ADDER_DEF} "
467
456
468
457
_SYNTHESIS=" on"
469
- _SIMULATE=${_FORCE_SIM}
458
+ _SIMULATE=" on "
470
459
471
460
if [ ! -d " $1 " ]
472
461
then
@@ -479,6 +468,11 @@ function sim() {
479
468
while [[ " $# " > 0 ]]
480
469
do
481
470
case $1 in
471
+ --source)
472
+ test_src=$2
473
+ shift
474
+ ;;
475
+
482
476
--custom_args_file)
483
477
with_custom_args=1
484
478
;;
@@ -506,15 +500,20 @@ function sim() {
506
500
shift
507
501
;;
508
502
509
- --simulate )
510
- _SIMULATE=" on "
503
+ --disable_simulation )
504
+ _SIMULATE=${_FORCE_SIM}
511
505
;;
512
506
513
507
--no_threading)
514
508
echo " This test will not be multithreaded"
515
509
threads=" 1"
516
510
;;
517
511
512
+ --valgrind)
513
+ echo " This test will be ran with valgrind"
514
+ use_valgrind=${_valgrind_flag}
515
+ ;;
516
+
518
517
* )
519
518
echo " Unknown internal parameter passed: $1 "
520
519
config_help
@@ -526,9 +525,23 @@ function sim() {
526
525
527
526
# ##########################################
528
527
# run custom benchmark
529
- bench_type=${benchmark_dir##*/ }
528
+ real_bench=" ${benchmark_dir} "
529
+ benchmark_dir=" ${benchmark_dir} /${test_src} "
530
+ if [ " _${benchmark_dir} " == " _" ] || [ ! -d ${benchmark_dir} ]; then
531
+ echo " invalid benchmark directory parameter passed: ${benchmark_dir} from ${test_src} "
532
+ ctrl_c
533
+ fi
534
+
535
+ benchmark_dir=$( readlink -f " ${benchmark_dir} " )
536
+ bench_type=${real_bench##*/ }
530
537
echo " BENCHMARK IS: ${bench_type} "
531
538
539
+
540
+ # #########################################
541
+ # setup defaults
542
+ DEFAULT_CMD_PARAM=" ${_adder_definition_flag} ${_simulation_threads_flag} ${_batch_sim_flag} "
543
+ DEFAULT_WRAPPER_CMD=" ${_timeout_flag} ${_low_ressource_flag} ${use_valgrind} "
544
+
532
545
if [ " _${with_custom_args} " == " _1" ]
533
546
then
534
547
@@ -552,7 +565,7 @@ function sim() {
552
565
--failure_log ${global_odin_failure} .log
553
566
${_timeout_flag}
554
567
${_low_ressource_flag}
555
- ${_valgrind_flag } "
568
+ ${use_valgrind } "
556
569
557
570
if [ " ${_USE_PERF} " == " on" ]
558
571
then
@@ -636,9 +649,9 @@ function sim() {
636
649
--failure_log ${global_synthesis_failure} .log
637
650
${_timeout_flag}
638
651
${_low_ressource_flag}
639
- ${_valgrind_flag } "
652
+ ${use_valgrind } "
640
653
641
- if [ " ${_USE_PERF } " == " on" ]
654
+ if [ " ${use_perf } " == " on" ]
642
655
then
643
656
wrapper_synthesis_command=" ${wrapper_synthesis_command} ${_perf_flag} ${DIR} /perf.data"
644
657
fi
@@ -658,9 +671,9 @@ function sim() {
658
671
--log_file ${DIR} /simulation.log
659
672
--test_name ${TEST_FULL_REF}
660
673
--failure_log ${global_simulation_failure} .log
661
- ${_timeout_flag }
662
- ${_low_ressource_flag }
663
- ${_valgrind_flag } "
674
+ ${use_timeout }
675
+ ${use_low_ressource }
676
+ ${use_valgrind } "
664
677
665
678
if [ " ${_USE_PERF} " == " on" ]
666
679
then
@@ -675,7 +688,7 @@ function sim() {
675
688
676
689
if [ " ${_GENERATE_BENCH} " == " on" ] || [ ! -f ${input_vector_file} ]
677
690
then
678
- simulation_command=" ${simulation_command} ${_use_best_coverage_flag } ${_vector_flag} "
691
+ simulation_command=" ${simulation_command} ${use_best_coverage } ${_vector_flag} "
679
692
else
680
693
simulation_command=" ${simulation_command} -t ${input_vector_file} "
681
694
if [ " ${_GENERATE_OUTPUT} " == " off" ] && [ -f ${output_vector_file} ]
@@ -753,6 +766,7 @@ function sim() {
753
766
fi
754
767
755
768
fi
769
+
756
770
}
757
771
758
772
function run_failed() {
@@ -907,7 +921,6 @@ START=`get_current_time`
907
921
init_temp
908
922
909
923
parse_args $INPUT
910
- _set_flag
911
924
912
925
if [ " _${_TEST} " == " _" ]
913
926
then
0 commit comments