-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
89 lines (67 loc) · 2.1 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
VERBOSE = 0
HDL_DIR = $(shell readlink -f hdl)
HDL_INCLUDE = $(HDL_DIR)/include
TB_TOP = $(shell readlink -f tb)
TB_INCLUDE = $(TB_TOP)/include
XDC_DIR = $(shell readlink -f xdc)
TOOLS_DIR = $(shell readlink -f tools)
SIM_DIR = $(shell readlink -f simulation)
BD_DIR = $(shell readlink -f bd)
SYNTH_DIR = $(shell readlink -f synthesis)
KMOD_DIR = $(shell readlink -f driver)
META_ZYNQAES_DIR = $(shell readlink -f yocto/meta-zynqaes)
REPORTS_DIR = $(SYNTH_DIR)/reports
XDC_FILES := $(shell find $(XDC_DIR))
BD_SOURCES := $(shell find $(BD_DIR))
HDL_SOURCES := $(shell find $(HDL_DIR))
IP_NAME = zynq_aes
IP_VERSION = 1.0
IP_REPO_PREFIX = ip_repo_
IP_REPO_DIR = $(SIM_DIR)/$(IP_REPO_PREFIX)$(IP_NAME)
SIM_PROJ_NAME = test_proj
SIM_PROJ = $(SIM_DIR)/$(SIM_PROJ_NAME)
PART ?= xc7z020clg400-1
KMOD_FILES = $(shell find $(KMOD_DIR) -maxdepth 1 -type f -name "*.[chsS]")
YOCTO_KMOD_DIR = $(META_ZYNQAES_DIR)/recipes-kernel/zynqaes/files
.PHONY: yocto
yocto:
cp -a $(KMOD_FILES) $(YOCTO_KMOD_DIR)
$(IP_REPO_DIR): $(HDL_SOURCES)
rm -rf $@
mkdir -p simulation
vivado -mode tcl \
-source "${TOOLS_DIR}/create_ip.tcl" \
-nolog -nojour \
-tclargs $(IP_NAME) stream master_slave $(SIM_DIR)
$(SIM_PROJ): $(IP_REPO_DIR)
rm -rf $@
HDL_INCLUDE=$(HDL_INCLUDE) TB_INCLUDE=$(TB_INCLUDE) \
vivado -mode tcl \
-source "$(TOOLS_DIR)/create_axi_stream_sim_proj.tcl" \
-nolog -nojour \
-tclargs $(IP_REPO_DIR) $(TB_DIR) $(SIM_DIR)
# Test targets
test_%:
@if ! test -d $(TB_TOP)/$*;then\
echo "ERROR: Testbench directory $(TB_TOP)/%* does not exist!";\
exit 1;\
fi
rm -rf $(SIM_DIR)/$@
mkdir -p $(SIM_DIR)/$@
cd $(SIM_DIR)/$@; $(TOOLS_DIR)/xsim.sh $(HDL_DIR) $(TB_TOP)/$* $(TB_TOP)/include
test: test_zynq_aes_top
$(SYNTH_DIR): $(IP_REPO_DIR) $(BD_SOURCES) $(XDC_FILES)
rm -rf $@
mkdir -p $@
TOOLS_DIR=$(TOOLS_DIR) PART=$(PART) vivado -mode tcl \
-source "$(TOOLS_DIR)/gen_bitstream.tcl" \
-nolog -nojour \
-tclargs $(BD_DIR) $(IP_REPO_DIR) $(SYNTH_DIR) $(REPORTS_DIR)
ip: $(IP_REPO_DIR)
bitstream: $(SYNTH_DIR)
clean_sim:
rm -rf $(SIM_DIR)
clean_bitstream:
rm -rf $(SYNTH_DIR)
.PHONY: clean
clean: clean_sim clean_bitstream