-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
121 lines (96 loc) · 3.63 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
-include .config.mk
SYSTEMC ?= /usr
SYSTEMC_INCLUDE ?=$(SYSTEMC)/include/
SYSTEMC_LIBDIR ?= $(SYSTEMC)/lib-linux64
SV2V ?= sv2v
YOSYS ?= yosys
VIVADO ?= vivado
VERILATOR ?= verilator
VERILATOR_ROOT?=$(shell $(VERILATOR) --getenv VERILATOR_ROOT 2>/dev/null || echo -n /usr/share/verilator)
VOBJ_DIR=obj_dir
VFLAGS += --exe
VFLAGS += --assert
VFLAGS += -Wno-fatal
VFLAGS += --trace
VFLAGS += --sc --pins-bv 2
VFLAGS += -Mdir $(VOBJ_DIR)
VFLAGS += -Irtl
VFLAGS += -DSIM_ECALL
VENV=SYSTEMC_INCLUDE=$(SYSTEMC_INCLUDE) SYSTEMC_LIBDIR=$(SYSTEMC_LIBDIR)
CPPFLAGS += -I. -I../ -I../tb -I$(VERILATOR_ROOT)/include/
CPPFLAGS += -I../libsystemctlm-soc/ -I../libsystemctlm-soc/tests/
CPPFLAGS += -I $(SYSTEMC_INCLUDE)
CPPFLAGS += -DVM_TRACE=1
OPT_FAST ?= -O2 -fno-stack-protector -fno-var-tracking-assignments
OPT_SLOW ?= -O1 -fstrict-aliasing -fno-var-tracking-assignments
export OPT_FAST
export OPT_SLOW
CXXFLAGS += -Wall -O3 -g -faligned-new
LDFLAGS += -L $(SYSTEMC_LIBDIR)
SC_FILES_COMMON += libsystemctlm-soc/trace/trace.cc
# To make the filenames match the top module
# (and avoid additional args to verilator we use underscores instead
# of hyphens.
SC_FILES_rvee_fetch_tb += tb/rvee_fetch_tb.cc
SV_FILES_rvee_fetch_tb += tb/rvee_fetch_tb.sv
SV_FILES_rvee_fetch_tb += rtl/rvee/rvee-pcgen.sv
SV_FILES_rvee_fetch_tb += rtl/rvee/rvee-fetch.sv
ALL += $(VOBJ_DIR)/Vrvee_fetch_tb.build
SC_FILES_rvee_decode_tb += tb/rvee_decode_tb.cc
SV_FILES_rvee_decode_tb += tb/rvee_decode_tb.sv
SV_FILES_rvee_decode_tb += rtl/rvee/rvee-decode.sv
SV_FILES_rvee_decode_tb += rtl/rvee/rvee-csr.sv
SV_FILES_rvee_decode_tb += rtl/rvee/rvee-rf.sv
ALL += $(VOBJ_DIR)/Vrvee_decode_tb.build
SC_FILES_rvee_exec_tb += tb/rvee_exec_tb.cc
SV_FILES_rvee_exec_tb += tb/rvee_exec_tb.sv
SV_FILES_rvee_exec_tb += rtl/rvee/rvee-pcgen.sv
SV_FILES_rvee_exec_tb += rtl/rvee/rvee-exec.sv
SV_FILES_rvee_exec_tb += rtl/rvee/rvee-alu.sv
ALL += $(VOBJ_DIR)/Vrvee_exec_tb.build
SC_FILES_rvee_mem_tb += tb/rvee_mem_tb.cc
SV_FILES_rvee_mem_tb += tb/rvee_mem_tb.sv
SV_FILES_rvee_mem_tb += rtl/rvee/rvee-mem.sv
ALL += $(VOBJ_DIR)/Vrvee_mem_tb.build
SC_FILES_rvee_tb += tb/rvee_tb.cc
SC_FILES_rvee_tb += libsystemctlm-soc/tests/test-modules/memory.cc
SV_FILES_rvee_tb += tb/rvee_tb.sv
SV_FILES_rvee_tb += rtl/rvee/rvee.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-fetch.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-decode.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-alu.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-exec.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-mem.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-rf.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-csr.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-pcgen.sv
SV_FILES_rvee_tb += rtl/rvee/rvee-wrapper.sv
SV_FILES_rvee_tb += rtl/clint/clint.sv
ALL += $(VOBJ_DIR)/Vrvee_tb.build
SC_FILES_plic_tb += tb/plic_tb.cc
SV_FILES_plic_tb += tb/plic_tb.sv
SV_FILES_plic_tb += rtl/plic/plic.sv
ALL += $(VOBJ_DIR)/Vplic_tb.build
SC_FILES_clint_tb += tb/clint_tb.cc
SV_FILES_clint_tb += tb/clint_tb.sv
SV_FILES_clint_tb += rtl/clint/clint.sv
ALL += $(VOBJ_DIR)/Vclint_tb.build
all: $(ALL)
$(VOBJ_DIR)/V%.build:
$(VENV) $(VERILATOR) $(VFLAGS) $(SV_FILES_$(*)) $(SC_FILES_COMMON) $(SC_FILES_$(*))
$(MAKE) -C $(VOBJ_DIR) -f V$(*).mk CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" V$(*)
pickle-%.v: Makefile $(SV_FILES_$(*))
$(SV2V) -Irtl $(SV_FILES_$(*)) >$@
pickle: pickle-rvee_tb.v
stat:
$(YOSYS) -s ./scripts/rvee-synth.yosys
vv-synth:
$(VIVADO) -nojournal -nolog -mode batch -source ./scripts/vivado/rvee-synth.tcl
vv-ip:
$(VIVADO) -nojournal -nolog -mode batch -source ./scripts/vivado/rvee-ip.tcl
check: $(ALL)
for t in $(shell ls riscv-tests/isa/rv32ui-p-*.bin); do \
./obj_dir/Vrvee_tb $${t}; \
done
clean distclean:
$(RM) -fr $(VOBJ_DIR)