diff --git a/f4pga/wrappers/sh/quicklogic/fasm2bels.f4pga.sh b/f4pga/wrappers/sh/quicklogic/fasm2bels.f4pga.sh new file mode 100644 index 0000000..95cf83e --- /dev/null +++ b/f4pga/wrappers/sh/quicklogic/fasm2bels.f4pga.sh @@ -0,0 +1,93 @@ +#!/bin/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 + +MYPATH=`realpath $0` +MYPATH=`dirname ${MYPATH}` + +OPTS=d:P:p:b: +LONGOPTS=device:,part:,pcf:,bit:, + +PARSED_OPTS=`getopt --options=${OPTS} --longoptions=${LONGOPTS} --name $0 -- "$@"` +eval set -- "${PARSED_OPTS}" + +DEVICE="" +PART="" +PCF="" +BIT="" + +while true; do + case "$1" in + -d|--device) + DEVICE=$2 + shift 2 + ;; + -P|--part) + PART=$2 + shift 2 + ;; + -p|--pcf) + PCF=$2 + shift 2 + ;; + -b|--bit) + BIT=$2 + shift 2 + ;; + --) + break + ;; + esac +done + +if [ -z $DEVICE ]; then + echo "Please provide device name" + exit 1 +fi + +if [ -z $BIT ]; then + echo "Please provide an input bistream file name" + exit 1 +fi + + +# Run fasm2bels +if [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then + + VPR_DB=`readlink -f ${MYPATH}/../share/symbiflow/arch/${DEVICE}_wlcsp/db_phy.pickle` + FASM2BELS=`readlink -f ${MYPATH}/../bin/python/fasm2bels.py` + FASM2BELS_DEVICE=${DEVICE/ql-/} + VERILOG_FILE="${BIT}.v" + PCF_FILE="${BIT}.v.pcf" + QCF_FILE="${BIT}.v.qcf" + + if [ ! -z "{PCF}" ]; then + PCF_ARGS="--input-pcf ${PCF}" + else + PCF_ARGS="" + fi + + echo "Running fasm2bels" + python3 ${FASM2BELS} ${BIT} --phy-db ${VPR_DB} --package-name ${PART} --input-type bitstream --output-verilog ${VERILOG_FILE} ${PCF_ARGS} --output-pcf ${PCF_FILE} --output-qcf ${QCF_FILE} + +else + + echo "ERROR: Unsupported device '${DEVICE}' for fasm2bels" + exit -1 +fi diff --git a/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh b/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh index a899be9..274c162 100755 --- a/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh @@ -18,8 +18,8 @@ set -e -OPTS=d:f:r:b: -LONGOPTS=device:,fasm:,format:,bit: +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}" @@ -28,6 +28,7 @@ DEVICE="" FASM="" BIT="" BIT_FORMAT="4byte" +PART="" while true; do case "$1" in @@ -35,6 +36,7 @@ while true; do -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 @@ -56,4 +58,14 @@ fi DB_ROOT="$F4PGA_ENV_SHARE"/fasm_database/${DEVICE} -`which qlf_fasm` --db-root ${DB_ROOT} --format ${BIT_FORMAT} --assemble $FASM $BIT +# qlf +if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then + QLF_FASM=`which qlf_fasm` + DB_ROOT=`realpath ${MYPATH}/../share/symbiflow/fasm_database/${DEVICE}` + ${QLF_FASM} --db-root ${DB_ROOT} --format ${BIT_FORMAT} --assemble $FASM $BIT +elif [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then + qlfasm ${FASM} ${BIT} +else + echo "ERROR: Unsupported device '${DEVICE}' for bitstream generation" + exit -1 +fi diff --git a/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh b/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh index 777acf7..370906b 100755 --- a/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh @@ -26,27 +26,71 @@ DEVICE=$5 ARCH_DEF=$6 CORNER=$7 -if [[ "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]];then - DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_$CORNER" - PINMAPXML="pinmap_qlf_k4n8_umc22.xml" -elif [[ "$DEVICE" =~ ^(qlf_k6n10_qlf_k6n10)$ ]];then - DEVICE_1="qlf_k6n10-qlf_k6n10_gf12" - PINMAPXML="pinmap_qlf_k6n10_gf12.xml" -else - DEVICE_1=${DEVICE} -fi - -SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_ENV_SHARE"} - -PINMAP_XML=`realpath ${SHARE_DIR_PATH}/arch/${DEVICE_1}_${DEVICE_1}/${PINMAPXML}` - PROJECT=$(basename -- "$EBLIF") IOPLACE_FILE="${PROJECT%.*}_io.place" -python3 $(realpath "$F4PGA_ENV_BIN"/python/create_ioplace.py) \ - --pcf $PCF \ - --blif $EBLIF \ - --pinmap_xml $PINMAP_XML \ - --csv_file $PART \ - --net $NET \ - > ${IOPLACE_FILE} +if [[ "$DEVICE" =~ ^(qlf_.*)$ ]]; then + if [[ "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]];then + DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_$CORNER" + DEVICE_2=${DEVICE_1} + PINMAPXML="pinmap_qlf_k4n8_umc22.xml" + elif [[ "$DEVICE" =~ ^(qlf_k6n10_qlf_k6n10)$ ]];then + DEVICE_1="qlf_k6n10-qlf_k6n10_gf12" + DEVICE_2=${DEVICE_1} + PINMAPXML="pinmap_qlf_k6n10_gf12.xml" + else + echo "ERROR: Unknown qlf device '${DEVICE}'" + exit -1 + fi + + SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_ENV_SHARE"} + PINMAP_XML=`realpath ${SHARE_DIR_PATH}/arch/${DEVICE_1}_${DEVICE_1}/${PINMAPXML}` + IOGEN=`realpath ${MYPATH}/python/qlf_k4n8_create_ioplace.py` + + python3 ${IOGEN} --pcf $PCF --blif $EBLIF --pinmap_xml $PINMAP_XML --csv_file $PART --net $NET > ${IOPLACE_FILE} + +elif [[ "$DEVICE" =~ ^(ql-.*)$ ]]; then + DEVICE_1=${DEVICE} + DEVICE_2="wlcsp" + + if ! [[ "$PART" =~ ^(PU64|WR42|PD64|WD30)$ ]]; then + PINMAPCSV="pinmap_PD64.csv" + CLKMAPCSV="clkmap_PD64.csv" + else + PINMAPCSV="pinmap_${PART}.csv" + CLKMAPCSV="clkmap_${PART}.csv" + fi + + echo "PINMAP FILE : $PINMAPCSV" + echo "CLKMAP FILE : $CLKMAPCSV" + + SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_ENV_SHARE"} + PINMAP=`realpath ${SHARE_DIR_PATH}/arch/${DEVICE_1}_${DEVICE_2}/${PINMAPCSV}` + CLKMAP=`realpath ${SHARE_DIR_PATH}/arch/${DEVICE_1}_${DEVICE_2}/${CLKMAPCSV}` + + IOGEN=`realpath ${MYPATH}/python/pp3_create_ioplace.py` + PLACEGEN=`realpath ${MYPATH}/python/pp3_create_place_constraints.py` + + PLACE_FILE="${PROJECT%.*}_constraints.place" + + python3 ${IOGEN} --pcf $PCF --blif $EBLIF --map $PINMAP --net $NET > ${IOPLACE_FILE} + python3 ${PLACEGEN} --blif $EBLIF --map $CLKMAP -i ${IOPLACE_FILE} > ${PLACE_FILE} + + # EOS-S3 IOMUX configuration + if [[ "$DEVICE" =~ ^(ql-eos-s3)$ ]]; then + + IOMUXGEN=`realpath ${MYPATH}/python/pp3_eos_s3_iomux_config.py` + + IOMUX_JLINK="${PROJECT%.*}_iomux.jlink" + IOMUX_OPENOCD="${PROJECT%.*}_iomux.openocd" + IOMUX_BINARY="${PROJECT%.*}_iomux.bin" + + python3 ${IOMUXGEN} --eblif $EBLIF --pcf $PCF --map $PINMAP --output-format=jlink > ${IOMUX_JLINK} + python3 ${IOMUXGEN} --eblif $EBLIF --pcf $PCF --map $PINMAP --output-format=openocd > ${IOMUX_OPENOCD} + python3 ${IOMUXGEN} --eblif $EBLIF --pcf $PCF --map $PINMAP --output-format=binary > ${IOMUX_BINARY} + fi + +else + echo "FIXME: Unsupported device '${DEVICE}'" + exit -1 +fi diff --git a/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh b/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh index 1bfee36..24213ab 100755 --- a/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh @@ -18,8 +18,6 @@ set -e -BUILDDIR=build - SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_ENV_SHARE"} source $(dirname "$0")/vpr_common.f4pga.sh @@ -28,7 +26,7 @@ VERSION="v2.0.1" if [ ! -n $1 ]; then echo "Please enter a valid command: Refer help ql_symbiflow --help" - exit 0 + exit 1 elif [[ $1 == "-synth" || $1 == "-compile" ]]; then echo -e "----------------- \n" elif [[ $1 == "-h" || $1 == "--help" ]];then @@ -37,13 +35,14 @@ elif [[ $1 == "-h" || $1 == "--help" ]];then \t>ql_symbiflow -synth -src -d -P -t -v -p \n\ To run synthesis, pack, place and route:\n\ \t>ql_symbiflow -compile -src -d -P -t -v -p -P -s \n\ -Device supported:qlf_k4n8" || exit +Devices supported: ql-eos-s3, qlf_k4n8 \n\ +Support temporarily disabled for: ql-pp3, qlf_k6n10" || exit elif [[ $1 == "-v" || $1 == "--version" ]];then echo "Symbiflow Tool Version : ${VERSION}" - exit + exit 0 else echo -e "Please provide a valid command : Refer -h/--help\n" - exit + exit 1 fi @@ -63,8 +62,11 @@ JSON="" PNR_CORNER="slow" ANALYSIS_CORNER="slow" COMPILE_EXTRA_ARGS=() - +BUILDDIR="build" +DEVICE_CHECK="INVALID" OPT="" +RUN_TILL="" + for arg in $@; do case $arg in -src|--source) OPT="src" ;; @@ -82,6 +84,7 @@ for arg in $@; do -synth|-compile) OPT="synth" ;; -y|+incdir+*|+libext+*|+define+*) OPT="compile_xtra" ;; -f) OPT="options_file" ;; + -build_dir) OPT="build_dir" ;; -h|--help) exit 0 ;; *) case $OPT in @@ -137,6 +140,10 @@ for arg in $@; do options_file) COMPILE_EXTRA_ARGS+=("-f \"`realpath $arg`\" ") ;; + build_dir) + BUILDDIR=$arg + OPT="" + ;; *) echo "Refer help for more details: ql_symbiflow -h " exit 1 @@ -153,10 +160,20 @@ case ${DEVICE} in qlf_k4n8) DEVICE="${DEVICE}_${DEVICE}" FAMILY="qlf_k4n8" + DEVICE_CHECK="VALID" + USE_PINMAP=1 + ;; + qlf_k6n10) + DEVICE="${DEVICE}_${DEVICE}" + FAMILY="qlf_k6n10" + DEVICE_CHECK="VALID" + USE_PINMAP=1 ;; ql-eos-s3) DEVICE="${DEVICE}" FAMILY="pp3" + DEVICE_CHECK="VALID" + USE_PINMAP=0 ;; *) echo "Unsupported device '${DEVICE}'" @@ -183,7 +200,7 @@ else if [ -f $SOURCE/v_list_tmp ];then rm -f $SOURCE/v_list_tmp fi - if [ $VERILOG_FILES == "*.v" ];then + if [ "$VERILOG_FILES" == "*.v" ];then VERILOG_FILES=`cd ${SOURCE};ls *.v` fi echo "$VERILOG_FILES" >${SOURCE}/v_list @@ -204,30 +221,21 @@ else fi if [[ $1 == "-compile" || $1 == "-post_verilog" ]]; then - # Allow no PCF/pinmap for some devices - if [[ ! "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]]; then - if [ -z "$PCF" ]; then - echo "PCF file option is missing. Refer -h/--help" - exit 1 - elif ! [ -f "$SOURCE/$PCF" ]; then - echo "The pcf file: $PCF is missing at: $SOURCE" - exit 1 - fi - fi if [ -z "$DEVICE" ]; then echo "DEVICE name is missing. Refer -h/--help" exit 1 - elif ! [[ "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]]; then - echo "Invalid Device name, supported qlf_k4n8" + elif ! [[ "$DEVICE_CHECK" =~ ^(VALID)$ ]]; then + echo "Invalid Device name, supported: ql-eos-s3, qlf_k4n8 \n\ + Support temporarily disabled for: qlf_k6n10" exit 1 fi if [ -z "$TOP" ]; then echo "TOP module name is missing. Refer -h/--help" exit 1 fi - if [[ "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]]; then + if [[ "$DEVICE_CHECK" =~ ^(VALID)$ ]]; then if [ -z "$PART" ]; then - if [ -n "$PCF" ];then + if [[ -n "$PCF" && $USE_PINMAP -ne 0 ]]; then echo "Error: pcf file cannot be used without declaring PINMAP CSV file" exit 1 fi @@ -274,12 +282,19 @@ if [ -f "$SOURCE/v_list_tmp" ]; then fi # FIXME: Some devices do not have fasm2bels yet +# FIXME: Some device do not support bitstream generation yet RUN_TILL="" if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then HAVE_FASM2BELS=0 RUN_TILL="bit" -else +elif [[ "$DEVICE" =~ ^(qlf_k6n10.*)$ ]]; then + HAVE_FASM2BELS=0 + RUN_TILL="route" +elif [[ "$DEVICE" =~ ^(ql-eos-s3)$ ]]; then HAVE_FASM2BELS=1 + RUN_TILL="bit" +else + HAVE_FASM2BELS=0 RUN_TILL="route" fi @@ -292,7 +307,6 @@ fi export PCF_FILE=$PCF export JSON=$JSON -export TOP_F=$TOP export PINMAP_FILE=$PINMAPCSV export MAX_CRITICALITY=$MAX_CRITICALITY @@ -304,7 +318,7 @@ else CURR_DIR="${PWD}/${SOURCE}" fi -if [ -n "$PART" ]; then +if [[ -n "$PART" && $USE_PINMAP -ne 0 ]]; then if [[ -f $SOURCE/$PART ]];then CSV_PATH=`realpath $SOURCE/$PART` elif [[ -f $PART ]];then @@ -329,7 +343,11 @@ elif [[ -f $PCF ]];then PCF_PATH=`realpath $PCF` fi -export PART=${CSV_PATH} +if [[ $USE_PINMAP -ne 0 ]]; then + export PART=${CSV_PATH} +else + export PART=${PART} +fi export JSON=${JSON_PATH} export PCF_PATH=${PCF_PATH} @@ -339,8 +357,8 @@ LOG_FILE=${CURR_DIR}/${BUILDDIR}/${TOP}.log if [ -f "$SOURCE"/$PCF_FILE ];then PCF_MAKE="\${current_dir}/$PCF_FILE" else - touch ${CURR_DIR}/build/${TOP}_dummy.pcf - PCF_MAKE="\${current_dir}/build/${TOP}_dummy.pcf" + touch ${CURR_DIR}/${BUILDDIR}/${TOP}_dummy.pcf + PCF_MAKE="\${current_dir}/${BUILDDIR}/${TOP}_dummy.pcf" fi PROCESS_SDC=$(realpath "$F4PGA_ENV_BIN"/python/process_sdc_constraints.py) @@ -352,15 +370,15 @@ if ! [ -z "$SDC" ]; then SDC_MAKE="$SOURCE/$SDC" fi else - touch ${CURR_DIR}/build/${TOP}_dummy.sdc - SDC_MAKE="\${current_dir}/build/${TOP}_dummy.sdc" + touch ${CURR_DIR}/${BUILDDIR}/${TOP}_dummy.sdc + SDC_MAKE="\${current_dir}/${BUILDDIR}/${TOP}_dummy.sdc" fi if ! [ -z "$CSV_PATH" ]; then CSV_MAKE=$CSV_PATH else - touch ${CURR_DIR}/build/${TOP}_dummy.csv - CSV_MAKE="\${current_dir}/build/${TOP}_dummy.csv" + touch ${CURR_DIR}/${BUILDDIR}/${TOP}_dummy.csv + CSV_MAKE="\${current_dir}/${BUILDDIR}/${TOP}_dummy.csv" fi echo -e ".PHONY:\${BUILDDIR}\n @@ -377,7 +395,7 @@ PNR_CORNER := $ANALYSIS_CORNER\n\ PCF := $PCF_MAKE\n\ PINMAP_CSV := $CSV_MAKE\n\ SDC_IN := $SDC_MAKE\n\ -BUILDDIR := build\n\n\ +BUILDDIR := $BUILDDIR\n\n\ SDC := \${current_dir}/\${BUILDDIR}/\${TOP}.sdc all: \${BUILDDIR}/\${TOP}.${RUN_TILL}\n\ @@ -386,10 +404,11 @@ all: \${BUILDDIR}/\${TOP}.${RUN_TILL}\n\ ifneq (\"\$(wildcard \$(HEX_FILES))\",\"\")\n\ \$(shell cp \${current_dir}/*.hex \${BUILDDIR})\n\ endif\n\ - cd \${BUILDDIR} && symbiflow_synth -t \${TOP} -v \${VERILOG} -F \${FAMILY} -d \${DEVICE} -p \${PCF} ${COMPILE_EXTRA_ARGS[*]} > $LOG_FILE 2>&1\n\ + cd \${BUILDDIR} && symbiflow_synth -t \${TOP} -v \${VERILOG} -F \${FAMILY} -d \${DEVICE} -p \${PCF} -P \${PART} ${COMPILE_EXTRA_ARGS[*]} > $LOG_FILE 2>&1\n\ \n\ \${BUILDDIR}/\${TOP}.sdc: \${BUILDDIR}/\${TOP}.eblif\n\ python3 ${PROCESS_SDC} --sdc-in \${SDC_IN} --sdc-out \$@ --pcf \${PCF} --eblif \${BUILDDIR}/\${TOP}.eblif --pin-map \${PINMAP_CSV}\n\ +\n\ \${BUILDDIR}/\${TOP}.net: \${BUILDDIR}/\${TOP}.eblif \${BUILDDIR}/\${TOP}.sdc\n\ cd \${BUILDDIR} && symbiflow_pack -e \${TOP}.eblif -f \${FAMILY} -d \${DEVICE} -s \${SDC} -c \${PNR_CORNER} >> $LOG_FILE 2>&1\n\ \n\ @@ -420,7 +439,11 @@ fi \n\ \${BUILDDIR}/\${TOP}.fasm: \${BUILDDIR}/\${TOP_FINAL}.route\n\ cd \${BUILDDIR} && symbiflow_write_fasm -e \${TOP_FINAL}.eblif -f \${FAMILY} -d \${DEVICE} -s \${SDC} -c \${PNR_CORNER} >> $LOG_FILE 2>&1\n\ -\n\ + " >>$MAKE_FILE + +# Bitstream +if [ "$FAMILY" == "qlf_k4n8" ]; then + echo -e "\ \${BUILDDIR}/\${TOP}.bit: \${BUILDDIR}/\${TOP}.fasm\n\ cd \${BUILDDIR} && symbiflow_generate_bitstream -d \${FAMILY} -f \${TOP}.fasm -r 4byte -b \${TOP}.bit >> $LOG_FILE 2>&1\n\ cd \${BUILDDIR} && symbiflow_generate_bitstream -d \${FAMILY} -f \${TOP}.fasm -r txt -b \${TOP}.bin >> $LOG_FILE 2>&1\n\ @@ -429,16 +452,43 @@ fi cd \${BUILDDIR} && symbiflow_generate_libfile \${PARTNAME} \${DEVICE} \${PNR_CORNER} >> $LOG_FILE 2>&1\n\ " >>$MAKE_FILE +elif [ "$FAMILY" == "pp3" ]; then + echo -e "\ +\${BUILDDIR}/\${TOP}.bit: \${BUILDDIR}/\${TOP}.fasm\n\ + cd \${BUILDDIR} && symbiflow_generate_bitstream -d \${DEVICE} -f \${TOP}.fasm -P \${PARTNAME} -b \${TOP}.bit >> $LOG_FILE 2>&1\n\ + " >>$MAKE_FILE +fi + +# EOS-S3 specific targets +if [ "$DEVICE" == "ql-eos-s3" ]; then + echo -e "\ +\${BUILDDIR}/\${TOP}_bit.h: \${BUILDDIR}/\${TOP}.bit\n\ + symbiflow_write_bitheader \$^ \$@ >> $LOG_FILE 2>&1\n\ +\n\ +\${BUILDDIR}/\${TOP}.bin: \${BUILDDIR}/\${TOP}.bit\n\ + symbiflow_write_binary \$^ \$@ >> $LOG_FILE 2>&1\n\ +\n\ +\${BUILDDIR}/\${TOP}.jlink: \${BUILDDIR}/\${TOP}.bit\n\ + symbiflow_write_jlink \$^ \$@ >> $LOG_FILE 2>&1\n\ +\n\ +\${BUILDDIR}/\${TOP}.openocd: \${BUILDDIR}/\${TOP}.bit\n\ + symbiflow_write_openocd \$^ \$@ >> $LOG_FILE 2>&1\n\ +\n\ + " >>$MAKE_FILE +fi + +# fasm2bels if [ "$HAVE_FASM2BELS" != 0 ]; then echo -e "\ - cd \${BUILDDIR} && symbiflow_write_fasm2bels -e \${TOP}.eblif -d \${DEVICE} -p \${PCF} -n \${TOP}.net -P \${PARTNAME}\n\ +\${BUILDDIR}/\${TOP}.bit.v: \${BUILDDIR}/\${TOP}.bit\n\ + cd \${BUILDDIR} && symbiflow_fasm2bels -b \${TOP}.bit -d \${DEVICE} -p \${PCF} -P \${PARTNAME} >> $LOG_FILE 2>&1\n\ " >>$MAKE_FILE fi echo -e "\ clean:\n\ rm -rf \${BUILDDIR}\n\ -" >>$MAKE_FILE + " >>$MAKE_FILE ## Remove temporary files rm -f $SOURCE/f_list_temp $SOURCE/v_list_tmp $SOURCE/v_list @@ -446,14 +496,31 @@ rm -f $SOURCE/f_list_temp $SOURCE/v_list_tmp $SOURCE/v_list ## Make file Targets if [ $1 == "-synth" ]; then echo -e "Performing Synthesis " - cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.eblif || exit + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.eblif || (cat $LOG_FILE && exit 1) elif [[ ! -z "$OUT" && $1 == "-compile" ]];then if [[ " ${OUT_ARR[@]} " =~ " post_verilog " ]];then - cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.post_v || exit + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.post_v || (cat $LOG_FILE && exit 1) + fi + if [ "$DEVICE" == "ql-eos-s3" ]; then + if [[ " ${OUT_ARR[@]} " =~ " jlink " ]]; then + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.jlink || (cat $LOG_FILE && exit 1) + fi + if [[ " ${OUT_ARR[@]} " =~ " openocd " ]]; then + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.openocd || (cat $LOG_FILE && exit 1) + fi + if [[ " ${OUT_ARR[@]} " =~ " post_verilog " ]]; then + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.bit.v || (cat $LOG_FILE && exit 1) + fi + if [[ " ${OUT_ARR[@]} " =~ " header " ]]; then + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}_bit.h || (cat $LOG_FILE && exit 1) + fi + if [[ " ${OUT_ARR[@]} " =~ " binary " ]]; then + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.bin || (cat $LOG_FILE && exit 1) + fi fi else if [ $1 == "-compile" ]; then echo -e "Running Synth->Pack->Place->Route->FASM->bitstream" - cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.${RUN_TILL} || exit + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.${RUN_TILL} || (cat $LOG_FILE && exit 1) fi fi diff --git a/f4pga/wrappers/sh/quicklogic/write_binary.f4pga.sh b/f4pga/wrappers/sh/quicklogic/write_binary.f4pga.sh new file mode 100644 index 0000000..4bb036c --- /dev/null +++ b/f4pga/wrappers/sh/quicklogic/write_binary.f4pga.sh @@ -0,0 +1,30 @@ +#!/bin/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 + +PYTHON3=`which python3` + +MYPATH=$(dirname "$(readlink -f "$BASH_SOURCE")") + +source ${MYPATH}/env + +BIT2BINARY="${PYTHON3} -m quicklogic_fasm.bitstream_to_binary" + +echo "Converting bitstream to flashable binary format" +${BIT2BINARY} $@ diff --git a/f4pga/wrappers/sh/quicklogic/write_bitheader.f4pga.sh b/f4pga/wrappers/sh/quicklogic/write_bitheader.f4pga.sh new file mode 100644 index 0000000..f3f0999 --- /dev/null +++ b/f4pga/wrappers/sh/quicklogic/write_bitheader.f4pga.sh @@ -0,0 +1,30 @@ +#!/bin/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 + +PYTHON3=`which python3` + +MYPATH=$(dirname "$(readlink -f "$BASH_SOURCE")") + +source ${MYPATH}/env + +BIT2HEADER="${PYTHON3} -m quicklogic_fasm.bitstream_to_header" + +echo "Converting bitstream to C Header" +${BIT2HEADER} $@ diff --git a/f4pga/wrappers/sh/quicklogic/write_jlink.f4pga.sh b/f4pga/wrappers/sh/quicklogic/write_jlink.f4pga.sh new file mode 100644 index 0000000..040bfbe --- /dev/null +++ b/f4pga/wrappers/sh/quicklogic/write_jlink.f4pga.sh @@ -0,0 +1,30 @@ +#!/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 + +PYTHON3=`which python3` + +MYPATH=$(dirname "$(readlink -f "$BASH_SOURCE")") + +source ${MYPATH}/env + +BIT2JLINK="${PYTHON3} -m quicklogic_fasm.bitstream_to_jlink" + +echo "Converting bitstream to JLink script" +${BIT2JLINK} $@ diff --git a/f4pga/wrappers/sh/quicklogic/write_openocd.f4pga.sh b/f4pga/wrappers/sh/quicklogic/write_openocd.f4pga.sh new file mode 100644 index 0000000..38918a7 --- /dev/null +++ b/f4pga/wrappers/sh/quicklogic/write_openocd.f4pga.sh @@ -0,0 +1,30 @@ +#!/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 + +PYTHON3=`which python3` + +MYPATH=$(dirname "$(readlink -f "$BASH_SOURCE")") + +source ${MYPATH}/env + +BIT2OPENOCD="${PYTHON3} -m quicklogic_fasm.bitstream_to_openocd" + +echo "Converting bitstream to OpenOCD script" +${BIT2OPENOCD} $@