Skip to content

Commit 9bf6fe9

Browse files
author
Quentin Berthet
committed
Fix Makefile template and Makefile generation
1 parent 05784d1 commit 9bf6fe9

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

hls4ml/templates/vitis_accelerator/Makefile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ CARD_CFG ?= accelerator_card.cfg
3232
PLATFORM ?= $(shell awk -F '=' '/platform=/ {print $$2}' $(CARD_CFG))
3333

3434
# Board Type (determines whether design will go through packaging step)
35-
BOARD_TYPE :=
35+
BOARD_TYPE :=
3636

3737
# Kernel name
38-
KERNEL_NAME := myproject
38+
KERNEL_NAME := #PRJNAME
3939

4040
# Wrapper name
4141
WRAPPER_NAME := kernel_wrapper
@@ -86,14 +86,8 @@ hls: $(BUILD_DIR)/$(KERNEL_NAME)_kernel.xo
8686

8787
# Kernel linking & packaging ##################################################
8888

89-
ifeq ($(BOARD_TYPE),alveo)
90-
# For Standard Alveo, a single step is required for linking and packaging
91-
# This is standard Alveo linking and packaging
92-
$(BUILD_DIR)/$(WRAPPER_NAME).xclbin: $(BUILD_DIR)/$(KERNEL_NAME)_kernel.xo
93-
mkdir -p $(XCLBIN_DIR)
94-
v++ -l $(XOLDFLAGS) --temp_dir $(XCLBIN_DIR) --log_dir $(XCLBIN_DIR) -o $@ $^
89+
ifneq (,$(findstring versal,$(BOARD_TYPE)))
9590

96-
else ifeq ($(BOARD_TYPE),alveo-versal) || ($(BOARD_TYPE),versal)
9791
# For Versal architecture, linking and packaging are separate steps
9892
$(BUILD_DIR)/$(WRAPPER_NAME).xsa: $(BUILD_DIR)/$(KERNEL_NAME)_kernel.xo
9993
mkdir -p $(XCLBIN_DIR)
@@ -105,7 +99,12 @@ $(BUILD_DIR)/$(WRAPPER_NAME).xclbin: $(BUILD_DIR)/$(WRAPPER_NAME).xsa
10599
v++ -p $(XOCCPFLAGS) --temp_dir $(XCLBIN_DIR) --log_dir $(XCLBIN_DIR) -o $@ $^
106100

107101
else
108-
@echo "$(BOARD_TYPE) board type is currently unsupported"
102+
103+
# For Standard Alveo, a single step is required for linking and packaging
104+
# This is standard Alveo linking and packaging
105+
$(BUILD_DIR)/$(WRAPPER_NAME).xclbin: $(BUILD_DIR)/$(KERNEL_NAME)_kernel.xo
106+
mkdir -p $(XCLBIN_DIR)
107+
v++ -l $(XOLDFLAGS) --temp_dir $(XCLBIN_DIR) --log_dir $(XCLBIN_DIR) -o $@ $^
109108

110109
endif
111110

@@ -134,7 +133,6 @@ cleanhls:
134133

135134
clean: cleanxclbin cleanhls
136135

137-
ultraclean:
136+
ultraclean:
138137
rm -rf host tb_data/hw_results.dat tb_data/tb_input_features.dat *.log
139138
rm -rf $(BUILD_DIR)
140-

hls4ml/writer/vitis_accelerator_writer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,10 @@ def write_makefile(self, model):
201201

202202
board_type = self.vitis_accelerator_config.get_board_type()
203203
project_name = format(model.config.get_project_name())
204-
205204
for line in f.readlines():
206-
if 'myproject' in line:
207-
newline = line.replace('myproject', project_name)
208-
if 'BOARD_TYPE :=' in line:
205+
if '#PRJNAME' in line:
206+
newline = line.replace('#PRJNAME', project_name)
207+
elif 'BOARD_TYPE :=' in line:
209208
newline += 'BOARD_TYPE := ' + board_type + '\n'
210209
else:
211210
newline = line

0 commit comments

Comments
 (0)