forked from shgoupf/snap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hls.mk
86 lines (74 loc) · 2.78 KB
/
hls.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# Copyright 2017 International Business Machines
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Examples:
# xcku060-ffva1156-2-e
# xc7vx690tffg1157-2
# xcku115-flva1517-2-e
#FPGACHIP ?= xcku060-ffva1156-2-e
CONFIG_FILE = $(SNAP_ROOT)/.snap_config
ifneq ("$(wildcard $(CONFIG_FILE))","")
FPGACHIP = $(shell grep FPGACHIP $(CONFIG_FILE) | cut -d = -f 2)
$(info FPGACHIP is set to $(FPGACHIP).)
endif
PART_NUMBER ?= $(FPGACHIP)
# The wrapper name must match a function in the HLS sources which is
# taken as entry point for the HDL generation.
WRAPPER ?= hls_action
syn_dir=$(SOLUTION_DIR)_$(PART_NUMBER)/$(SOLUTION_NAME)/syn
symlinks=vhdl report
# gcc test-bench stuff
objs = $(srcs:.cpp=.o)
CXX = g++
CXXFLAGS = -Wall -W -Wextra -Werror -O2 -DNO_SYNTH -Wno-unknown-pragmas -I../include
all: $(syn_dir) check
$(syn_dir): $(srcs) run_hls_script.tcl
vivado_hls -f run_hls_script.tcl
$(RM) -rf $@/systemc $@/verilog
# Create symlinks for simpler access
$(symlinks): $(syn_dir)
@ln -sf $(syn_dir)/$@ $@
run_hls_script.tcl: $(SNAP_ROOT)/actions/scripts/create_run_hls_script.sh
$(SNAP_ROOT)/actions/scripts/create_run_hls_script.sh \
-n $(SOLUTION_NAME) \
-d $(SOLUTION_DIR) \
-w $(WRAPPER) \
-p $(PART_NUMBER) \
-f "$(srcs)" \
-s $(SNAP_ROOT) > $@
$(SOLUTION_NAME): $(objs)
$(CXX) -o $@ $^
# FIXME That those things are not resulting in an error is problematic.
# If we get critical warnings we stay away from continuing now,
# since that will according to our experience with vivado_hls, lead
# to strange problems later on. So let us work on fixing the design
# if they occur. Rather than challenging our luck.
#
# Check for critical warnings and exit if those occur. Add more if needed.
# Check for reserved HLS MMIO reg at offset 0x17c.
# Check for register duplication (0x184/Action_Output_o).
#
check: $(syn_dir)
@echo -n "Checking for critical warnings during HLS synthesis ... "
@grep -A8 critical $(SOLUTION_DIR)*/$(SOLUTION_NAME)/$(SOLUTION_NAME).log ; \
test $$? = 1
@echo "OK"
@echo -n "Checking for reserved MMIO area during HLS synthesis ... "
@grep -A8 0x17c $(syn_dir)/vhdl/$(WRAPPER)_ctrl_reg_s_axi.vhd | grep reserved > \
/dev/null; test $$? = 0
@echo "OK"
clean:
@$(RM) -r $(SOLUTION_DIR)* run_hls_script.tcl *~ *.log \
$(objs) $(SOLUTION_NAME)