f4pga/wrappers/sh: cleanup

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-08-11 05:31:04 +02:00
parent a6f4fbd481
commit 9dc9d6cb98
6 changed files with 67 additions and 132 deletions

View File

@ -234,7 +234,7 @@ python3 '{share_dir}'/scripts/prjxray_create_place_constraints.py \
--part '{part}' \
--vpr_grid_map '{share_dir}/arch/{device}/vpr_grid_map.csv' \
--input '{ioplace_file}' \
--db_root "${{DATABASE_DIR:=$(prjxray-config)}}" \
--db_root "${{DATABASE_DIR:-$(prjxray-config)}}" \
> constraints.place
""")
@ -268,7 +268,6 @@ fi
"""
else:
place_cmds += """
PCF=${PCF:=}
echo "Generating constrains ..."
python3 -m f4pga.wrappers.sh.generate_constraints $EBLIF $NET $PART $DEVICE $ARCH_DEF $PCF
VPR_PLACE_FILE='constraints.place'
@ -292,20 +291,17 @@ def synth():
def write_fasm(genfasm_extra_args = None):
print("[F4PGA] Running (deprecated) write fasm")
p_run_bash_cmds(p_vpr_common_cmds('fasm')+"""
TOP="${EBLIF%.*}"
FASM_EXTRA="${TOP}_fasm_extra.fasm"
""" + f"""
p_run_bash_cmds(p_vpr_common_cmds('fasm')+f"""
'{which('genfasm')}' \
${{ARCH_DEF}} ${{EBLIF}} --device ${{DEVICE_NAME}} \
${{VPR_OPTIONS}} \
--read_rr_graph ${{RR_GRAPH}} {' '.join(genfasm_extra_args) if genfasm_extra_args is not None else ''}
""" + """
echo "FASM extra: $FASM_EXTRA"
TOP="${EBLIF%.*}"
FASM_EXTRA="${TOP}_fasm_extra.fasm"
if [ -f $FASM_EXTRA ]; then
echo "writing final fasm"
cat ${TOP}.fasm $FASM_EXTRA > tmp.fasm
mv tmp.fasm ${TOP}.fasm
echo "writing final fasm (extra: $FASM_EXTRA)"
cat $FASM_EXTRA >> ${TOP}.fasm
fi
""")
Path('vpr_stdout.log').rename('fasm.log')
@ -347,7 +343,7 @@ while true; do
--) break ;;
esac
done
DATABASE_DIR=${DATABASE_DIR:=$(prjxray-config)}
DATABASE_DIR=${DATABASE_DIR:-$(prjxray-config)}
if [ -z $DEVICE ]; then
# Try to find device name. Accept only when exactly one is found
PART_DIRS=(${DATABASE_DIR}/*/${PART})
@ -445,7 +441,7 @@ if [ -z $BIT ]; then echo "Please provide an output bistream file name"; exit 1;
""" + f"""
if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then
'{which('qlf_fasm')}' \
--db-root "${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}/fasm_database/${{DEVICE}}" \
--db-root "${{F4PGA_SHARE_DIR}}/fasm_database/${{DEVICE}}" \
--format "$BIT_FORMAT" \
--assemble \
"$FASM" \
@ -477,7 +473,7 @@ else
DEVICE_1={device}
fi
""" + """
ARCH_DIR="$F4PGA_SHARE_DIR"/arch/${DEVICE_1}_${DEVICE_1}
ARCH_DIR="${F4PGA_SHARE_DIR}/arch/${DEVICE_1}_${DEVICE_1}"
PINMAP_XML=${ARCH_DIR}/${PINMAPXML}
""" + f"""
'{python3}' "$F4PGA_SHARE_DIR"/scripts/create_lib.py \
@ -497,10 +493,8 @@ def ql():
def fasm2bels():
print("[F4PGA] Running (deprecated) fasm2bels")
p_run_bash_cmds("""
p_run_bash_cmds(f"""
set -e
SHARE_DIR_PATH=${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}
""" + f"""
eval set -- "$(
getopt \
--options=d:P:p:b:v:o:q \
@ -534,8 +528,8 @@ if ! [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then echo "ERROR: Unsupported dev
if [ -z "{PCF}" ]; then PCF_ARGS=""; else PCF_ARGS="--input-pcf ${PCF}"; fi
echo "Running fasm2bels"
""" + f"""
'{python3}' "`readlink -f ${{SHARE_DIR_PATH}}/scripts/fasm2bels.py`" "${{BIT}}" \
--phy-db "`readlink -f ${{SHARE_DIR_PATH}}/arch/${{DEVICE}}_wlcsp/db_phy.pickle`" \
'{python3}' "${{F4PGA_SHARE_DIR}}"/scripts/fasm2bels.py "${{BIT}}" \
--phy-db "${{F4PGA_SHARE_DIR}}/arch/${{DEVICE}}_wlcsp/db_phy.pickle" \
--device-name "${{DEVICE/ql-/}}" \
--package-name "$PART" \
--input-type bitstream \

View File

@ -18,7 +18,7 @@
set -e
SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}
SHARE_DIR_PATH=${SHARE_DIR_PATH:-"$F4PGA_SHARE_DIR"}
source $(dirname "$0")/vpr_common.f4pga.sh
@ -88,62 +88,25 @@ for arg in $@; do
-h|--help) exit 0 ;;
*)
case $OPT in
src)
SOURCE=$arg
OPT=""
;;
top)
TOP=$arg
OPT=""
;;
vlog)
VERILOG_FILES+="$arg "
;;
dev)
DEVICE=$arg
OPT=""
;;
pcf)
PCF=$arg
OPT=""
;;
part)
PART=$arg
OPT=""
;;
json)
JSON=$arg
OPT=""
;;
sdc)
SDC=$arg
OPT=""
;;
src) SOURCE=$arg; OPT="" ;;
top) TOP=$arg; OPT="" ;;
dev) DEVICE=$arg; OPT="" ;;
pcf) PCF=$arg; OPT="" ;;
part) PART=$arg; OPT="" ;;
json) JSON=$arg; OPT="" ;;
sdc) SDC=$arg; OPT="" ;;
pnr_corner) PNR_CORNER=$arg; OPT="" ;;
analysis_corner) ANALYSIS_CORNER=$arg; OPT="" ;;
build_dir) BUILDDIR=$arg OPT="" ;;
route)
ROUTE_FLAG0="$arg"
ROUTE_FLAG0="${ROUTE_FLAG0,,}"
OPT=""
;;
pnr_corner)
PNR_CORNER=$arg
OPT=""
;;
analysis_corner)
ANALYSIS_CORNER=$arg
OPT=""
;;
dump)
OUT+="$arg "
;;
compile_xtra)
;;
options_file)
COMPILE_EXTRA_ARGS+=("-f \"`realpath $arg`\" ")
;;
build_dir)
BUILDDIR=$arg
OPT=""
;;
vlog) VERILOG_FILES+="$arg " ;;
dump) OUT+="$arg " ;;
compile_xtra) ;;
options_file) COMPILE_EXTRA_ARGS+=("-f \"`realpath $arg`\" ") ;;
*)
echo "Refer help for more details: ql_symbiflow -h "
exit 1
@ -157,69 +120,47 @@ for arg in $@; do
done
case ${DEVICE} in
qlf_k4n8)
DEVICE="${DEVICE}_${DEVICE}"
FAMILY="qlf_k4n8"
DEVICE_CHECK="VALID"
USE_PINMAP=1
;;
qlf_k6n10)
DEVICE="${DEVICE}_${DEVICE}"
FAMILY="qlf_k6n10"
DEVICE_CHECK="VALID"
USE_PINMAP=1
;;
ql-eos-s3)
DEVICE="${DEVICE}"
FAMILY="pp3"
DEVICE_CHECK="VALID"
USE_PINMAP=0
;;
*)
echo "Unsupported device '${DEVICE}'"
exit 1
;;
qlf_k4n8) DEVICE="${DEVICE}_${DEVICE}"; FAMILY="qlf_k4n8"; DEVICE_CHECK="VALID"; USE_PINMAP=1 ;;
qlf_k6n10) DEVICE="${DEVICE}_${DEVICE}"; FAMILY="qlf_k6n10"; DEVICE_CHECK="VALID"; USE_PINMAP=1 ;;
ql-eos-s3) DEVICE="${DEVICE}"; FAMILY="pp3"; DEVICE_CHECK="VALID"; USE_PINMAP=0 ;;
*) echo "Unsupported device '${DEVICE}'"; exit 1 ;;
esac
## Check if the source directory exists
if [[ $1 == "-h" || $1 == "--help" ]];then
exit 1
else
if [ -z "$SOURCE" ];then
SOURCE=$PWD
elif [ $SOURCE == "." ];then
SOURCE=$PWD
elif [ ! -d "$SOURCE" ];then
echo "Directory path $SOURCE DOES NOT exists. Please add absolute path"
fi
## Check if the source directory exists
SOURCE=${SOURCE:-$PWD}
if [ $SOURCE == "." ];then
SOURCE=$PWD
elif [ ! -d "$SOURCE" ];then
echo "Directory path $SOURCE DOES NOT exists. Please add absolute path"
exit 1
fi
if [ -f $SOURCE/v_list_tmp ];then
rm -f $SOURCE/v_list_tmp
fi
if [ "$VERILOG_FILES" == "*.v" ];then
VERILOG_FILES=`cd ${SOURCE};ls *.v`
fi
echo "$VERILOG_FILES" >${SOURCE}/v_list
## Validate the verlog source files
if [ ${#VERILOG_FILES[@]} -eq 0 ]; then
if [[ $1 != "-h" || $1 != "--help" ]];then
echo "Please provide at least one Verilog file"
exit 1
fi
if [[ $1 == "-h" || $1 == "--help" ]];then
exit 0
else
if [ -f $SOURCE/v_list_tmp ];then
rm -f $SOURCE/v_list_tmp
fi
if [ "$VERILOG_FILES" == "*.v" ];then
VERILOG_FILES=`cd ${SOURCE};ls *.v`
fi
echo "$VERILOG_FILES" >${SOURCE}/v_list
fi
## Validate the verlog source files
if [ ${#VERILOG_FILES[@]} -eq 0 ]; then
if [[ $1 != "-h" || $1 != "--help" ]];then
echo "Please provide at least one Verilog file"
exit 1
fi
else
echo "verilog files: $VERILOG_FILES"
echo $VERILOG_FILES >${SOURCE}/v_list
sed '/^$/d' $SOURCE/v_list > $SOURCE/f_list_temp
VERILOG_FILES=`cat $SOURCE/f_list_temp`
fi
else
echo "verilog files: $VERILOG_FILES"
echo $VERILOG_FILES >${SOURCE}/v_list
sed '/^$/d' $SOURCE/v_list > $SOURCE/f_list_temp
VERILOG_FILES=`cat $SOURCE/f_list_temp`
fi
if [[ $1 == "-compile" || $1 == "-post_verilog" ]]; then
if [ -z "$DEVICE" ]; then
echo "DEVICE name is missing. Refer -h/--help"
@ -344,9 +285,9 @@ elif [[ -f $PCF ]];then
fi
if [[ $USE_PINMAP -ne 0 ]]; then
export PART=${CSV_PATH}
export PART=${CSV_PATH}
else
export PART=${PART}
export PART=${PART}
fi
export JSON=${JSON_PATH}
export PCF_PATH=${PCF_PATH}

View File

@ -18,7 +18,7 @@
set -e
export SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}
export SHARE_DIR_PATH=${SHARE_DIR_PATH:-"$F4PGA_SHARE_DIR"}
SPLIT_INOUTS=`realpath ${SHARE_DIR_PATH}/scripts/split_inouts.py`
CONVERT_OPTS=`realpath ${SHARE_DIR_PATH}/scripts/convert_compile_opts.py`

View File

@ -16,7 +16,7 @@
#
# SPDX-License-Identifier: Apache-2.0
SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}
SHARE_DIR_PATH=${SHARE_DIR_PATH:-"$F4PGA_SHARE_DIR"}
if [ -z $VPR_OPTIONS ]; then
echo "Using default VPR options."

View File

@ -118,7 +118,7 @@ if [ ${#VERILOG_FILES[@]} -eq 0 ]; then
exit 1
fi
DATABASE_DIR=${DATABASE_DIR:=$(prjxray-config)}
DATABASE_DIR=${DATABASE_DIR:-$(prjxray-config)}
export TOP=${TOP}
export USE_ROI="FALSE"
@ -130,7 +130,7 @@ 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)}
export PYTHON3=${PYTHON3:-$(which python3)}
LOG=${TOP}_synth.log

View File

@ -16,7 +16,7 @@
#
# SPDX-License-Identifier: Apache-2.0
SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}
SHARE_DIR_PATH=${SHARE_DIR_PATH:-"$F4PGA_SHARE_DIR"}
if [ -z $VPR_OPTIONS ]; then
echo "Using default VPR options."