forked from hamzajaved780/neuroquant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (59 loc) · 2.32 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
SOURCE_FILES := myproject_test.cpp firmware/myproject.cpp
HLS_CXX_FLAGS := --fpc --fp-relaxed
CXX := i++
override CXXFLAGS := $(CXXFLAGS)
VERBOSE := 1
DEVICE := Arria10
CLOCK := 4ns
# OS-dependant tools
ifeq ($(OS),Windows_NT)
RM := rd /S /Q
else
RM := rm -rf
endif
ifeq ($(MAKECMDGOALS),)
$(info No target specified, defaulting to test-x86-64)
$(info Available targets: test-x86-64, test-fpga, test-gpp, clean)
endif
# Any tools installed with HLS can be found relative to the location of i++
HLS_INSTALL_DIR := $(shell which i++ | sed 's|/bin/i++||g')
# Run the i++ x86 test by default
.PHONY: default
default: myproject-x86-64
# Compile the component and testbench using g++ and run them as a regular program
.PHONY: myproject-gpp
myproject-gpp: CXX := g++
myproject-gpp: CXXFLAGS := $(CXXFLAGS) -I"$(HLS_INSTALL_DIR)/include" -L"$(HLS_INSTALL_DIR)/host/linux64/lib" -lhls_emul -o myproject-gpp
myproject-gpp: $(SOURCE_FILES)
$(CXX) $(SOURCE_FILES) $(CXXFLAGS)
@echo "+------------------------------------------+"
@echo "| Run ./myproject-gpp to execute the test. |"
@echo "+------------------------------------------+"
# Run the testbench and the component as a regular program
.PHONY: myproject-x86-64
myproject-x86-64: CXXFLAGS := $(CXXFLAGS) $(HLS_CXX_FLAGS) -I"$(HLS_INSTALL_DIR)/include" -march=x86-64 -o myproject-x86-64
myproject-x86-64: $(SOURCE_FILES)
$(CXX) $(SOURCE_FILES) $(CXXFLAGS)
@echo "+---------------------------------------------+"
@echo "| Run ./myproject-x86-64 to execute the test. |"
@echo "+---------------------------------------------+"
# Run a simulation with the C testbench and verilog component
.PHONY: myproject-fpga
ifeq ($(VERBOSE),1)
myproject-fpga: CXXFLAGS := $(CXXFLAGS) -v
endif
myproject-fpga: CXXFLAGS := $(CXXFLAGS) $(HLS_CXX_FLAGS) -march="10AX115U1F45I1SG" -o myproject-fpga --clock $(CLOCK)
myproject-fpga: $(SOURCE_FILES)
$(CXX) $(SOURCE_FILES) $(CXXFLAGS)
@echo "+-------------------------------------------+"
@echo "| Run ./myproject-fpga to execute the test. |"
@echo "+-------------------------------------------+"
# Clean up temprary and delivered files
CLEAN_FILES := myproject-gpp \
myproject-gpp.prj \
myproject-fpga \
myproject-fpga.prj \
myproject-x86-64 \
myproject-x86-64.prj
clean:
-$(RM) $(CLEAN_FILES)