f4pga/wrappers/sh: convert genfasm.f4pga.sh into a Python function

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-08-10 20:09:41 +02:00
parent 20b64d9506
commit e6fa4ebf28
5 changed files with 37 additions and 26 deletions

View File

@ -92,7 +92,6 @@ setuptools_setup(
'platforms/*.json'
],
'f4pga.wrappers.sh': [
'*.f4pga.sh',
'xc7/*.f4pga.sh',
'quicklogic/*.f4pga.sh'
]

View File

@ -91,6 +91,14 @@ def write_bitstream():
run_sh(ROOT / SH_SUBDIR / "write_bitstream.f4pga.sh")
def genfasm(extra_args):
check_call(f"""
'{which('genfasm')}' ${{ARCH_DEF}} \
${{EBLIF}} --device ${{DEVICE_NAME}} ${{VPR_OPTIONS}} --read_rr_graph ${{RR_GRAPH}} \
{' '.join(extra_args)}
""", env=f4pga_environ, shell=True, executable='/bin/bash')
def write_fasm():
print("[F4PGA] Running (deprecated) write fasm")
run_sh(ROOT / SH_SUBDIR / "write_fasm.f4pga.sh")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2022 F4PGA Authors.
#
@ -15,9 +16,12 @@
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
# Python entrypoints to the shell wrappers moved from arch-defs
set -e
from sys import argv as sys_argv
"`which genfasm`" ${ARCH_DEF} \
${EBLIF} --device ${DEVICE_NAME} ${VPR_OPTIONS} --read_rr_graph ${RR_GRAPH} \
$@
from f4pga.wrappers.sh import genfasm
if __name__ == '__main__':
genfasm(sys_argv[1:])

View File

@ -31,7 +31,7 @@ EBLIF="$EBLIF" \
DEVICE_NAME="$DEVICE_NAME" \
VPR_OPTIONS="$VPR_OPTIONS" \
RR_GRAPH="$RR_GRAPH" \
$(dirname "$0")/../genfasm.f4pga.sh
python3 -m f4pga.wrappers.sh.genfasm
echo "FASM extra: $FASM_EXTRA"
if [ -f $FASM_EXTRA ]; then

View File

@ -31,7 +31,7 @@ EBLIF="$EBLIF" \
DEVICE_NAME="$DEVICE_NAME" \
VPR_OPTIONS="$VPR_OPTIONS" \
RR_GRAPH="$RR_GRAPH" \
$(dirname "$0")/../genfasm.f4pga.sh
python3 -m f4pga.wrappers.sh.genfasm
echo "FASM extra: $FASM_EXTRA"
if [ -f $FASM_EXTRA ]; then