Skip to content

Commit e0cdad7

Browse files
committed
[Infra]: - generating yosys blif IF the benchmarks blif do not exist
- fixing --clean for run_yosys.sh Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent 7a85a88 commit e0cdad7

File tree

4 files changed

+49
-28
lines changed

4 files changed

+49
-28
lines changed

ODIN_II/regression_test/benchmark/suite/_BLIF/techmap_suite/task_list.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
regression_test/benchmark/task/_BLIF/keywords/*
21
regression_test/benchmark/task/_BLIF/common
32
regression_test/benchmark/task/_BLIF/syntax
43
regression_test/benchmark/task/_BLIF/operators
@@ -8,3 +7,4 @@ regression_test/benchmark/task/_BLIF/large
87
regression_test/benchmark/task/_BLIF/arch_sweep
98
regression_test/benchmark/task/_BLIF/FIR
109
regression_test/benchmark/task/_BLIF/vtr
10+
regression_test/benchmark/task/_BLIF/keywords/*

ODIN_II/run_yosys.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ function print_test_stat() {
6767
START_TIME="$2"
6868

6969
if [ _${STAT} == "_E" ]; then
70-
echo "[${BLUE}EXIST${NC}] . . . . . . . . . . . . . . . . . . _VERILOG/${TASK_DIR}/${TCL_BLIF_NAME}"
70+
echo "[${BLUE}EXIST${NC}] . . . . . . . . . . . . . . . . . . _BLIF/${TASK_DIR}/${TCL_BLIF_NAME}"
7171
elif [ _${STAT} == "_C" ]; then
72-
echo "[${GREEN}CREATED${NC}] . . . . . . . . . . . . . . . . . _VERILOG/${TASK_DIR}/${TCL_BLIF_NAME} - [${GREEN}$(print_time_since "${START_TIME}")${NC}]"
72+
echo "[${GREEN}CREATED${NC}] . . . . . . . . . . . . . . . . . _BLIF/${TASK_DIR}/${TCL_BLIF_NAME} - [${GREEN}$(print_time_since "${START_TIME}")${NC}]"
7373
elif [ _${STAT} == "_F" ]; then
74-
echo "[${RED}FAILED${NC}]${RED} . . . . . . . . . . . . . . . . . ${NC}_VERILOG/${TASK_DIR}/${TCL_BLIF_NAME}"
74+
echo "[${RED}FAILED${NC}]${RED} . . . . . . . . . . . . . . . . . ${NC}_BLIF/${TASK_DIR}/${TCL_BLIF_NAME}"
7575
fi
7676
}
7777

@@ -209,7 +209,7 @@ function parse_args() {
209209

210210
;;--clean)
211211
_CLEAN="on"
212-
echo "deleting all blif file in the specified task"
212+
echo "clean up yosys generated BLIFs directory if exist"
213213

214214
esac
215215

@@ -303,7 +303,10 @@ function populate_arg_from_file() {
303303
function run_task() {
304304
directory="$1"
305305
if [ "_${_CLEAN}" == "_on" ]; then
306-
find "${ODIN_DIR}/${directory/task\/}" -name "*.blif" -delete
306+
BLIFs_DIR=${ODIN_DIR}/${directory/task\/}
307+
if [ -d "${BLIFs_DIR}" ]; then
308+
find "${BLIFs_DIR}" -name "*.blif" -delete
309+
fi
307310
fi
308311

309312
populate_arg_from_file "${directory}/task.ycfg"

ODIN_II/verify_odin.sh

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ _DRY_RUN="off"
6262
_RANDOM_DRY_RUN="off"
6363
_GENERATE_BLIF="off"
6464
_REGENERATE_BLIF="off"
65+
_FORCE_GENERATE_BLIF="off"
6566
_REGENERATE_EXPECTATION="off"
6667
_GENERATE_EXPECTATION="off"
6768
_CONTINUE="off"
6869
_REPORT="on"
6970
_STATUS_ONLY="off"
7071
_RUN_YOSYS_ARGS=""
72+
_CLEAN_UP="off"
7173

7274
##############################################
7375
# Exit Functions
@@ -197,21 +199,25 @@ function find_in_bench() {
197199
# generate blif files of verilog files in benchmark/blif/_VERILOGS
198200
function generate_blifs() {
199201

200-
TASK="$1"
201-
if [ _${_GENERATE_BLIF} = "_on" ]; then
202-
echo "Generating missed BLIF files for benchmarks in ${REGRESSION_DIR}/benchmark/_VERILOG/${TASK_NAME}"
203-
else
204-
echo "Regenerating BLIF files for benchmarks in ${REGRESSION_DIR}/benchmark/_VERILOG/${TASK_NAME}"
205-
fi
202+
BENCHMARK="$1"
203+
BENCH_NAME=$(echo ${BENCHMARK} | sed 's/.*\(_BLIF\)/\1/g' )
206204

207-
RUN_YOSYS_SCRIPT_PARAMS="${_RUN_YOSYS_ARGS}"
208-
RUN_YOSYS_SCRIPT_PARAMS+= "-t ${TASK}"
205+
if [ "_${_CLEAN_UP}" == "_on" ]; then
206+
_RUN_YOSYS_ARGS+=" --clean "
207+
fi
209208

210-
if [ _${_REPORT} == "_on" ]; then
211-
RUN_YOSYS_SCRIPT_PARAMS+="--show_failure"
209+
if [ _${_GENERATE_BLIF} = "_on" ]; then
210+
echo "Generating missed BLIF files for benchmarks in ${REGRESSION_DIR}/benchmark/_VERILOG/${BENCH_NAME}"
211+
elif [ _${_REGENERATE_BLIF} = "_on" ]; then
212+
_RUN_YOSYS_ARGS+=" --regenerate_blif "
213+
echo "Regenerating BLIF files for benchmarks in ${REGRESSION_DIR}/benchmark/_VERILOG/${BENCH_NAME}"
212214
fi
213215

214-
${THIS_DIR}/run_yosys.sh
216+
RUN_YOSYS_SCRIPT_PARAMS=" -t ${BENCHMARK} "
217+
RUN_YOSYS_SCRIPT_PARAMS+="${_RUN_YOSYS_ARGS}"
218+
219+
${THIS_DIR}/run_yosys.sh ${RUN_YOSYS_SCRIPT_PARAMS}
220+
_RUN_YOSYS_ARGS=""
215221
}
216222

217223

@@ -389,6 +395,7 @@ function parse_args() {
389395

390396
;;-c|--clean)
391397
echo "Cleaning temporary run in directory"
398+
_CLEAN_UP="on"
392399
cleanup_temp
393400

394401
;;-f|--force_simulate)
@@ -408,13 +415,12 @@ function parse_args() {
408415
echo "random dry run"
409416

410417
;;--generate_blif)
411-
_REGENERATE_BLIF="on"
418+
_GENERATE_BLIF="on"
412419
_RUN_YOSYS_ARGS+=""
413420
echo "generating missed blifs of benchmark/_BLIF"
414421

415422
;;--regenerate_blif)
416423
_REGENERATE_BLIF="on"
417-
_RUN_YOSYS_ARGS+="--regenerate_blif"
418424
echo "regenerating blifs of benchmark/_BLIF"
419425

420426
;;--regenerate_expectation)
@@ -704,7 +710,12 @@ function populate_arg_from_file() {
704710
do
705711
if [ ! -f "${circuit_list_item}" ]
706712
then
707-
echo "file ${circuit_list_item} not found, skipping"
713+
if [ "_${_local_techmap_params}" != "_" ]; then
714+
echo "file ${circuit_list_item} not found, will be generating.."
715+
_FORCE_GENERATE_BLIF="on"
716+
else
717+
echo "file ${circuit_list_item} not found, skipping"
718+
fi
708719
else
709720
_circuit_list+=( "${circuit_list_item}" )
710721
fi
@@ -892,6 +903,18 @@ function sim() {
892903
esac
893904
done
894905

906+
####################################
907+
# generate yosys BLIFs if needed
908+
if [ "_${_techmap}" == "_on" ]; then
909+
# check if blif generting flags are active
910+
if [ "_${_CLEAN_UP}" == "_on" ] || \
911+
[ "_${_GENERATE_BLIF}" == "_on" ] || \
912+
[ "_${_REGENERATE_BLIF}" == "_on" ] || \
913+
[ "_${_FORCE_GENERATE_BLIF}" == "_on" ]; then
914+
generate_blifs "${benchmark_dir/${THIS_DIR}\/}"
915+
fi
916+
fi
917+
895918
##########################################
896919
# setup defaults
897920

@@ -1623,10 +1646,6 @@ function run_suite() {
16231646

16241647
for (( i = 0; i < ${#task_list[@]}; i++ ));
16251648
do
1626-
if [ _${_REGENERATE_BLIF} == "_on" ] || [ _${_GENERATE_BLIF} == "_on" ]; then
1627-
generate_blifs "${task_list[$i]}"
1628-
1629-
fi
16301649
run_task "${task_list[$i]}"
16311650
TEST_COUNT=$(( TEST_COUNT + 1 ))
16321651
done

run_reg_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Module for running regression tests
44
"""
55
from pathlib import Path
6-
import os
76
import sys
87
import argparse
98
import textwrap
@@ -255,9 +254,6 @@ def run_odin_test(args, test_name):
255254
odin_reg_script = [
256255
str(paths.odin_verify_path),
257256
"--clean",
258-
"--generate_blif" if not os.path.exists(
259-
"{}/_BLIF".format(str(paths.odin_benchmark_path))) else "",
260-
"--no_report" if not args.show_failures else "",
261257
"-C",
262258
str(paths.odin_output_on_error_path),
263259
"--nb_of_process",
@@ -281,6 +277,9 @@ def run_odin_test(args, test_name):
281277
odin_reg_script[-1] += "suite/_BLIF/techmap_suite"
282278
elif test_name == "odin_reg_strong":
283279
odin_reg_script[-1] += "suite/heavy_suite"
280+
# to avoid showing yosys logs
281+
if not args.show_failures:
282+
odin_reg_script.append("--no_report")
284283
else:
285284
raise IOError("Test does not exist: {}".format(test_name))
286285

0 commit comments

Comments
 (0)