f4pga/wrappers/sh/vpr_common: style

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-08-11 00:02:02 +02:00
parent 8dc2c18038
commit 1c94ac60a6
2 changed files with 100 additions and 124 deletions

View File

@ -30,24 +30,22 @@ fi
function parse_args { function parse_args {
OPTS=d:f:e:p:n:P:j:s:t:c: eval set -- $(
LONGOPTS=device:,eblif:,pcf:,net:,part:,json:,sdc:,top:,corner: getopt \
--options=d:f:e:p:n:P:j:s:t:c: \
PARSED_OPTS=`getopt --options=${OPTS} --longoptions=${LONGOPTS} --name $0 -- $@` --longoptions=device:,eblif:,pcf:,net:,part:,json:,sdc:,top:,corner: \
eval set -- ${PARSED_OPTS} --name $0 -- $@
)
DEVICE="" DEVICE=""
FAMILY="" FAMILY=""
DEVICE_NAME=""
PART=""
EBLIF="" EBLIF=""
PCF="" PCF=""
NET="" NET=""
SDC="" PART=""
JSON="" JSON=""
SDC=""
TOP="top" TOP="top"
CORNER="" CORNER=""
while true; do while true; do
case "$1" in case "$1" in
-d|--device) DEVICE=$2; shift 2 ;; -d|--device) DEVICE=$2; shift 2 ;;
@ -63,55 +61,19 @@ function parse_args {
--) break ;; --) break ;;
esac esac
done done
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
if [ -z $FAMILY ]; then echo "Please provide device family name"; exit 1; fi
if [ -z $EBLIF ]; then echo "Please provide blif file name"; exit 1; fi
if [ -z $DEVICE ]; then export DEVICE="$DEVICE"
echo "Please provide device name" export FAMILY="$FAMILY"
exit 1 export EBLIF="$EBLIF"
fi export PCF="$PCF"
export NET="$NET"
if [ -z $FAMILY ]; then export JSON="$JSON"
echo "Please provide device family name" export SDC="$SDC"
exit 1 export TOP="$TOP"
fi export CORNER="$CORNER"
if [ -z $EBLIF ]; then
echo "Please provide blif file name"
exit 1
fi
export DEVICE=$DEVICE
export FAMILY=$FAMILY
export EBLIF=$EBLIF
export PCF=$PCF
export NET=$NET
export SDC=$SDC
export JSON=$JSON
export CORNER=$CORNER
if [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then
DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_${CORNER}"
DEVICE_2=${DEVICE_1}
elif [[ "$DEVICE" == "qlf_k6n10_qlf_k6n10" ]];then
DEVICE_1="qlf_k6n10-qlf_k6n10_gf12"
DEVICE_2=${DEVICE_1}
else
DEVICE_1=${DEVICE}
DEVICE_2="wlcsp"
fi
export TOP=$TOP
export ARCH_DIR=`realpath ${SHARE_DIR_PATH}/arch/${DEVICE_1}_${DEVICE_2}`
export ARCH_DEF=${ARCH_DIR}/arch_${DEVICE_1}_${DEVICE_2}.xml
# qlf* devices use different naming scheme than pp3* ones.
export RR_GRAPH=${ARCH_DIR}/${DEVICE_1}.rr_graph.bin
if [ ! -f ${RR_GRAPH} ]; then
export RR_GRAPH=${ARCH_DIR}/rr_graph_${DEVICE_1}_${DEVICE_2}.rr_graph.real.bin
fi
export PLACE_DELAY=${ARCH_DIR}/rr_graph_${DEVICE_1}_${DEVICE_2}.place_delay.bin
export ROUTE_DELAY=${ARCH_DIR}/rr_graph_${DEVICE_1}_${DEVICE_2}.lookahead.bin
export DEVICE_NAME=${DEVICE_1}
if [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then if [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then
VPR_OPTIONS="$VPR_OPTIONS VPR_OPTIONS="$VPR_OPTIONS
@ -141,6 +103,30 @@ function parse_args {
--pack_high_fanout_threshold PB-LOGIC:18 --pack_high_fanout_threshold PB-LOGIC:18
--suppress_warnings ${OUT_NOISY_WARNINGS},sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route:set_rr_graph_tool_comment" --suppress_warnings ${OUT_NOISY_WARNINGS},sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route:set_rr_graph_tool_comment"
fi fi
if [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then
DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_${CORNER}"
DEVICE_2="$DEVICE_1"
elif [[ "$DEVICE" == "qlf_k6n10_qlf_k6n10" ]];then
DEVICE_1="qlf_k6n10-qlf_k6n10_gf12"
DEVICE_2="$DEVICE_1"
else
DEVICE_1="$DEVICE"
DEVICE_2="wlcsp"
fi
DEVICE_ARCH="${DEVICE_1}_${DEVICE_2}"
export ARCH_DIR=`realpath ${SHARE_DIR_PATH}/arch/${DEVICE_ARCH}`
export ARCH_DEF="${ARCH_DIR}/arch_${DEVICE_ARCH}".xml
ARCH_RR_PREFIX="${ARCH_DIR}/rr_graph_${DEVICE_ARCH}"
# qlf* devices use different naming scheme than pp3* ones.
export RR_GRAPH="${ARCH_DIR}/${DEVICE_1}".rr_graph.bin
if [ ! -f "${RR_GRAPH}" ]; then
export RR_GRAPH="${ARCH_RR_PREFIX}".rr_graph.real.bin
fi
export PLACE_DELAY="${ARCH_RR_PREFIX}".place_delay.bin
export ROUTE_DELAY="${ARCH_RR_PREFIX}".lookahead.bin
export DEVICE_NAME="$DEVICE_1"
} }
function run_vpr { function run_vpr {
@ -151,14 +137,14 @@ function run_vpr {
SDC_OPTIONS="--sdc_file $SDC" SDC_OPTIONS="--sdc_file $SDC"
fi fi
"`which vpr`" ${ARCH_DEF} \ "`which vpr`" "$ARCH_DEF" \
${EBLIF} \ ${EBLIF} \
--read_rr_graph ${RR_GRAPH} \ --read_rr_graph "$RR_GRAPH" \
--device ${DEVICE_NAME} \ --device "$DEVICE_NAME" \
${VPR_OPTIONS} \ $VPR_OPTIONS \
--read_router_lookahead ${ROUTE_DELAY} \ --read_router_lookahead "$ROUTE_DELAY" \
--read_placement_delay_lookup ${PLACE_DELAY} \ --read_placement_delay_lookup "$PLACE_DELAY" \
${SDC_OPTIONS} \ $SDC_OPTIONS \
$@ $@
return $? return $?

View File

@ -50,65 +50,55 @@ fi
function parse_args { function parse_args {
eval set -- "$( eval set -- "$(
getopt \ getopt \
--options=d:e:p:n:P:s: \ --options=d:e:p:n:P:s: \
--longoptions=device:,eblif:,pcf:,net:,part:,sdc: \ --longoptions=device:,eblif:,pcf:,net:,part:,sdc: \
--name $0 -- "$@" --name $0 -- "$@"
)" )"
DEVICE=''
DEVICE='' DEVICE_NAME=''
DEVICE_NAME='' PART=''
PART='' EBLIF=''
EBLIF='' PCF=''
PCF='' NET=''
NET='' SDC=''
SDC='' ADDITIONAL_VPR_OPTIONS=''
ADDITIONAL_VPR_OPTIONS='' while true; do
case "$1" in
while true; do -d|--device) DEVICE=$2; shift 2 ;;
case "$1" in -e|--eblif) EBLIF=$2; shift 2 ;;
-d|--device) DEVICE=$2; shift 2 ;; -p|--pcf) PCF=$2; shift 2 ;;
-e|--eblif) EBLIF=$2; shift 2 ;; -n|--net) NET=$2; shift 2 ;;
-p|--pcf) PCF=$2; shift 2 ;; -P|--part) PART=$2; shift 2 ;;
-n|--net) NET=$2; shift 2 ;; -s|--sdc) SDC=$2; shift 2 ;;
-P|--part) PART=$2; shift 2 ;; --) shift; ADDITIONAL_VPR_OPTIONS="$@"; break ;;
-s|--sdc) SDC=$2; shift 2 ;; esac
--) shift; ADDITIONAL_VPR_OPTIONS="$@"; break ;; done
esac
done
if [ -z $DEVICE ] && [ -n $PART ]; then if [ -z $DEVICE ] && [ -n $PART ]; then
# Try to find device name. Accept only when exactly one is found # Try to find device name. Accept only when exactly one is found
PART_DIRS=(${SHARE_DIR_PATH}/arch/*/${PART}) PART_DIRS=(${SHARE_DIR_PATH}/arch/*/${PART})
if [ ${#PART_DIRS[@]} -eq 1 ]; then if [ ${#PART_DIRS[@]} -eq 1 ]; then DEVICE=$(basename $(dirname "${PART_DIRS[0]}")); fi
DEVICE=$(basename $(dirname "${PART_DIRS[0]}"))
fi
fi
if [ -z $DEVICE ]; then
echo "Please provide device name"
exit 1
fi fi
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
if [ -z $EBLIF ]; then echo "Please provide blif file name"; exit 1; fi
if [ -z $EBLIF ]; then export DEVICE="$DEVICE"
echo "Please provide blif file name" export EBLIF="$EBLIF"
exit 1 export PCF="$PCF"
fi export NET="$NET"
export SDC="$SDC"
export DEVICE=$DEVICE
export EBLIF=$EBLIF
export PCF=$PCF
export NET=$NET
export SDC=$SDC
export VPR_OPTIONS="$VPR_OPTIONS $ADDITIONAL_VPR_OPTIONS" export VPR_OPTIONS="$VPR_OPTIONS $ADDITIONAL_VPR_OPTIONS"
export ARCH_DIR=`realpath ${SHARE_DIR_PATH}/arch/$DEVICE` export ARCH_DIR=`realpath ${SHARE_DIR_PATH}/arch/$DEVICE`
export ARCH_DEF=${ARCH_DIR}/arch.timing.xml export ARCH_DEF="${ARCH_DIR}"/arch.timing.xml
export LOOKAHEAD=${ARCH_DIR}/rr_graph_${DEVICE}.lookahead.bin ARCH_RR_PREFIX="${ARCH_DIR}/rr_graph_${DEVICE}"
export RR_GRAPH=${ARCH_DIR}/rr_graph_${DEVICE}.rr_graph.real.bin export LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin
export RR_GRAPH_XML=${ARCH_DIR}/rr_graph_${DEVICE}.rr_graph.real.xml export RR_GRAPH="${ARCH_RR_PREFIX}".rr_graph.real.bin
export PLACE_DELAY=${ARCH_DIR}/rr_graph_${DEVICE}.place_delay.bin export RR_GRAPH_XML="${ARCH_RR_PREFIX}".rr_graph.real.xml
export DEVICE_NAME=`echo $DEVICE | sed -n 's/_/-/p'` export PLACE_DELAY="${ARCH_RR_PREFIX}".place_delay.bin
export DEVICE_NAME=`echo "$DEVICE" | sed -n 's/_/-/p'`
} }
function run_vpr { function run_vpr {
@ -120,15 +110,15 @@ function run_vpr {
SDC_OPTIONS="--sdc_file $SDC" SDC_OPTIONS="--sdc_file $SDC"
fi fi
vpr ${ARCH_DEF} \ vpr "$ARCH_DEF" \
${EBLIF} \ "$EBLIF" \
--device ${DEVICE_NAME} \ --device "$DEVICE_NAME" \
${VPR_OPTIONS} \ $VPR_OPTIONS \
--read_rr_graph ${RR_GRAPH} \ --read_rr_graph "$RR_GRAPH" \
--read_router_lookahead ${LOOKAHEAD} \ --read_router_lookahead "$LOOKAHEAD" \
--read_placement_delay_lookup ${PLACE_DELAY} \ --read_placement_delay_lookup "$PLACE_DELAY" \
${SDC_OPTIONS} \ $SDC_OPTIONS \
$@ $@
return $? return $?
} }