f4pga/wrappers/sh: add vpr_run

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-08-11 00:31:49 +02:00
parent 1c94ac60a6
commit 77ea3b96ae
4 changed files with 47 additions and 49 deletions

View File

@ -111,7 +111,7 @@ python3 "${SHARE_DIR_PATH}"/scripts/prjxray_create_place_constraints.py \
def pack():
print("[F4PGA] Running (deprecated) pack")
extra_args = ['--write_block_usage', 'block_usage.json'] if isQuickLogic else []
run_bash_cmds(vpr_common_cmds('pack')+f"run_vpr --pack {' '.join(extra_args)}")
run_bash_cmds(vpr_common_cmds('pack')+f"python3 -m f4pga.wrappers.sh.vpr_run --pack {' '.join(extra_args)}")
Path('vpr_stdout.log').rename('pack.log')
@ -142,7 +142,7 @@ echo "Generating constrains ..."
symbiflow_generate_constraints $EBLIF $NET $PART $DEVICE $ARCH_DEF $PCF
VPR_PLACE_FILE='constraints.place'
"""
place_cmds += 'run_vpr --fix_clusters "${VPR_PLACE_FILE}" --place'
place_cmds += 'python3 -m f4pga.wrappers.sh.vpr_run --fix_clusters "${VPR_PLACE_FILE}" --place'
run_bash_cmds(vpr_common_cmds('place')+place_cmds)
Path('vpr_stdout.log').rename('place.log')
@ -150,7 +150,7 @@ VPR_PLACE_FILE='constraints.place'
def route():
print("[F4PGA] Running (deprecated) route")
extra_args = ['--write_timing_summary', 'timing_summary.json'] if isQuickLogic else []
run_bash_cmds(vpr_common_cmds('pack')+f"run_vpr --route {' '.join(extra_args)}")
run_bash_cmds(vpr_common_cmds('pack')+f"python3 -m f4pga.wrappers.sh.vpr_run --route {' '.join(extra_args)}")
Path('vpr_stdout.log').rename('route.log')
@ -185,6 +185,22 @@ def vpr_common():
run_sh_script(ROOT / SH_SUBDIR / "vpr_common.f4pga.sh")
def vpr_run():
print("[F4PGA] Running (deprecated) vpr run")
run_bash_cmds(f"""
set -e
SDC_OPTIONS=""
if [ ! -z $SDC ]; then SDC_OPTIONS="--sdc_file $SDC"; fi
'{which('vpr')}' "$ARCH_DEF" "$EBLIF" \
--device "$DEVICE_NAME" \
$VPR_OPTIONS \
--read_rr_graph "$RR_GRAPH" \
--read_router_lookahead "$LOOKAHEAD" \
--read_placement_delay_lookup "$PLACE_DELAY" \
$SDC_OPTIONS \
""" + f"{' '.join(sys_argv[1:])}")
# Xilinx only
def write_bitstream():
@ -245,7 +261,7 @@ xcfasm \
def analysis():
print("[F4PGA] Running (deprecated) analysis")
run_bash_cmds(vpr_common_cmds('analysis')+"""
run_vpr \
python3 -m f4pga.wrappers.sh.vpr_run \
--analysis \
--gen_post_synthesis_netlist on \
--gen_post_implementation_merged_netlist on \

View File

@ -104,6 +104,8 @@ function parse_args {
--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 VPR_OPTIONS="$VPR_OPTIONS"
if [[ "$DEVICE" == "qlf_k4n8_qlf_k4n8" ]]; then
DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_${CORNER}"
DEVICE_2="$DEVICE_1"
@ -125,27 +127,6 @@ function parse_args {
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 LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin
export DEVICE_NAME="$DEVICE_1"
}
function run_vpr {
set -e
SDC_OPTIONS=""
if [ ! -z $SDC ]; then
SDC_OPTIONS="--sdc_file $SDC"
fi
"`which vpr`" "$ARCH_DEF" \
${EBLIF} \
--read_rr_graph "$RR_GRAPH" \
--device "$DEVICE_NAME" \
$VPR_OPTIONS \
--read_router_lookahead "$ROUTE_DELAY" \
--read_placement_delay_lookup "$PLACE_DELAY" \
$SDC_OPTIONS \
$@
return $?
}

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2022 F4PGA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
from f4pga.wrappers.sh import vpr_run
if __name__ == '__main__':
vpr_run()

View File

@ -94,31 +94,9 @@ function parse_args {
export ARCH_DIR=`realpath ${SHARE_DIR_PATH}/arch/$DEVICE`
export ARCH_DEF="${ARCH_DIR}"/arch.timing.xml
ARCH_RR_PREFIX="${ARCH_DIR}/rr_graph_${DEVICE}"
export LOOKAHEAD="${ARCH_RR_PREFIX}".lookahead.bin
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'`
}
function run_vpr {
set -e
SDC_OPTIONS=""
if [ ! -z $SDC ]
then
SDC_OPTIONS="--sdc_file $SDC"
fi
vpr "$ARCH_DEF" \
"$EBLIF" \
--device "$DEVICE_NAME" \
$VPR_OPTIONS \
--read_rr_graph "$RR_GRAPH" \
--read_router_lookahead "$LOOKAHEAD" \
--read_placement_delay_lookup "$PLACE_DELAY" \
$SDC_OPTIONS \
$@
return $?
}