platforms: eos-s3: add fasm2bels stage

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
This commit is contained in:
Pawel Czarnecki 2022-07-08 10:44:50 +02:00 committed by Unai Martinez-Corral
parent 29b6757fd7
commit 93392fa9cb
3 changed files with 82 additions and 25 deletions

View File

@ -19,7 +19,8 @@
"sdc-in": "eos-s3/btn_counter/dummy.sdc" "sdc-in": "eos-s3/btn_counter/dummy.sdc"
}, },
"values": { "values": {
"part": "ql-eos-s3" "part": "ql-eos-s3",
"part_name": "PD64"
} }
} }
} }

View File

@ -17,7 +17,8 @@
"bitstream_bitheader": "common:generic_script_wrapper", "bitstream_bitheader": "common:generic_script_wrapper",
"bitstream_binary": "common:generic_script_wrapper", "bitstream_binary": "common:generic_script_wrapper",
"bitstream_jlink": "common:generic_script_wrapper", "bitstream_jlink": "common:generic_script_wrapper",
"bitstream_openocd": "common:generic_script_wrapper" "bitstream_openocd": "common:generic_script_wrapper",
"fasm2bels": "common:generic_script_wrapper"
}, },
"values": { "values": {
@ -426,6 +427,47 @@
"#3": "${:iomux_binary}" "#3": "${:iomux_binary}"
} }
} }
},
"fasm2bels": {
"params": {
"stage_name": "fasm2bels",
"script": "symbiflow_fasm2bels",
"outputs": {
"fasm2bels_verilog": {
"mode": "file",
"file": "${:bitstream}.v",
"target": "${:bitstream}.v"
},
"fasm2bels_pcf": {
"mode": "file",
"file": "${:bitstream}.pcf",
"target": "${:bitstream}.pcf"
},
"fasm2bels_qcf": {
"mode": "file",
"file": "${:bitstream}.qcf",
"target": "${:bitstream}.qcf"
},
"fasm2bels_log": {
"mode": "stdout",
"target": "${:bitstream}.log"
}
},
"inputs": {
"device": "${device}",
"part": "${part_name}",
"pcf": "${:pcf}",
"bit": "${:bitstream}",
"out-verilog": "${:bitstream}.v",
"out-pcf": "${:bitstream}.pcf",
"out-qcf": "${:bitstream}.qcf",
"$F4PGA_INSTALL_DIR": "${shareDir}/../../../../",
"$FPGA_FAM": "eos-s3",
"$PATH": "${shareDir}/../../../conda/envs/eos-s3/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"$SHARE_DIR_PATH": "${shareDir}",
"$BIN_DIR_PATH": "${binDir}"
}
}
} }
} }
} }

View File

@ -21,8 +21,8 @@ set -e
SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"} SHARE_DIR_PATH=${SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}
BIN_DIR_PATH=${BIN_DIR_PATH:="$F4PGA_BIN_DIR"} BIN_DIR_PATH=${BIN_DIR_PATH:="$F4PGA_BIN_DIR"}
OPTS=d:P:p:b: OPTS=d:P:p:b:v:o:q
LONGOPTS=device:,part:,pcf:,bit:, LONGOPTS=device:,part:,pcf:,bit:,out-verilog:,out-pcf:,out-qcf:,
PARSED_OPTS=`getopt --options=${OPTS} --longoptions=${LONGOPTS} --name $0 -- "$@"` PARSED_OPTS=`getopt --options=${OPTS} --longoptions=${LONGOPTS} --name $0 -- "$@"`
eval set -- "${PARSED_OPTS}" eval set -- "${PARSED_OPTS}"
@ -31,6 +31,9 @@ DEVICE=""
PART="" PART=""
PCF="" PCF=""
BIT="" BIT=""
OUT_VERILOG=""
OUT_PCF=""
OUT_QCF=""
while true; do while true; do
case "$1" in case "$1" in
@ -50,6 +53,18 @@ while true; do
BIT=$2 BIT=$2
shift 2 shift 2
;; ;;
-v|--out-verilog)
OUT_VERILOG=$2
shift 2
;;
-o|--out-pcf)
OUT_PCF=$2
shift 2
;;
-q|--out-qcf)
OUT_QCF=$2
shift 2
;;
--) --)
break break
;; ;;
@ -67,27 +82,26 @@ if [ -z $BIT ]; then
fi fi
# Run fasm2bels # $DEVICE is not ql-eos-s3 or ql-pp3e
if [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then if ! [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then
VPR_DB=`readlink -f ${SHARE_DIR_PATH}/arch/${DEVICE}_wlcsp/db_phy.pickle`
FASM2BELS=`readlink -f ${SHARE_DIR_PATH}/scripts/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"
`which python3` ${FASM2BELS} ${BIT} --phy-db ${VPR_DB} --device-name ${FASM2BELS_DEVICE} --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" echo "ERROR: Unsupported device '${DEVICE}' for fasm2bels"
exit -1 exit -1
fi fi
# Run fasm2bels
VPR_DB=`readlink -f ${SHARE_DIR_PATH}/arch/${DEVICE}_wlcsp/db_phy.pickle`
FASM2BELS=`readlink -f ${SHARE_DIR_PATH}/scripts/fasm2bels.py`
FASM2BELS_DEVICE=${DEVICE/ql-/}
VERILOG_FILE="${OUT_VERILOG:-$BIT.v}"
PCF_FILE="${OUT_PCF:-$BIT.v.pcf}"
QCF_FILE="${OUT_QCF:-$BIT.v.qcf}"
if [ ! -z "{PCF}" ]; then
PCF_ARGS="--input-pcf ${PCF}"
else
PCF_ARGS=""
fi
echo "Running fasm2bels"
`which python3` ${FASM2BELS} ${BIT} --phy-db ${VPR_DB} --device-name ${FASM2BELS_DEVICE} --package-name ${PART} --input-type bitstream --output-verilog ${VERILOG_FILE} ${PCF_ARGS} --output-pcf ${PCF_FILE} --output-qcf ${QCF_FILE}