2022-01-12 13:01:59 -05:00
|
|
|
TOP := $(strip ${TOP})
|
|
|
|
TARGET := $(strip ${TARGET})
|
|
|
|
|
2021-08-10 18:47:29 -04:00
|
|
|
BUILDDIR := ${current_dir}/build
|
2021-08-10 19:00:16 -04:00
|
|
|
BOARD_BUILDDIR := ${BUILDDIR}/${TARGET}
|
2021-08-10 18:47:29 -04:00
|
|
|
|
2021-08-10 19:57:37 -04:00
|
|
|
# Set board properties based on TARGET variable
|
|
|
|
ifeq ($(TARGET),arty_35)
|
|
|
|
DEVICE := xc7a50t_test
|
|
|
|
BITSTREAM_DEVICE := artix7
|
|
|
|
PARTNAME := xc7a35tcsg324-1
|
|
|
|
else ifeq ($(TARGET),arty_100)
|
|
|
|
DEVICE := xc7a100t_test
|
|
|
|
BITSTREAM_DEVICE := artix7
|
|
|
|
PARTNAME := xc7a100tcsg324-1
|
|
|
|
else ifeq ($(TARGET),nexys4ddr)
|
|
|
|
DEVICE := xc7a100t_test
|
|
|
|
BITSTREAM_DEVICE := artix7
|
|
|
|
PARTNAME := xc7a100tcsg324-1
|
|
|
|
else ifeq ($(TARGET),zybo)
|
|
|
|
DEVICE := xc7z010_test
|
|
|
|
BITSTREAM_DEVICE := zynq7
|
|
|
|
PARTNAME := xc7z010clg400-1
|
|
|
|
else ifeq ($(TARGET),nexys_video)
|
|
|
|
DEVICE := xc7a200t_test
|
|
|
|
BITSTREAM_DEVICE := artix7
|
|
|
|
PARTNAME := xc7a200tsbg484-1
|
|
|
|
else ifeq ($(TARGET),basys3)
|
|
|
|
DEVICE := xc7a50t_test
|
|
|
|
BITSTREAM_DEVICE := artix7
|
|
|
|
PARTNAME := xc7a35tcpg236-1
|
|
|
|
else
|
|
|
|
$(error Unsupported board type)
|
|
|
|
endif
|
|
|
|
|
2021-08-10 18:47:29 -04:00
|
|
|
# Determine the type of constraint being used
|
2021-08-10 19:00:16 -04:00
|
|
|
ifneq (${XDC},)
|
|
|
|
XDC_CMD := -x ${XDC}
|
2021-08-10 18:47:29 -04:00
|
|
|
endif
|
2021-08-10 19:00:16 -04:00
|
|
|
ifneq (${SDC},)
|
|
|
|
SDC_CMD := -s ${SDC}
|
2021-08-10 18:47:29 -04:00
|
|
|
endif
|
2021-08-10 19:00:16 -04:00
|
|
|
ifneq (${PCF},)
|
|
|
|
PCF_CMD := -p ${PCF}
|
2021-08-10 18:47:29 -04:00
|
|
|
endif
|
|
|
|
|
2022-01-12 10:00:00 -05:00
|
|
|
# Determine if we should use Surelog/UHDM to read sources
|
|
|
|
ifneq (${SURELOG_CMD},)
|
|
|
|
SURELOG_OPT := -s ${SURELOG_CMD}
|
|
|
|
endif
|
|
|
|
|
2021-08-10 18:47:29 -04:00
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
|
|
|
|
# Build design
|
|
|
|
all: ${BOARD_BUILDDIR}/${TOP}.bit
|
|
|
|
|
|
|
|
${BOARD_BUILDDIR}:
|
|
|
|
mkdir -p ${BOARD_BUILDDIR}
|
|
|
|
|
2021-12-13 18:19:36 -05:00
|
|
|
${BOARD_BUILDDIR}/${TOP}.eblif: ${SOURCES} ${XDC} ${SDC} ${PCF} | ${BOARD_BUILDDIR}
|
2022-01-12 10:00:00 -05:00
|
|
|
cd ${BOARD_BUILDDIR} && symbiflow_synth -t ${TOP} ${SURELOG_OPT} -v ${SOURCES} -d ${BITSTREAM_DEVICE} -p ${PARTNAME} ${XDC_CMD}
|
2021-08-10 18:47:29 -04:00
|
|
|
|
|
|
|
${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif
|
|
|
|
cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} ${SDC_CMD} 2>&1 > /dev/null
|
|
|
|
|
|
|
|
${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net
|
|
|
|
cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} ${PCF_CMD} -n ${TOP}.net -P ${PARTNAME} ${SDC_CMD} 2>&1 > /dev/null
|
|
|
|
|
|
|
|
${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place
|
|
|
|
cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} ${SDC_CMD} 2>&1 > /dev/null
|
|
|
|
|
|
|
|
${BOARD_BUILDDIR}/${TOP}.fasm: ${BOARD_BUILDDIR}/${TOP}.route
|
|
|
|
cd ${BOARD_BUILDDIR} && symbiflow_write_fasm -e ${TOP}.eblif -d ${DEVICE}
|
|
|
|
|
|
|
|
${BOARD_BUILDDIR}/${TOP}.bit: ${BOARD_BUILDDIR}/${TOP}.fasm
|
2021-09-01 20:47:42 -04:00
|
|
|
cd ${BOARD_BUILDDIR} && symbiflow_write_bitstream -d ${BITSTREAM_DEVICE} -f ${TOP}.fasm -p ${PARTNAME} -b ${TOP}.bit
|
2021-08-10 18:47:29 -04:00
|
|
|
|
2021-10-02 13:05:25 -04:00
|
|
|
download: ${BOARD_BUILDDIR}/${TOP}.bit
|
|
|
|
if [ $(TARGET)='arty_35' ]; then \
|
2022-03-15 15:16:20 -04:00
|
|
|
openocd -f ~/opt/f4pga/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 ${BOARD_BUILDDIR}/${TOP}.bit; exit"; \
|
2021-10-02 13:05:25 -04:00
|
|
|
elif [ $(TARGET)='arty_100' ]; then \
|
2022-03-15 15:16:20 -04:00
|
|
|
openocd -f ~/opt/f4pga/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 ${BOARD_BUILDDIR}/${TOP}.bit; exit"; \
|
2021-10-02 13:05:25 -04:00
|
|
|
elif [ $(TARGET)='basys3' ]; then \
|
2022-03-15 15:16:20 -04:00
|
|
|
openocd -f ~/opt/f4pga/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 ${BOARD_BUILDDIR}/${TOP}.bit; exit"; \
|
2021-10-02 13:05:25 -04:00
|
|
|
else \
|
2022-02-18 12:15:44 -05:00
|
|
|
echo "The commands needed to download the bitstreams to the board type specified are not currently supported by the F4PGA makefiles. \
|
2021-10-02 13:05:25 -04:00
|
|
|
Please see documentation for more information."; \
|
2021-11-17 07:29:22 -05:00
|
|
|
fi
|
2021-10-02 13:05:25 -04:00
|
|
|
|
|
|
|
|
2021-08-10 18:47:29 -04:00
|
|
|
clean:
|
2021-11-17 07:29:22 -05:00
|
|
|
rm -rf ${BUILDDIR}
|