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,23 +1,27 @@
#!/usr/bin/env bash
#
# 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
set -e
"`which genfasm`" ${ARCH_DEF} \
${EBLIF} --device ${DEVICE_NAME} ${VPR_OPTIONS} --read_rr_graph ${RR_GRAPH} \
$@
#!/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
#
# Python entrypoints to the shell wrappers moved from arch-defs
from sys import argv as sys_argv
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