From e0ffd4e0942817a62713b13ba8812ff4b8eb0fba Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Sat, 13 Aug 2022 19:27:03 +0200 Subject: [PATCH] f4pga/wrappers/sh/vpr_common: remove function parse_args Signed-off-by: Unai Martinez-Corral --- f4pga/wrappers/sh/__init__.py | 3 +- f4pga/wrappers/sh/quicklogic/ql.f4pga.sh | 2 - .../sh/quicklogic/vpr_common.f4pga.sh | 192 +++++++++--------- f4pga/wrappers/sh/xc7/vpr_common.f4pga.sh | 100 +++++---- 4 files changed, 144 insertions(+), 153 deletions(-) diff --git a/f4pga/wrappers/sh/__init__.py b/f4pga/wrappers/sh/__init__.py index e80ea51..8ed200d 100644 --- a/f4pga/wrappers/sh/__init__.py +++ b/f4pga/wrappers/sh/__init__.py @@ -69,8 +69,7 @@ def p_run_pym(module): def p_vpr_common_cmds(log_suffix = None): return f""" set -e -source {ROOT / SH_SUBDIR}/vpr_common.f4pga.sh -parse_args {' '.join([f"'{arg}'" for arg in sys_argv[1:]])} +source {ROOT / SH_SUBDIR}/vpr_common.f4pga.sh {' '.join([f"'{arg}'" for arg in sys_argv[1:]])} """ + (f""" export OUT_NOISY_WARNINGS=noisy_warnings-${{DEVICE}}_{log_suffix}.log """ if log_suffix is not None else '') diff --git a/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh b/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh index f30f915..cbbcb8b 100755 --- a/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh @@ -18,8 +18,6 @@ set -e -source $(dirname "$0")/vpr_common.f4pga.sh - VERSION="v2.0.1" if [ ! -n $1 ]; then diff --git a/f4pga/wrappers/sh/quicklogic/vpr_common.f4pga.sh b/f4pga/wrappers/sh/quicklogic/vpr_common.f4pga.sh index 7b792a6..4e06f2d 100755 --- a/f4pga/wrappers/sh/quicklogic/vpr_common.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/vpr_common.f4pga.sh @@ -16,6 +16,51 @@ # # SPDX-License-Identifier: Apache-2.0 +eval set -- $( + getopt \ + --options=d:f:e:p:n:P:j:s:t:c: \ + --longoptions=device:,eblif:,pcf:,net:,part:,json:,sdc:,top:,corner: \ + --name $0 -- $@ +) +DEVICE="" +FAMILY="" +EBLIF="" +PCF="" +NET="" +PART="" +JSON="" +SDC="" +TOP="top" +CORNER="" +while true; do + case "$1" in + -d|--device) DEVICE=$2; shift 2 ;; + -f|--family) FAMILY=$2; shift 2 ;; + -e|--eblif) EBLIF=$2; shift 2 ;; + -p|--pcf) PCF=$2; shift 2 ;; + -n|--net) NET=$2; shift 2 ;; + -P|--part) PART=$2; shift 2 ;; + -j|--json) JSON=$2; shift 2 ;; + -s|--sdc) SDC=$2; shift 2 ;; + -t|--top) TOP=$2; shift 2 ;; + -c|--corner) CORNER=$2; shift 2 ;; + --) break ;; + esac +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 + +export DEVICE="$DEVICE" +export FAMILY="$FAMILY" +export EBLIF="$EBLIF" +export PCF="$PCF" +export NET="$NET" +export JSON="$JSON" +export SDC="$SDC" +export TOP="$TOP" +export CORNER="$CORNER" + if [ -z $VPR_OPTIONS ]; then echo "Using default VPR options." VPR_OPTIONS=" @@ -26,105 +71,56 @@ if [ -z $VPR_OPTIONS ]; then " fi -function parse_args { +VPR_OPTIONS="$VPR_OPTIONS + --place_delay_model delta_override + --router_lookahead extended_map + --allow_dangling_combinational_nodes on" - eval set -- $( - getopt \ - --options=d:f:e:p:n:P:j:s:t:c: \ - --longoptions=device:,eblif:,pcf:,net:,part:,json:,sdc:,top:,corner: \ - --name $0 -- $@ - ) - DEVICE="" - FAMILY="" - EBLIF="" - PCF="" - NET="" - PART="" - JSON="" - SDC="" - TOP="top" - CORNER="" - while true; do - case "$1" in - -d|--device) DEVICE=$2; shift 2 ;; - -f|--family) FAMILY=$2; shift 2 ;; - -e|--eblif) EBLIF=$2; shift 2 ;; - -p|--pcf) PCF=$2; shift 2 ;; - -n|--net) NET=$2; shift 2 ;; - -P|--part) PART=$2; shift 2 ;; - -j|--json) JSON=$2; shift 2 ;; - -s|--sdc) SDC=$2; shift 2 ;; - -t|--top) TOP=$2; shift 2 ;; - -c|--corner) CORNER=$2; shift 2 ;; - --) break ;; - esac - 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 [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then + VPR_OPTIONS="$VPR_OPTIONS + --route_chan_width 10 + --clock_modeling ideal + --place_delta_delay_matrix_calculation_method dijkstra + --absorb_buffer_luts off" +else + VPR_OPTIONS="$VPR_OPTIONS + --route_chan_width 100 + --clock_modeling route + --check_route quick + --strict_checks off + --disable_errors check_unbuffered_edges:check_route + --congested_routing_iteration_threshold 0.8 + --incremental_reroute_delay_ripup off + --base_cost_type delay_normalized_length_bounded + --bb_factor 10 + --initial_pres_fac 4.0 + --check_rr_graph off + --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" +fi - export DEVICE="$DEVICE" - export FAMILY="$FAMILY" - export EBLIF="$EBLIF" - export PCF="$PCF" - export NET="$NET" - export JSON="$JSON" - export SDC="$SDC" - export TOP="$TOP" - export CORNER="$CORNER" +export VPR_OPTIONS="$VPR_OPTIONS" - if [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then - VPR_OPTIONS="$VPR_OPTIONS - --route_chan_width 10 - --clock_modeling ideal - --place_delta_delay_matrix_calculation_method dijkstra - --place_delay_model delta_override - --router_lookahead extended_map - --allow_dangling_combinational_nodes on - --absorb_buffer_luts off" - else - VPR_OPTIONS="$VPR_OPTIONS - --route_chan_width 100 - --clock_modeling route - --place_delay_model delta_override - --router_lookahead extended_map - --check_route quick - --strict_checks off - --allow_dangling_combinational_nodes on - --disable_errors check_unbuffered_edges:check_route - --congested_routing_iteration_threshold 0.8 - --incremental_reroute_delay_ripup off - --base_cost_type delay_normalized_length_bounded - --bb_factor 10 - --initial_pres_fac 4.0 - --check_rr_graph off - --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" - 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 - export VPR_OPTIONS="$VPR_OPTIONS" - - 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="${F4PGA_SHARE_DIR}/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 LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin - export DEVICE_NAME="$DEVICE_1" -} +DEVICE_ARCH="${DEVICE_1}_${DEVICE_2}" +export ARCH_DIR="${F4PGA_SHARE_DIR}/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 LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin +export DEVICE_NAME="$DEVICE_1" diff --git a/f4pga/wrappers/sh/xc7/vpr_common.f4pga.sh b/f4pga/wrappers/sh/xc7/vpr_common.f4pga.sh index 3646ed1..2382a7f 100755 --- a/f4pga/wrappers/sh/xc7/vpr_common.f4pga.sh +++ b/f4pga/wrappers/sh/xc7/vpr_common.f4pga.sh @@ -16,6 +16,46 @@ # # SPDX-License-Identifier: Apache-2.0 +eval set -- "$( + getopt \ + --options=d:e:p:n:P:s: \ + --longoptions=device:,eblif:,pcf:,net:,part:,sdc: \ + --name $0 -- "$@" +)" +DEVICE='' +DEVICE_NAME='' +PART='' +EBLIF='' +PCF='' +NET='' +SDC='' +ADDITIONAL_VPR_OPTIONS='' +while true; do + case "$1" in + -d|--device) DEVICE=$2; shift 2 ;; + -e|--eblif) EBLIF=$2; shift 2 ;; + -p|--pcf) PCF=$2; shift 2 ;; + -n|--net) NET=$2; shift 2 ;; + -P|--part) PART=$2; shift 2 ;; + -s|--sdc) SDC=$2; shift 2 ;; + --) shift; ADDITIONAL_VPR_OPTIONS="$@"; break ;; + esac +done + +if [ -z "$DEVICE" ] && [ -n "$PART" ]; then + # Try to find device name. Accept only when exactly one is found + PART_DIRS=(${F4PGA_SHARE_DIR}/arch/*/${PART}) + if [ ${#PART_DIRS[@]} -eq 1 ]; then DEVICE=$(basename $(dirname "${PART_DIRS[0]}")); 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 + +export DEVICE="$DEVICE" +export EBLIF="$EBLIF" +export PCF="$PCF" +export NET="$NET" +export SDC="$SDC" + if [ -z "$VPR_OPTIONS" ]; then echo "Using default VPR options." VPR_OPTIONS=" @@ -46,55 +86,13 @@ if [ -z "$VPR_OPTIONS" ]; then " fi -function parse_args { +export VPR_OPTIONS="$VPR_OPTIONS $ADDITIONAL_VPR_OPTIONS" - eval set -- "$( - getopt \ - --options=d:e:p:n:P:s: \ - --longoptions=device:,eblif:,pcf:,net:,part:,sdc: \ - --name $0 -- "$@" - )" - DEVICE='' - DEVICE_NAME='' - PART='' - EBLIF='' - PCF='' - NET='' - SDC='' - ADDITIONAL_VPR_OPTIONS='' - while true; do - case "$1" in - -d|--device) DEVICE=$2; shift 2 ;; - -e|--eblif) EBLIF=$2; shift 2 ;; - -p|--pcf) PCF=$2; shift 2 ;; - -n|--net) NET=$2; shift 2 ;; - -P|--part) PART=$2; shift 2 ;; - -s|--sdc) SDC=$2; shift 2 ;; - --) shift; ADDITIONAL_VPR_OPTIONS="$@"; break ;; - esac - done - - if [ -z "$DEVICE" ] && [ -n "$PART" ]; then - # Try to find device name. Accept only when exactly one is found - PART_DIRS=(${F4PGA_SHARE_DIR}/arch/*/${PART}) - if [ ${#PART_DIRS[@]} -eq 1 ]; then DEVICE=$(basename $(dirname "${PART_DIRS[0]}")); 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 - - export DEVICE="$DEVICE" - export EBLIF="$EBLIF" - export PCF="$PCF" - export NET="$NET" - export SDC="$SDC" - export VPR_OPTIONS="$VPR_OPTIONS $ADDITIONAL_VPR_OPTIONS" - - export ARCH_DIR="${F4PGA_SHARE_DIR}/arch/$DEVICE" - export ARCH_DEF="${ARCH_DIR}"/arch.timing.xml - ARCH_RR_PREFIX="${ARCH_DIR}/rr_graph_${DEVICE}" - export RR_GRAPH="${ARCH_RR_PREFIX}".rr_graph.real.bin - export RR_GRAPH_XML="${ARCH_RR_PREFIX}".rr_graph.real.xml - export PLACE_DELAY="${ARCH_RR_PREFIX}".place_delay.bin - export LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin - export DEVICE_NAME=`echo "$DEVICE" | sed -n 's/_/-/p'` -} +export ARCH_DIR="${F4PGA_SHARE_DIR}/arch/$DEVICE" +export ARCH_DEF="${ARCH_DIR}"/arch.timing.xml +ARCH_RR_PREFIX="${ARCH_DIR}/rr_graph_${DEVICE}" +export RR_GRAPH="${ARCH_RR_PREFIX}".rr_graph.real.bin +export RR_GRAPH_XML="${ARCH_RR_PREFIX}".rr_graph.real.xml +export PLACE_DELAY="${ARCH_RR_PREFIX}".place_delay.bin +export LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin +export DEVICE_NAME=`echo "$DEVICE" | sed -n 's/_/-/p'`