diff --git a/f4pga/wrappers/sh/quicklogic/analysis.f4pga.sh b/f4pga/wrappers/sh/quicklogic/analysis.f4pga.sh index 921873f..f88ce6a 100755 --- a/f4pga/wrappers/sh/quicklogic/analysis.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/analysis.f4pga.sh @@ -1,23 +1,22 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +if [ -z $VPRPATH ]; then + export VPRPATH=$(f4pga-env bin) + export PYTHONPATH=${VPRPATH}/python:${VPRPATH}/python/prjxray:${PYTHONPATH} +fi -source ${MYPATH}/env source ${VPRPATH}/vpr_common - parse_args $@ -FIXUP_POST_SYNTHESIS=`realpath ${MYPATH}/python/vpr_fixup_post_synth.py` - export OUT_NOISY_WARNINGS=noisy_warnings-${DEVICE}_analysis.log run_vpr --analysis --gen_post_synthesis_netlist on --verify_file_digests off mv vpr_stdout.log analysis.log -python3 ${FIXUP_POST_SYNTHESIS} \ +python3 $(f4pga-env bin)/python/vpr_fixup_post_synth.py \ --vlog-in ${TOP}_post_synthesis.v \ --vlog-out ${TOP}_post_synthesis.v \ --sdf-in ${TOP}_post_synthesis.sdf \ diff --git a/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh b/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh index ef6347c..8c680ad 100755 --- a/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/generate_bitstream.f4pga.sh @@ -1,8 +1,6 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +set -e OPTS=d:f:r:b: LONGOPTS=device:,fasm:,format:,bit: @@ -16,47 +14,30 @@ BIT="" BIT_FORMAT="4byte" 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 - ;; - --) - break - ;; - esac + 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;; + --) break;; + esac done if [ -z $DEVICE ]; then - echo "Please provide device name" - exit 1 + echo "Please provide device name" + exit 1 fi if [ -z $FASM ]; then - echo "Please provide an input FASM file name" - exit 1 + 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 + echo "Please provide an output bistream file name" + exit 1 fi -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 +DB_ROOT=$(f4pga-env share)/fasm_database/${DEVICE} +`which qlf_fasm` --db-root ${DB_ROOT} --format ${BIT_FORMAT} --assemble $FASM $BIT diff --git a/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh b/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh index 5275d14..a2eb1c4 100755 --- a/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/generate_constraints.f4pga.sh @@ -1,8 +1,6 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +set -e PCF=$1 EBLIF=$2 @@ -13,18 +11,26 @@ 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" + 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" + DEVICE_1="qlf_k6n10-qlf_k6n10_gf12" + PINMAPXML="pinmap_qlf_k6n10_gf12.xml" else - DEVICE_1=${DEVICE} + DEVICE_1=${DEVICE} fi -PINMAP_XML=`realpath ${MYPATH}/../share/symbiflow/arch/${DEVICE_1}_${DEVICE_1}/${PINMAPXML}` -IOGEN=`realpath ${MYPATH}/python/create_ioplace.py` +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 ${IOGEN} --pcf $PCF --blif $EBLIF --pinmap_xml $PINMAP_XML --csv_file $PART --net $NET > ${IOPLACE_FILE} +python3 $(realpath $(f4pga-env bin)/python/create_ioplace.py) \ + --pcf $PCF \ + --blif $EBLIF \ + --pinmap_xml $PINMAP_XML \ + --csv_file $PART \ + --net $NET \ + > ${IOPLACE_FILE} diff --git a/f4pga/wrappers/sh/quicklogic/generate_libfile.f4pga.sh b/f4pga/wrappers/sh/quicklogic/generate_libfile.f4pga.sh index 0144650..b487646 100755 --- a/f4pga/wrappers/sh/quicklogic/generate_libfile.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/generate_libfile.f4pga.sh @@ -1,25 +1,27 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +set -e PART=$1 DEVICE=$2 CORNER=$3 if [[ "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]];then - DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_$CORNER" - PINMAPXML="pinmap_qlf_k4n8_umc22.xml" - INTERFACEXML="interface-mapping_24x24.xml" - DEV="qlf_k4n8_umc22" + DEVICE_1="qlf_k4n8-qlf_k4n8_umc22_$CORNER" + PINMAPXML="pinmap_qlf_k4n8_umc22.xml" + INTERFACEXML="interface-mapping_24x24.xml" + DEV="qlf_k4n8_umc22" else - DEVICE_1=${DEVICE} + DEVICE_1=${DEVICE} fi -ARCH_DIR=`realpath ${MYPATH}/../share/symbiflow/arch/${DEVICE_1}_${DEVICE_1}` -PINMAP_XML=`realpath ${ARCH_DIR}/${PINMAPXML}` -INTF_XML=`realpath ${ARCH_DIR}/lib/${INTERFACEXML}` -CREATE_LIB=`realpath ${MYPATH}/python/create_lib.py` +ARCH_DIR=$(f4pga-env share)/arch/${DEVICE_1}_${DEVICE_1} +PINMAP_XML=${ARCH_DIR}/${PINMAPXML} -python3 ${CREATE_LIB} -n ${DEV}_0P72_SSM40 -m fpga_top -c $PART -x $INTF_XML -l ${DEV}_0P72_SSM40.lib -t ${ARCH_DIR}/lib +python3 $(f4pga-env bin)/python/create_lib.py \ + -n ${DEV}_0P72_SSM40 \ + -m fpga_top \ + -c $PART \ + -x ${ARCH_DIR}/lib/${INTERFACEXML} \ + -l ${DEV}_0P72_SSM40.lib \ + -t ${ARCH_DIR}/lib diff --git a/f4pga/wrappers/sh/quicklogic/pack.f4pga.sh b/f4pga/wrappers/sh/quicklogic/pack.f4pga.sh index 6982aa3..63304de 100755 --- a/f4pga/wrappers/sh/quicklogic/pack.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/pack.f4pga.sh @@ -1,12 +1,13 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +if [ -z $VPRPATH ]; then + export VPRPATH=$(f4pga-env bin) + export PYTHONPATH=${VPRPATH}/python:${VPRPATH}/python/prjxray:${PYTHONPATH} +fi -source ${MYPATH}/env source ${VPRPATH}/vpr_common - parse_args $@ export OUT_NOISY_WARNINGS=noisy_warnings-${DEVICE}_pack.log diff --git a/f4pga/wrappers/sh/quicklogic/place.f4pga.sh b/f4pga/wrappers/sh/quicklogic/place.f4pga.sh index 515cd5d..5819b6c 100755 --- a/f4pga/wrappers/sh/quicklogic/place.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/place.f4pga.sh @@ -1,48 +1,42 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` - -source ${MYPATH}/env -source ${MYPATH}/vpr_common +if [ -z $VPRPATH ]; then + export VPRPATH=$(f4pga-env bin) + export PYTHONPATH=${VPRPATH}/python:${VPRPATH}/python/prjxray:${PYTHONPATH} +fi +source ${VPRPATH}/vpr_common parse_args $@ if [ -z $PCF ]; then - echo "Please provide pcf file name" - exit 1 + echo "Please provide pcf file name" + exit 1 fi if [ -z $NET ]; then - echo "Please provide net file name" - exit 1 + echo "Please provide net file name" + exit 1 fi OUT_NOISY_WARNINGS=noisy_warnings-${DEVICE}_place.log PROJECT=$(basename -- "$EBLIF") +PLACE_FILE="${PROJECT%.*}_constraints.place" -# Generate IO constraints if [ -s $PCF ]; then - echo "Generating constraints ..." - symbiflow_generate_constraints $PCF $EBLIF $NET $PART $DEVICE $ARCH_DEF $CORNER - - IOPLACE_FILE="${PROJECT%.*}_io.place" - PLACE_FILE="${PROJECT%.*}_constraints.place" - - if [ -f ${PLACE_FILE} ]; then - VPR_PLACE_FILE=${PLACE_FILE} - else - VPR_PLACE_FILE=${IOPLACE_FILE} - fi - -# Make a dummy empty constraint file -else - - PLACE_FILE="${PROJECT%.*}_constraints.place" - touch ${PLACE_FILE} + # Generate IO constraints + echo "Generating constraints ..." + symbiflow_generate_constraints $PCF $EBLIF $NET $PART $DEVICE $ARCH_DEF $CORNER + if [ -f ${PLACE_FILE} ]; then VPR_PLACE_FILE=${PLACE_FILE} - + else + VPR_PLACE_FILE="${PROJECT%.*}_io.place" + fi +else + # Make a dummy empty constraint file + touch ${PLACE_FILE} + VPR_PLACE_FILE=${PLACE_FILE} fi run_vpr --fix_clusters ${VPR_PLACE_FILE} --place diff --git a/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh b/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh index 814d639..fb80d4e 100755 --- a/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/ql.f4pga.sh @@ -1,33 +1,31 @@ -#!/bin/bash +#!/usr/bin/env bash set -e - -MYPATH=$(dirname "$(readlink -f "$BASH_SOURCE")") BUILDDIR=build -source ${MYPATH}/env -source ${VPRPATH}/vpr_common +source $(f4pga-env bin)/vpr_common + VERSION="v2.0.1" if [ ! -n $1 ]; then -echo "Please enter a valid command: Refer help ql_symbiflow --help" -exit 0 + echo "Please enter a valid command: Refer help ql_symbiflow --help" + exit 0 elif [[ $1 == "-synth" || $1 == "-compile" ]]; then -echo -e "----------------- \n" + echo -e "----------------- \n" elif [[ $1 == "-h" || $1 == "--help" ]];then -echo -e "\nBelow are the supported commands: \n\ + echo -e "\nBelow are the supported commands: \n\ To synthesize and dump a eblif file:\n\ \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 elif [[ $1 == "-v" || $1 == "--version" ]];then - echo "Symbiflow Tool Version : ${VERSION}" - exit + echo "Symbiflow Tool Version : ${VERSION}" + exit else -echo -e "Please provide a valid command : Refer -h/--help\n" -exit + echo -e "Please provide a valid command : Refer -h/--help\n" + exit fi @@ -50,176 +48,141 @@ COMPILE_EXTRA_ARGS=() OPT="" for arg in $@; do - case $arg in - -src|--source) - OPT="src" - ;; - -t|--top) - OPT="top" - ;; - -v|--verilog) - OPT="vlog" - ;; - -d|--device) - OPT="dev" - ;; - -p|--pcf) - OPT="pcf" - ;; - -P|--part) - OPT="part" - ;; - -j|--json) - OPT="json" - ;; - -s|--sdc) - OPT="sdc" - ;; - -r|--route_type) - OPT="route" - ;; - -pnr_corner) - OPT="pnr_corner" - ;; - -analysis_corner) - OPT="analysis_corner" - ;; - -dump) - OPT="dump" - ;; - -synth|-compile) - OPT="synth" - ;; - -y|+incdir+*|+libext+*|+define+*) - OPT="compile_xtra" - ;; - -f) - OPT="options_file" - ;; - -h|--help) - exit 0 - ;; - *) - case $OPT in - "src") - SOURCE=$arg - OPT="" - ;; - "top") - TOP=$arg - OPT="" - ;; - "vlog") - VERILOG_FILES+="$arg " - ;; - "dev") - DEVICE=$arg - OPT="" - ;; - "pcf") - PCF=$arg - OPT="" - ;; - "part") - PART=$arg - OPT="" - ;; - "json") - JSON=$arg - OPT="" - ;; - "sdc") - SDC=$arg - OPT="" - ;; - "route") - ROUTE_FLAG0="$arg" - ROUTE_FLAG0="${ROUTE_FLAG0,,}" - OPT="" - ;; - "pnr_corner") - PNR_CORNER=$arg - OPT="" - ;; - "analysis_corner") - ANALYSIS_CORNER=$arg - OPT="" - ;; - "dump") - OUT+="$arg " - ;; - "compile_xtra") - ;; - "options_file") - COMPILE_EXTRA_ARGS+=("-f \"`realpath $arg`\" ") - ;; - *) - echo "Refer help for more details: ql_symbiflow -h " - exit 1 - ;; - esac + case $arg in + -src|--source) OPT="src" ;; + -t|--top) OPT="top" ;; + -v|--verilog) OPT="vlog" ;; + -d|--device) OPT="dev" ;; + -p|--pcf) OPT="pcf" ;; + -P|--part) OPT="part" ;; + -j|--json) OPT="json" ;; + -s|--sdc) OPT="sdc" ;; + -r|--route_type) OPT="route" ;; + -pnr_corner) OPT="pnr_corner" ;; + -analysis_corner) OPT="analysis_corner" ;; + -dump) OPT="dump" ;; + -synth|-compile) OPT="synth" ;; + -y|+incdir+*|+libext+*|+define+*) OPT="compile_xtra" ;; + -f) OPT="options_file" ;; + -h|--help) exit 0 ;; + *) + case $OPT in + src) + SOURCE=$arg + OPT="" + ;; + top) + TOP=$arg + OPT="" + ;; + vlog) + VERILOG_FILES+="$arg " + ;; + dev) + DEVICE=$arg + OPT="" + ;; + pcf) + PCF=$arg + OPT="" + ;; + part) + PART=$arg + OPT="" + ;; + json) + JSON=$arg + OPT="" + ;; + sdc) + SDC=$arg + OPT="" + ;; + route) + ROUTE_FLAG0="$arg" + ROUTE_FLAG0="${ROUTE_FLAG0,,}" + OPT="" + ;; + pnr_corner) + PNR_CORNER=$arg + OPT="" + ;; + analysis_corner) + ANALYSIS_CORNER=$arg + OPT="" + ;; + dump) + OUT+="$arg " + ;; + compile_xtra) + ;; + options_file) + COMPILE_EXTRA_ARGS+=("-f \"`realpath $arg`\" ") + ;; + *) + echo "Refer help for more details: ql_symbiflow -h " + exit 1 ;; esac - - if [ "$OPT" == "compile_xtra" ]; then - COMPILE_EXTRA_ARGS+=($arg) - fi - + ;; + esac + if [ "$OPT" == "compile_xtra" ]; then + COMPILE_EXTRA_ARGS+=($arg) + fi done case ${DEVICE} in - qlf_k4n8) - DEVICE="${DEVICE}_${DEVICE}" - FAMILY="qlf_k4n8" - ;; - ql-eos-s3) - DEVICE="${DEVICE}" - FAMILY="pp3" - ;; - *) - echo "Unsupported device '${DEVICE}'" - exit 1 - ;; + qlf_k4n8) + DEVICE="${DEVICE}_${DEVICE}" + FAMILY="qlf_k4n8" + ;; + ql-eos-s3) + DEVICE="${DEVICE}" + FAMILY="pp3" + ;; + *) + echo "Unsupported device '${DEVICE}'" + exit 1 + ;; esac -##### Check if the source directory exists ##### +## Check if the source directory exists if [[ $1 == "-h" || $1 == "--help" ]];then - exit 1 + exit 1 else - if [ -z "$SOURCE" ];then + if [ -z "$SOURCE" ];then SOURCE=$PWD - elif [ $SOURCE == "." ];then + elif [ $SOURCE == "." ];then SOURCE=$PWD - elif [ ! -d "$SOURCE" ];then + elif [ ! -d "$SOURCE" ];then echo "Directory path $SOURCE DOES NOT exists. Please add absolute path" exit 1 + fi + + if [[ $1 == "-h" || $1 == "--help" ]];then + exit 0 + else + if [ -f $SOURCE/v_list_tmp ];then + rm -f $SOURCE/v_list_tmp fi + if [ $VERILOG_FILES == "*.v" ];then + VERILOG_FILES=`cd ${SOURCE};ls *.v` + fi + echo "$VERILOG_FILES" >${SOURCE}/v_list + fi -if [[ $1 == "-h" || $1 == "--help" ]];then -exit 0 -else -if [ -f $SOURCE/v_list_tmp ];then -rm -f $SOURCE/v_list_tmp -fi -if [ $VERILOG_FILES == "*.v" ];then - VERILOG_FILES=`cd ${SOURCE};ls *.v` -fi -echo "$VERILOG_FILES" >${SOURCE}/v_list -fi - -##### Validate the verlog source files ##### - -if [ ${#VERILOG_FILES[@]} -eq 0 ]; then - if [[ $1 != "-h" || $1 != "--help" ]];then - echo "Please provide at least one Verilog file" - exit 1 - fi -else - echo "verilog files: $VERILOG_FILES" - echo $VERILOG_FILES >${SOURCE}/v_list - sed '/^$/d' $SOURCE/v_list > $SOURCE/f_list_temp - VERILOG_FILES=`cat $SOURCE/f_list_temp` -fi + ## Validate the verlog source files + if [ ${#VERILOG_FILES[@]} -eq 0 ]; then + if [[ $1 != "-h" || $1 != "--help" ]];then + echo "Please provide at least one Verilog file" + exit 1 + fi + else + echo "verilog files: $VERILOG_FILES" + echo $VERILOG_FILES >${SOURCE}/v_list + sed '/^$/d' $SOURCE/v_list > $SOURCE/f_list_temp + VERILOG_FILES=`cat $SOURCE/f_list_temp` + fi fi if [[ $1 == "-compile" || $1 == "-post_verilog" ]]; then @@ -237,7 +200,7 @@ if [[ $1 == "-compile" || $1 == "-post_verilog" ]]; 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" + echo "Invalid Device name, supported qlf_k4n8" exit 1 fi if [ -z "$TOP" ]; then @@ -246,68 +209,67 @@ if [[ $1 == "-compile" || $1 == "-post_verilog" ]]; then fi if [[ "$DEVICE" =~ ^(qlf_k4n8_qlf_k4n8)$ ]]; then if [ -z "$PART" ]; then - if [ -n "$PCF" ];then - echo "Error: pcf file cannot be used without declaring PINMAP CSV file" - exit 1 - fi + if [ -n "$PCF" ];then + echo "Error: pcf file cannot be used without declaring PINMAP CSV file" + exit 1 + fi + fi + fi + if [ -z "$ROUTE_FLAG0" ]; then + MAX_CRITICALITY="0.0" + elif ! [[ "$ROUTE_FLAG0" =~ ^(timing|congestion)$ ]]; then + echo "Invalid option name, supported timing/congestion" + exit 1 + else + if [ "$ROUTE_FLAG0" == "congestion" ]; then + MAX_CRITICALITY="0.99" + else + MAX_CRITICALITY="0.0" fi fi - if [ -z "$ROUTE_FLAG0" ]; then - MAX_CRITICALITY="0.0" - elif ! [[ "$ROUTE_FLAG0" =~ ^(timing|congestion)$ ]]; then - echo "Invalid option name, supported timing/congestion" - exit 1 - else - if [ "$ROUTE_FLAG0" == "congestion" ]; then - MAX_CRITICALITY="0.99" - else - MAX_CRITICALITY="0.0" - fi - fi fi -if [ ! -z "$SOURCE" ];then - if [ ! -d $SOURCE/$BUILDDIR ]; then - mkdir -p $SOURCE/$BUILDDIR - fi +if [ ! -z "$SOURCE" ]; then + if [ ! -d $SOURCE/$BUILDDIR ]; then + mkdir -p $SOURCE/$BUILDDIR + fi fi -if [ ! -z "$OUT" ];then -OUT_ARR=($OUT) +if [ ! -z "$OUT" ]; then + OUT_ARR=($OUT) fi -for item in $VERILOG_FILES; -do -if ! [ -f $SOURCE/$item ]; then - echo "$item: verilog file does not exists at : $SOURCE" - exit 1 -elif [[ $item =~ ^/ ]]; then - echo "$item \\" >>$SOURCE/v_list_tmp -else - echo "\${current_dir}/$item \\" >>$SOURCE/v_list_tmp -fi +for item in $VERILOG_FILES; do + if ! [ -f $SOURCE/$item ]; then + echo "$item: verilog file does not exists at : $SOURCE" + exit 1 + elif [[ $item =~ ^/ ]]; then + echo "$item \\" >>$SOURCE/v_list_tmp + else + echo "\${current_dir}/$item \\" >>$SOURCE/v_list_tmp + fi done if [ -f "$SOURCE/v_list_tmp" ]; then - truncate -s-2 "$SOURCE/v_list_tmp" - VERILOG_LIST=`cat ${SOURCE}/v_list_tmp` + truncate -s-2 "$SOURCE/v_list_tmp" + VERILOG_LIST=`cat ${SOURCE}/v_list_tmp` fi # FIXME: Some devices do not have fasm2bels yet RUN_TILL="" if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then - HAVE_FASM2BELS=0 - RUN_TILL="bit" + HAVE_FASM2BELS=0 + RUN_TILL="bit" else - HAVE_FASM2BELS=1 - RUN_TILL="route" + HAVE_FASM2BELS=1 + RUN_TILL="route" fi # For some devices do repacking between place and route if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then - TOP_FINAL=${TOP}.repacked + TOP_FINAL=${TOP}.repacked else - TOP_FINAL=${TOP} + TOP_FINAL=${TOP} fi export PCF_FILE=$PCF @@ -315,37 +277,38 @@ export JSON=$JSON export TOP_F=$TOP export PINMAP_FILE=$PINMAPCSV export MAX_CRITICALITY=$MAX_CRITICALITY -##### Create Makefile ##### + +## Create Makefile if [[ $SOURCE =~ ^/ ]]; then - CURR_DIR="${SOURCE}" + CURR_DIR="${SOURCE}" else - CURR_DIR="${PWD}/${SOURCE}" + CURR_DIR="${PWD}/${SOURCE}" fi if [ -n "$PART" ]; then - if [[ -f $SOURCE/$PART ]];then - CSV_PATH=`realpath $SOURCE/$PART` - elif [[ -f $PART ]];then - CSV_PATH=`realpath $PART` - else - echo "invalid csv file/path" - exit 1 - fi + if [[ -f $SOURCE/$PART ]];then + CSV_PATH=`realpath $SOURCE/$PART` + elif [[ -f $PART ]];then + CSV_PATH=`realpath $PART` + else + echo "invalid csv file/path" + exit 1 + fi fi if [[ -f $SOURCE/$JSON ]];then - JSON_PATH=`realpath $SOURCE/$JSON` + JSON_PATH=`realpath $SOURCE/$JSON` elif [[ -f $JSON ]];then - JSON_PATH=`realpath $JSON` + JSON_PATH=`realpath $JSON` else - JSON_PATH="" + JSON_PATH="" fi if [[ -f $SOURCE/$PCF ]];then - PCF_PATH=`realpath $SOURCE/$PCF` + PCF_PATH=`realpath $SOURCE/$PCF` elif [[ -f $PCF ]];then - PCF_PATH=`realpath $PCF` + PCF_PATH=`realpath $PCF` fi export PART=${CSV_PATH} @@ -356,30 +319,30 @@ MAKE_FILE=${CURR_DIR}/Makefile.symbiflow LOG_FILE=${CURR_DIR}/${BUILDDIR}/${TOP}.log if [ -f "$SOURCE"/$PCF_FILE ];then - PCF_MAKE="\${current_dir}/$PCF_FILE" + 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}/build/${TOP}_dummy.pcf + PCF_MAKE="\${current_dir}/build/${TOP}_dummy.pcf" fi -PROCESS_SDC=`realpath ${MYPATH}/python/process_sdc_constraints.py` +PROCESS_SDC=$(realpath $(f4pga-env bin)/python/process_sdc_constraints.py) if ! [ -z "$SDC" ]; then - if ! [ -f "$SOURCE"/$SDC ];then - echo "The sdc file: $SDC is missing at: $SOURCE" - exit 1 - else - SDC_MAKE="$SOURCE/$SDC" - fi + if ! [ -f "$SOURCE"/$SDC ];then + echo "The sdc file: $SDC is missing at: $SOURCE" + exit 1 + else + SDC_MAKE="$SOURCE/$SDC" + fi else - touch ${CURR_DIR}/build/${TOP}_dummy.sdc - SDC_MAKE="\${current_dir}/build/${TOP}_dummy.sdc" + touch ${CURR_DIR}/build/${TOP}_dummy.sdc + SDC_MAKE="\${current_dir}/build/${TOP}_dummy.sdc" fi if ! [ -z "$CSV_PATH" ]; then - CSV_MAKE=$CSV_PATH + CSV_MAKE=$CSV_PATH else - touch ${CURR_DIR}/build/${TOP}_dummy.csv - CSV_MAKE="\${current_dir}/build/${TOP}_dummy.csv" + touch ${CURR_DIR}/build/${TOP}_dummy.csv + CSV_MAKE="\${current_dir}/build/${TOP}_dummy.csv" fi echo -e ".PHONY:\${BUILDDIR}\n @@ -459,25 +422,20 @@ clean:\n\ rm -rf \${BUILDDIR}\n\ " >>$MAKE_FILE -#### Remove temporary files ##### +## Remove temporary files rm -f $SOURCE/f_list_temp $SOURCE/v_list_tmp $SOURCE/v_list -##### Make file Targets ##### +## Make file Targets if [ $1 == "-synth" ]; then echo -e "Performing Synthesis " cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.eblif || exit elif [[ ! -z "$OUT" && $1 == "-compile" ]];then - if [[ " ${OUT_ARR[@]} " =~ " post_verilog " ]];then - cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.post_v || exit - fi + if [[ " ${OUT_ARR[@]} " =~ " post_verilog " ]];then + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.post_v || exit + 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 + echo -e "Running Synth->Pack->Place->Route->FASM->bitstream" + cd $SOURCE;make -f Makefile.symbiflow ${BUILDDIR}/${TOP}.${RUN_TILL} || exit fi fi - - -############################################################################################### - - diff --git a/f4pga/wrappers/sh/quicklogic/repack.f4pga.sh b/f4pga/wrappers/sh/quicklogic/repack.f4pga.sh index ef23e73..f8266a3 100755 --- a/f4pga/wrappers/sh/quicklogic/repack.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/repack.f4pga.sh @@ -1,32 +1,23 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +if [ -z $VPRPATH ]; then + export VPRPATH=$(f4pga-env bin) + export PYTHONPATH=${VPRPATH}/python:${VPRPATH}/python/prjxray:${PYTHONPATH} +fi -source ${MYPATH}/env source ${VPRPATH}/vpr_common - parse_args $@ -REPACK=`realpath ${MYPATH}/python/repacker/repack.py` - DESIGN=${EBLIF/.eblif/} -RULES=${ARCH_DIR}/${DEVICE_1}.repacking_rules.json -JSON_ARGS= -if [ ! -z "${JSON}" ]; then - JSON_ARGS="--json-constraints ${JSON}" -fi +[ ! -z "${JSON}" ] && JSON_ARGS="--json-constraints ${JSON}" || JSON_ARGS= +[ ! -z "${PCF_PATH}" ] && PCF_ARGS="--pcf-constraints ${PCF_PATH}" || PCF_ARGS= -PCF_ARGS= -if [ ! -z "${PCF_PATH}" ]; then - PCF_ARGS="--pcf-constraints ${PCF_PATH}" -fi - -python3 ${REPACK} \ +python3 $(f4pga-env bin)/python/repacker/repack.py \ --vpr-arch ${ARCH_DEF} \ - --repacking-rules ${RULES} \ + --repacking-rules ${ARCH_DIR}/${DEVICE_1}.repacking_rules.json \ $JSON_ARGS \ $PCF_ARGS \ --eblif-in ${DESIGN}.eblif \ diff --git a/f4pga/wrappers/sh/quicklogic/route.f4pga.sh b/f4pga/wrappers/sh/quicklogic/route.f4pga.sh index 9975bea..0681ce8 100755 --- a/f4pga/wrappers/sh/quicklogic/route.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/route.f4pga.sh @@ -1,15 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +if [ -z $VPRPATH ]; then + export VPRPATH=$(f4pga-env bin) + export PYTHONPATH=${VPRPATH}/python:${VPRPATH}/python/prjxray:${PYTHONPATH} +fi -source ${MYPATH}/env source ${VPRPATH}/vpr_common - parse_args $@ -export OUR_NOISY_WARNINGS=noisy_warnings-${DEVICE}_pack.log +export OUT_NOISY_WARNINGS=noisy_warnings-${DEVICE}_pack.log run_vpr --route diff --git a/f4pga/wrappers/sh/quicklogic/synth.f4pga.sh b/f4pga/wrappers/sh/quicklogic/synth.f4pga.sh index 61d2bb1..bb6aa2d 100755 --- a/f4pga/wrappers/sh/quicklogic/synth.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/synth.f4pga.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` - -SPLIT_INOUTS=`realpath ${MYPATH}/python/split_inouts.py` -CONVERT_OPTS=`realpath ${MYPATH}/python/convert_compile_opts.py` +export SHARE_DIR_PATH=${SHARE_DIR_PATH:=$(f4pga-env share)} +VPRPATH=${VPRPATH:=$(f4pga-env bin)} +SPLIT_INOUTS=`realpath ${VPRPATH}/python/split_inouts.py` +CONVERT_OPTS=`realpath ${VPRPATH}/python/convert_compile_opts.py` print_usage () { echo "Usage: symbiflow_synth -v|--verilog " @@ -101,16 +101,16 @@ if [ -z ${FAMILY} ]; then fi if [ ${#VERILOG_FILES[@]} -eq 0 ]; then - echo "Please provide at least one Verilog file" - exit 1 + echo "Please provide at least one Verilog file" + exit 1 fi PINMAPCSV="pinmap_${PART}.csv" -export TECHMAP_PATH=`realpath ${MYPATH}/../share/symbiflow/techmaps/${FAMILY}` +export TECHMAP_PATH="${SHARE_DIR_PATH}/techmaps/${FAMILY}" -SYNTH_TCL_PATH=`realpath ${MYPATH}/../share/symbiflow/scripts/${FAMILY}/synth.tcl` -CONV_TCL_PATH=`realpath ${MYPATH}/../share/symbiflow/scripts/${FAMILY}/conv.tcl` +SYNTH_TCL_PATH="${SHARE_DIR_PATH}/scripts/${FAMILY}/synth.tcl" +CONV_TCL_PATH="${SHARE_DIR_PATH}/scripts/${FAMILY}/conv.tcl" export USE_ROI="FALSE" export OUT_JSON=$TOP.json @@ -123,24 +123,24 @@ if [ -s $PCF ]; then export PCF_FILE=$PCF fi -DEVICE_PATH=`realpath ${MYPATH}/../share/symbiflow/arch/${DEVICE}_${DEVICE}` +DEVICE_PATH="${SHARE_DIR_PATH}/arch/${DEVICE}_${DEVICE}" export PINMAP_FILE=${DEVICE_PATH}/${PINMAPCSV} if [ -d "${DEVICE_PATH}/cells" ]; then - export DEVICE_CELLS_SIM=`find ${DEVICE_PATH}/cells -name "*_sim.v"` - export DEVICE_CELLS_MAP=`find ${DEVICE_PATH}/cells -name "*_map.v"` + export DEVICE_CELLS_SIM=`find ${DEVICE_PATH}/cells -name "*_sim.v"` + export DEVICE_CELLS_MAP=`find ${DEVICE_PATH}/cells -name "*_map.v"` else - # pp3 family has different directory naming scheme - # the are named as ${DEVICE}_${PACKAGE} - # ${PACKAGE} is not known because it is not passed down in add_binary_toolchain_test - DEVICE_PATH=$(find $(realpath ${MYPATH}/../share/symbiflow/arch/) -type d -name "${DEVICE}*") - export PINMAP_FILE=${DEVICE_PATH}/${PINMAPCSV} - if [ -d "${DEVICE_PATH}/cells" ]; then - export DEVICE_CELLS_SIM=`find ${DEVICE_PATH}/cells -name "*_sim.v"` - export DEVICE_CELLS_MAP=`find ${DEVICE_PATH}/cells -name "*_map.v"` - else - export DEVICE_CELLS_SIM= - export DEVICE_CELLS_MAP= - fi + # pp3 family has different directory naming scheme + # the are named as ${DEVICE}_${PACKAGE} + # ${PACKAGE} is not known because it is not passed down in add_binary_toolchain_test + DEVICE_PATH=$(find $(realpath ${SHARE_DIR_PATH}/arch/) -type d -name "${DEVICE}*") + export PINMAP_FILE=${DEVICE_PATH}/${PINMAPCSV} + if [ -d "${DEVICE_PATH}/cells" ]; then + export DEVICE_CELLS_SIM=`find ${DEVICE_PATH}/cells -name "*_sim.v"` + export DEVICE_CELLS_MAP=`find ${DEVICE_PATH}/cells -name "*_map.v"` + else + export DEVICE_CELLS_SIM= + export DEVICE_CELLS_MAP= + fi fi YOSYS_COMMANDS=`echo ${EXTRA_ARGS[*]} | python3 ${CONVERT_OPTS}` @@ -151,11 +151,11 @@ LOG=${TOP}_synth.log YOSYS_SCRIPT="tcl ${SYNTH_TCL_PATH}" for f in ${VERILOG_FILES[*]}; do - YOSYS_SCRIPT="read_verilog ${f}; $YOSYS_SCRIPT" + YOSYS_SCRIPT="read_verilog ${f}; $YOSYS_SCRIPT" done if [ ! -z "${YOSYS_COMMANDS}" ]; then - YOSYS_SCRIPT="$YOSYS_COMMANDS; $YOSYS_SCRIPT" + YOSYS_SCRIPT="$YOSYS_COMMANDS; $YOSYS_SCRIPT" fi yosys -p "${YOSYS_SCRIPT}" -l $LOG diff --git a/f4pga/wrappers/sh/quicklogic/write_fasm.f4pga.sh b/f4pga/wrappers/sh/quicklogic/write_fasm.f4pga.sh index ec4f856..be0ce67 100755 --- a/f4pga/wrappers/sh/quicklogic/write_fasm.f4pga.sh +++ b/f4pga/wrappers/sh/quicklogic/write_fasm.f4pga.sh @@ -1,16 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e -MYPATH=`realpath $0` -MYPATH=`dirname ${MYPATH}` +if [ -z $VPRPATH ]; then + export VPRPATH=$(f4pga-env bin) + export PYTHONPATH=${VPRPATH}/python:${VPRPATH}/python/prjxray:${PYTHONPATH} +fi -source ${MYPATH}/env source ${VPRPATH}/vpr_common - parse_args "$@" TOP="${EBLIF%.*}" -FASM_EXTRA=${TOP}_fasm_extra.fasm +FASM_EXTRA="${TOP}_fasm_extra.fasm" export OUT_NOISY_WARNINGS=noisy_warnings-${DEVICE}_fasm.log @@ -18,9 +19,9 @@ run_genfasm echo "FASM extra: $FASM_EXTRA" if [ -f $FASM_EXTRA ]; then - echo "writing final fasm" - cat ${TOP}.fasm $FASM_EXTRA > tmp.fasm - mv tmp.fasm ${TOP}.fasm + echo "writing final fasm" + cat ${TOP}.fasm $FASM_EXTRA > tmp.fasm + mv tmp.fasm ${TOP}.fasm fi mv vpr_stdout.log fasm.log