-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.core
53 lines (42 loc) · 1.9 KB
/
Makefile.core
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
CFLAGS = -std=c++20 -O3 -flto
#CFLAGS = -std=c++20 -g -O0
VFLAGS = #--trace-fst
VLTPAT = /usr/share/verilator/include
VFILES = ver/video.sv \
ver/memory.sv \
ver/register.sv \
ver/core.sv \
ver/core_irq.sv \
ver/core_alu.sv \
ver/core_decoder.sv \
ver/core_executor.sv
VHEADERS = ver/core_control.svh
TOP = core
all: out/launch
clean:
rm -rf out/ver/* out/cpp/* out/launch
out/lib/verilated.o: $(VLTPAT)/verilated.cpp
g++ -c $(CFLAGS) -I$(VLTPAT) -I$(VLTPAT)/vltstd -o $@ $^
out/lib/verilated_fst_c.o: $(VLTPAT)/verilated_fst_c.cpp
g++ -c $(CFLAGS) -I$(VLTPAT) -I$(VLTPAT)/vltstd -o $@ $^
out/lib/verilated_vcd_c.o: $(VLTPAT)/verilated_vcd_c.cpp
g++ -c $(CFLAGS) -I$(VLTPAT) -I$(VLTPAT)/vltstd -o $@ $^
out/lib/verilated_dpi.o: $(VLTPAT)/verilated_dpi.cpp
g++ -c $(CFLAGS) -I$(VLTPAT) -I$(VLTPAT)/vltstd -o $@ $^
out/ver/libwidget.a out/ver/Vcore.h: $(VFILES) $(VHEADERS)
verilator --cc -Mdir out/ver -y ver -y ver/tests -y ver/games --top-module core $(VFILES) -CFLAGS "$(CFLAGS)" $(VFLAGS)
$(MAKE) -C out/ver -f V$(TOP).mk
mv out/ver/V$(TOP)__ALL.a out/ver/lib$(TOP).a
out/launch: cpp/widget_main.cpp out/ver/V$(TOP).h out/lib/verilated.o out/lib/verilated_fst_c.o out/lib/verilated_dpi.o out/ver/lib$(TOP).a
g++ $(CFLAGS) \
-Iout/ver \
-I$(VLTPAT) \
-I$(VLTPAT)/vltstd \
-o $@ \
-Wl,--start-group \
out/lib/verilated.o \
out/lib/verilated_fst_c.o \
out/lib/verilated_dpi.o \
cpp/nestest_main.cpp \
out/ver/lib$(TOP).a \
-Wl,--end-group