-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
98 lines (73 loc) · 2.88 KB
/
Makefile
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
87
88
89
90
91
92
93
94
95
96
97
98
# Configuration
BOARD:= xc7z020clg400-1
ORIGIN_NETWORK = ./snn_config/networks/wineNetwork.pt
ORIGIN_DATA = ./snn_config/databases/wine.data
# Run scripts
RUN_HLS := vitis_hls
RUN_VIVADO:= vivado -mode batch -nojournal -nolog
RUN_VITIS := xsct
SCRIPT = python3
# Phony targets
.PHONY: create_sources clean_sources clean_hls clean_vivado clean_vitis run_app open_vitis
# Default target
# ===============================================================
all: create_sources create_ip create_platform create_app
# Secondary targets
# ===============================================================
create_sources: snn_config/data.cpp snn_config/network.cpp Makefile
create_ip: vitis_hls/snn_ip/component.xml
create_platform: create_bd synth place_and_route export_hw
create_app : vitis/ws/*
# Tertiary targets
# ===============================================================
create_bd: vivado/block_design/block_design.bd
synth: vivado/checkpoints/opt.dcp
place_and_route : vivado/checkpoints/route.dcp
export_hw : vivado/snn_hw.xsa
# Dependencies
# ===============================================================
snn_config/data.cpp: $(ORIGIN_DATA) Makefile
$(SCRIPT) snn_config/scripts/store_data.py $(ORIGIN_DATA)
snn_config/network.cpp: $(ORIGIN_NETWORK) Makefile
$(SCRIPT) snn_config/scripts/store_network.py $(ORIGIN_NETWORK)
vitis_hls/snn_ip/component.xml : vitis_hls/src/* snn_config/*
@echo "part=$(BOARD)" > vitis_hls/config.ini
@rm -rf vitis_hls/snn_ip
@$(RUN_HLS) -f vitis_hls/run_hls.tcl
@unzip vitis_hls/snn_ip/export.zip -d vitis_hls/snn_ip
vivado/block_design/block_design.bd: vivado/create_bd.tcl \
vitis_hls/snn_ip/component.xml
@$(RUN_VIVADO) -source vivado/create_bd.tcl -tclargs $(BOARD)
vivado/checkpoints/opt.dcp: vivado/block_design/block_design.bd
@$(RUN_VIVADO) -source vivado/synth.tcl -tclargs $(BOARD)
vivado/checkpoints/route.dcp: vivado/checkpoints/synth.dcp
@$(RUN_VIVADO) -source vivado/place_and_route.tcl
vivado/snn_hw.xsa: vivado/checkpoints/route.dcp
@$(RUN_VIVADO) -source vivado/export_hw.tcl
vitis/ws/*: vitis/src/* vitis/src/hw/* vivado/snn_hw.xsa snn_config/*
@rm -rf vitis/ws
@$(RUN_VITIS) vitis/create_project_vitis.tcl
# Delete temporal project files
# ===============================================================
clean : clean_sources clean_hls clean_vivado clean_vitis
clean_sources :
@rm -f snn_config/data.cpp
@rm -f snn_config/network.cpp
clean_hls :
@rm -f vitis_hls.log
@rm -rf vitis_hls/proj/
@rm -f vitis_hls/config.ini
@rm -f vitis_hls/sources.ini
@rm -rf vitis_hls/snn_ip
clean_vivado:
@rm -rf .srcs
@rm -rf .Xil
@rm -rf NA
@rm -rf vivado/checkpoints/opt.dcp
@rm -rf vivado/checkpoints/place.dcp
@rm -rf vivado/checkpoints/route.dcp
@rm -rf vivado/checkpoints/synth.dcp
clean_vitis:
@rm -rf .Xil
@rm -f xrc.log
@rm -rf vitis/ws/