Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FREQUENCY as a prereq in Vitis builds #1472

Merged
merged 2 commits into from
Mar 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions platforms/vitis/cl_firesim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Assumptions:
# Host must be x86
# You have the Vitis 2020.2 + XRT tools installed
# You have the Vitis 2022.1 + XRT tools installed

buildroot = $(abspath .)
PROJECT_NAME := firesim
Expand All @@ -15,6 +15,18 @@ ifndef XILINX_VITIS
$(error XILINX_VITIS variable is not set, please set correctly and rerun)
endif

# taken from https://stackoverflow.com/questions/26145267/how-do-i-force-a-target-to-be-rebuilt-if-a-variable-is-set
# variable argument to DEPENDABLE_VAR can be used as a prerequisite
define DEPENDABLE_VAR

.PHONY: phony
$1: phony
@if [[ `cat $1 2>&1` != '$($1)' ]]; then \
echo -n $($1) > $1 ; \
fi

endef

# Builds through vitis use the same tool (v++) for building xclbins destined
# for FPGA deployment and various simulation. This is controlled by the --target, -t flag
#
Expand All @@ -28,7 +40,7 @@ SIM_DIR := $(buildroot)/simulation
bitstream: TARGET = hw
bitstream: VPP_TARGET_SPECIFIC_ARGS = --target $(TARGET) --config $(buildroot)/build-bitstream.cfg
sim: TARGET = hw_emu
sim: VPP_TARGET_SPECIFIC_ARGS = --target $(TARGET) --config $(buildroot)/simulation.cfg
sim: VPP_TARGET_SPECIFIC_ARGS = --target $(TARGET) --config $(buildroot)/simulation.cfg
run-sim: TARGET = hw_emu
run-sim: VPP_TARGET_SPECIFIC_ARGS = --target $(TARGET) --config $(buildroot)/simulation.cfg

Expand All @@ -39,6 +51,9 @@ DEVICE ?= xilinx_u250_gen3x16_xdma_3_1_202020_1
# provided to the kernel using an internal MMCM.
FREQUENCY ?= 90

# declare FREQUENCY to be dependable
$(eval $(call DEPENDABLE_VAR,FREQUENCY))

# Selects a vitis config, by looking in build-strategies, for an equivalently
# named cfg file.
STRATEGY ?= TIMING
Expand Down Expand Up @@ -134,7 +149,7 @@ $(sv_processed): $(sv_generated)

ipgen_scripts = $(shell find design/ -iname "*.ipgen.tcl")

%.xo: scripts/package_kernel.tcl scripts/gen_xo.tcl $(sv_processed) $(sv_defines) $(ipgen_scripts)
%.xo: scripts/package_kernel.tcl scripts/gen_xo.tcl $(sv_processed) $(sv_defines) $(ipgen_scripts) FREQUENCY
mkdir -p $(@D)
# Move into the simulation or bitstream-build directory
cd $(@D)/..; $(VIVADO) -mode batch -source $(buildroot)/scripts/gen_xo.tcl \
Expand Down Expand Up @@ -203,4 +218,3 @@ run-sim: $(SIM_BINARY_CONTAINER) $(delivered_sim_inputs) $(emconfig)
.PHONY: clean
clean:
rm -rf $(SIM_DIR) $(BITSTREAM_DIR)