f4pga/wrappers/sh/synth: update

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-09-07 02:14:06 +02:00
parent ce0c29bddb
commit 9e327656a1
2 changed files with 55 additions and 147 deletions

View File

@ -45,65 +45,27 @@ EXTRA_ARGS=()
OPT="" OPT=""
for arg in $@; do for arg in $@; do
case $arg in case $arg in
-t|--top) -t|--top) OPT="top" ;;
OPT="top" -v|--verilog) OPT="vlog" ;;
;; -d|--device) OPT="dev" ;;
-v|--verilog) -F|--family) OPT="family" ;;
OPT="vlog" -P|--part) OPT="part" ;;
;; -p|--pcf) OPT="pcf" ;;
-d|--device) -y|-f|+incdir+*|+libext+*|+define+*) OPT="xtra" ;;
OPT="dev"
;;
-F|--family)
OPT="family"
;;
-P|--part)
OPT="part"
;;
-p|--pcf)
OPT="pcf"
;;
-y|-f|+incdir+*|+libext+*|+define+*)
OPT="xtra"
;;
*) *)
case $OPT in case $OPT in
"top") "top") TOP=$arg; OPT="" ;;
TOP=$arg "dev") DEVICE=$arg; OPT="" ;;
OPT="" "family") FAMILY=$arg; OPT="" ;;
;; "part") PART=$arg; OPT="" ;;
"vlog") "pcf") PCF=$arg; OPT="" ;;
VERILOG_FILES+=($arg) "vlog") VERILOG_FILES+=($arg) ;;
;; "xtra") ;;
"dev") *) print_usage ;;
DEVICE=$arg
OPT=""
;;
"family")
FAMILY=$arg
OPT=""
;;
"part")
PART=$arg
OPT=""
;;
"pcf")
PCF=$arg
OPT=""
;;
"xtra")
;;
*)
print_usage
;;
esac esac
;; ;;
esac esac
if [ "$OPT" == "xtra" ]; then EXTRA_ARGS+=($arg); fi
if [ "$OPT" == "xtra" ]; then
EXTRA_ARGS+=($arg)
fi
done done
if [ -z ${FAMILY} ]; then echo "Please specify device family"; exit 1; fi if [ -z ${FAMILY} ]; then echo "Please specify device family"; exit 1; fi
@ -145,19 +107,8 @@ else
fi fi
fi fi
YOSYS_COMMANDS=`echo ${EXTRA_ARGS[*]} | python3 -m f4pga.utils.quicklogic.convert_compile_opts` yosys_cmds=`echo ${EXTRA_ARGS[*]} | python3 -m f4pga.utils.quicklogic.convert_compile_opts`
YOSYS_COMMANDS="${YOSYS_COMMANDS//$'\n'/'; '}" `which yosys` \
-p "${yosys_cmds//$'\n'/'; '} tcl $(python3 -m f4pga.wrappers.tcl "${FAMILY}")" \
LOG=${TOP}_synth.log -l "${TOP}_synth.log" \
${VERILOG_FILES[*]}
YOSYS_SCRIPT="tcl $(python3 -m f4pga.wrappers.tcl "${FAMILY}")"
for f in ${VERILOG_FILES[*]}; do
YOSYS_SCRIPT="read_verilog ${f}; $YOSYS_SCRIPT"
done
if [ ! -z "${YOSYS_COMMANDS}" ]; then
YOSYS_SCRIPT="$YOSYS_COMMANDS; $YOSYS_SCRIPT"
fi
`which yosys` -p "${YOSYS_SCRIPT}" -l $LOG

View File

@ -35,55 +35,12 @@ SURELOG=0
for arg in $@; do for arg in $@; do
echo $arg echo $arg
case "$arg" in case "$arg" in
-t|--top) -v|--verilog) VERILOGLIST=1 XDCLIST=0 TOPNAME=0 DEVICENAME=0 PARTNAME=0 SURELOG=0 ;;
echo "adding top" -x|--xdc) VERILOGLIST=0 XDCLIST=1 TOPNAME=0 DEVICENAME=0 PARTNAME=0 SURELOG=0 ;;
VERILOGLIST=0 -t|--top) VERILOGLIST=0 XDCLIST=0 TOPNAME=1 DEVICENAME=0 PARTNAME=0 SURELOG=0 ;;
XDCLIST=0 -d|--device) VERILOGLIST=0 XDCLIST=0 TOPNAME=0 DEVICENAME=1 PARTNAME=0 SURELOG=0 ;;
TOPNAME=1 -p|--part) VERILOGLIST=0 XDCLIST=0 TOPNAME=0 DEVICENAME=0 PARTNAME=1 SURELOG=0 ;;
DEVICENAME=0 -s|--surelog) VERILOGLIST=0 XDCLIST=0 TOPNAME=0 DEVICENAME=0 PARTNAME=0 SURELOG=1 ;;
PARTNAME=0
SURELOG=0
;;
-x|--xdc)
VERILOGLIST=0
XDCLIST=1
TOPNAME=0
DEVICENAME=0
PARTNAME=0
SURELOG=0
;;
-v|--verilog)
VERILOGLIST=1
XDCLIST=0
TOPNAME=0
DEVICENAME=0
PARTNAME=0
SURELOG=0
;;
-d|--device)
VERILOGLIST=0
XDCLIST=0
TOPNAME=0
DEVICENAME=1
PARTNAME=0
SURELOG=0
;;
-p|--part)
VERILOGLIST=0
XDCLIST=0
TOPNAME=0
DEVICENAME=0
PARTNAME=1
SURELOG=0
;;
-s|--surelog)
VERILOGLIST=0
XDCLIST=0
TOPNAME=0
DEVICENAME=0
PARTNAME=0
SURELOG=1
;;
*) *)
if [ $VERILOGLIST -eq 1 ]; then if [ $VERILOGLIST -eq 1 ]; then
VERILOG_FILES+=($arg) VERILOG_FILES+=($arg)
@ -107,27 +64,27 @@ for arg in $@; do
esac esac
done done
if [ ${#VERILOG_FILES[@]} -eq 0 ]; then if [ ${#VERILOG_FILES[@]} -eq 0 ]; then echo "Please provide at least one Verilog file"; exit 1; fi
echo "Please provide at least one Verilog file"
exit 1
fi
DATABASE_DIR=${DATABASE_DIR:-$(prjxray-config)} export TOP="${TOP}"
export USE_ROI='FALSE'
export INPUT_XDC_FILES="${XDC_FILES[*]}"
export OUT_JSON="$TOP.json"
export OUT_SDC="${TOP}.sdc"
export SYNTH_JSON="${TOP}_io.json"
export OUT_SYNTH_V="${TOP}_synth.v"
export OUT_EBLIF="${TOP}.eblif"
export PART_JSON=`realpath ${DATABASE_DIR:-$(prjxray-config)}/$DEVICE/$PART/part.json`
export OUT_FASM_EXTRA="${TOP}_fasm_extra.fasm"
export PYTHON3="${PYTHON3:-$(which python3)}"
export TOP=${TOP} yosys_read_cmds=""
export USE_ROI="FALSE" yosys_files="${VERILOG_FILES[*]}"
export INPUT_XDC_FILES=${XDC_FILES[*]}
export OUT_JSON=$TOP.json
export OUT_SDC=${TOP}.sdc
export SYNTH_JSON=${TOP}_io.json
export OUT_SYNTH_V=${TOP}_synth.v
export OUT_EBLIF=${TOP}.eblif
export PART_JSON=`realpath ${DATABASE_DIR}/$DEVICE/$PART/part.json`
export OUT_FASM_EXTRA=${TOP}_fasm_extra.fasm
export PYTHON3=${PYTHON3:-$(which python3)}
yosys_read_cmds="read_verilog"
if [ -n "$SURELOG_CMD" ]; then if [ -n "$SURELOG_CMD" ]; then
yosys_read_cmds="plugin -i uhdm; read_verilog_with_uhdm ${SURELOG_CMD[*]}" yosys_read_cmds="plugin -i uhdm; read_verilog_with_uhdm ${SURELOG_CMD[*]} ${VERILOG_FILES[*]}"
yosys_files=""
fi fi
yosys -p "$yosys_read_cmds ${VERILOG_FILES[*]}; tcl $(python3 -m f4pga.wrappers.tcl)" -l "${TOP}_synth.log" yosys \
-p "$yosys_read_cmds; tcl $(python3 -m f4pga.wrappers.tcl)" \
-l "${TOP}_synth.log" \
$yosys_files