-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (59 loc) · 1.75 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
REGRESSION_PATH?=./
VEXRISCV_FILE?=VexRiscv.v
IBUS?=CACHED
IBUS_DATA_WIDTH?=32
DBUS?=CACHED
DBUS_DATA_WIDTH?=32
THREAD_COUNT?=$(shell nproc)
MEASUREMENTS?=N
include MyMakefile.mk
ADDCFLAGS += -CFLAGS -DREGRESSION_PATH='\"$(REGRESSION_PATH)/\"'
ADDCFLAGS += -CFLAGS -DIBUS_${IBUS}
ADDCFLAGS += -CFLAGS -DIBUS_DATA_WIDTH=${IBUS_DATA_WIDTH}
ADDCFLAGS += -CFLAGS -DDBUS_DATA_WIDTH=${DBUS_DATA_WIDTH}
ADDCFLAGS += -CFLAGS -DDBUS_${DBUS}
ADDCFLAGS += -CFLAGS -DREDO=${REDO}
ADDCFLAGS += -CFLAGS -pthread
ADDCFLAGS += -CFLAGS -Wno-unused-result
ADDCFLAGS += -CFLAGS -DTHREAD_COUNT=${THREAD_COUNT}
ADDCFLAGS += -CFLAGS -DSTALL=1
ADDCFLAGS += -CFLAGS -O3
ifneq ($(SHOWPC),)
ADDCFLAGS += -CFLAGS -DSHOWPC=1
endif
ifeq ($(DEP_HASH)$(PREFLIGHT),)
DIR:=obj_dir
TARGET_CORE:=VexRiscv.v
else
DIR:=obj_dir_$(DEP_HASH)
TARGET_CORE:=cores/$(DEP_HASH)/VexRiscv.v
endif
CURRENT_DIR := $(shell pwd)
ifeq ($(PREFLIGHT),)
ADD_INCLUDE :=
else
ifeq ($(DEP_HASH),)
ADD_INCLUDE := $(CURRENT_DIR)/cores
else
ADD_INCLUDE := $(CURRENT_DIR)/cores/$(DEP_HASH)
endif
endif
all: verilator/$(DIR)/VVexRiscv
folder:
mkdir -p cores
mkdir -p verilator
touch cores/instructions_c.h
touch cores/instructions.py
verilator/$(DIR)/VVexRiscv.cpp: ${TARGET_CORE} profile.cpp | folder
cp ${TARGET_CORE}*.bin . | true
verilator -cc -Mdir verilator/$(DIR) ${TARGET_CORE} --prefix VVexRiscv -O3 -CFLAGS -std=c++11 -LDFLAGS -pthread ${ADDCFLAGS} --gdbbt ${VERILATOR_ARGS} -Wno-UNOPTFLAT -Wno-WIDTH --exe ../profile.cpp --x-assign unique
verilator/$(DIR)/VVexRiscv: verilator/$(DIR)/VVexRiscv.cpp
$(MAKE) -j${THREAD_COUNT} -C verilator/$(DIR)/ -f VVexRiscv.mk VVexRiscv
clean:
-rm -rf cores/$(DEP_HASH)
-rm -rf verilator/$(DIR)
-rm -f *.debugTrace
-rm -f *.logTrace
cleanAll:
-rm -rf cores
-rm -rf verilator