f4pga/wrappers/sh/quicklogic: rm generate_bitstream.f4pga.sh

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-08-10 21:40:16 +02:00
parent 45020ee7a6
commit dab5de2d1f
2 changed files with 44 additions and 82 deletions

View File

@ -161,7 +161,50 @@ def repack():
def generate_bitstream():
print("[F4PGA] Running (deprecated) generate_bitstream")
run_sh_script(ROOT / "quicklogic/generate_bitstream.f4pga.sh")
run_bash_cmds(f"""
set -e
eval set -- "$(
getopt \
--options=d:f:r:b:P: \
--longoptions=device:,fasm:,format:,bit:,part: \
--name $0 -- {' '.join(sys_argv[1:])}
)"
DEVICE=""
FASM=""
BIT_FORMAT="4byte"
BIT=""
PART=""
while true; do
case "$1" in
-d|--device) DEVICE=$2; shift 2;;
-f|--fasm) FASM=$2; shift 2;;
-r|--format) BIT_FORMAT=$2; shift 2;;
-b|--bit) BIT=$2; shift 2;;
-P|--part) PART=$2; shift 2;;
--) break;;
esac
done
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
if [ -z $FASM ]; then echo "Please provide an input FASM file name"; exit 1; fi
if [ -z $BIT ]; then echo "Please provide an output bistream file name"; exit 1; fi
if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then
`which qlf_fasm` \
--db-root "${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}/fasm_database/${{DEVICE}}" \
--format "$BIT_FORMAT" \
--assemble \
"$FASM" \
"$BIT"
elif [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then
qlfasm \
--dev-type \
"$DEVICE" \
"$FASM" \
"$BIT"
else
echo "ERROR: Unsupported device '${{DEVICE}}' for bitstream generation"
exit -1
fi
""")
def generate_libfile():

View File

@ -1,81 +0,0 @@
#!/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
OPTS=d:f:r:b:P:
LONGOPTS=device:,fasm:,format:,bit:,part:
PARSED_OPTS=`getopt --options=${OPTS} --longoptions=${LONGOPTS} --name $0 -- "$@"`
eval set -- "${PARSED_OPTS}"
DEVICE=""
FASM=""
BIT=""
BIT_FORMAT="4byte"
PART=""
while true; do
case "$1" in
-d|--device) DEVICE=$2; shift 2;;
-f|--fasm) FASM=$2; shift 2;;
-r|--format) BIT_FORMAT=$2; shift 2;;
-b|--bit) BIT=$2; shift 2;;
-P|--part) PART=$2; shift 2;;
--) break;;
esac
done
if [ -z $DEVICE ]; then
echo "Please provide device name"
exit 1
fi
if [ -z $FASM ]; then
echo "Please provide an input FASM file name"
exit 1
fi
if [ -z $BIT ]; then
echo "Please provide an output bistream file name"
exit 1
fi
if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then
`which qlf_fasm` \
--db-root "${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}/fasm_database/${DEVICE}" \
--format "$BIT_FORMAT" \
--assemble \
"$FASM" \
"$BIT"
elif [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then
qlfasm \
--dev-type \
"$DEVICE" \
"$FASM" \
"$BIT"
else
echo "ERROR: Unsupported device '${DEVICE}' for bitstream generation"
exit -1
fi