-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
90 lines (75 loc) · 3.18 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
ifdef GHDL
GHDL=$(GHDL)
else
GHDL=ghdl
endif
JAVA_HOME=$(shell readlink -f /usr/bin/java | sed "s:bin/java::")
CC=g++
CFLAGS=-std=c++11 -pedantic -Wall -Wextra -g
LDFLAGS=-lrt -lpthread
OUTPUT=./test.vcd
OUTPUT_TYPE=vcd
CLASSPATH=spinal.sim
SharedMemIface.o:
$(CC) -c -fPIC SharedMemIface.cpp -o SharedMemIface.o $(CFLAGS)
ghdl-mcode:
ghdl-mcode -a $(COMPONENT_SOURCE)
ghdl-mcode -e $(COMPONENT_NAME)
ghdl-mcode --vpi-compile $(CC) -c VpiPlugin.cpp $(CFLAGS) -o VpiPlugin.o
ghdl-mcode --vpi-link $(CC) VpiPlugin.o $(LDFLAGS) $(CFLAGS) -o VpiPlugin.vpi
$(CC) -c main.cpp -DRUN_SIMULATOR_COMMAND='"make run_ghdl-mcode"' -o main.o $(CFLAGS)
$(CC) -c SharedMemIface.cpp -o SharedMemIface.o $(CFLAGS)
$(CC) main.o SharedMemIface.o -o main $(CFLAGS) $(LDFLAGS)
./main
run_ghdl-mcode:
ghdl-mcode -r $(COMPONENT_NAME) --vpi=./VpiPlugin.vpi --$(OUTPUT_TYPE)=$(OUTPUT) &> /dev/null &
ghdl-gcc:
ghdl-gcc -a $(COMPONENT_SOURCE)
ghdl-gcc -e $(COMPONENT_NAME)
ghdl-gcc --vpi-compile $(CC) -c VpiPlugin.cpp $(CFLAGS) -o VpiPlugin.o
ghdl-gcc --vpi-link $(CC) VpiPlugin.o $(LDFLAGS) $(CFLAGS) -o VpiPlugin.vpi
$(CC) -c main.cpp -DRUN_SIMULATOR_COMMAND='"make run_ghdl-gcc"' -o main.o $(CFLAGS)
$(CC) -c SharedMemIface.cpp -o SharedMemIface.o $(CFLAGS)
$(CC) main.o SharedMemIface.o -o main $(CFLAGS) $(LDFLAGS)
./main
run_ghdl-gcc:
ghdl-gcc -r $(COMPONENT_NAME) --vpi=./VpiPlugin.vpi --$(OUTPUT_TYPE)=$(OUTPUT) &> /dev/null &
ghdl-llvm:
ghdl-llvm -a $(COMPONENT_SOURCE)
ghdl-llvm -e $(COMPONENT_NAME)
ghdl-llvm --vpi-compile $(CC) -c VpiPlugin.cpp $(CFLAGS) -o VpiPlugin.o
ghdl-llvm --vpi-link $(CC) VpiPlugin.o $(LDFLAGS) $(CFLAGS) -o VpiPlugin.vpi
$(CC) -c main.cpp -DRUN_SIMULATOR_COMMAND='"make run_ghdl-llvm"' -o main.o $(CFLAGS)
$(CC) -c SharedMemIface.cpp -o SharedMemIface.o $(CFLAGS)
$(CC) main.o SharedMemIface.o -o main $(CFLAGS) $(LDFLAGS)
./main
run_ghdl-llvm:
ghdl-llvm -r $(COMPONENT_NAME) --vpi=./VpiPlugin.vpi --$(OUTPUT_TYPE)=$(OUTPUT) &> /dev/null &
iverilog:
$(CC) -c VpiPlugin.cpp $(CFLAGS) $(shell iverilog-vpi --cflags) -o VpiPlugin.o
$(CC) VpiPlugin.o $(CFLAGS) $(shell iverilog-vpi --cflags) $(shell iverilog-vpi --lflags) $(shell iverilog-vpi --ldlibs) $(LDFLAGS) -shared -o VpiPlugin.vpi
iverilog $(COMPONENT_SOURCE) -s $(COMPONENT_NAME) -o iverilog_compiled.vvp
$(CC) -c main.cpp -DRUN_SIMULATOR_COMMAND='"make run_iverilog"' -o main.o $(CFLAGS)
$(CC) -c SharedMemIface.cpp -o SharedMemIface.o $(CFLAGS)
$(CC) main.o SharedMemIface.o -o main $(CFLAGS) $(LDFLAGS)
./main
run_iverilog:
vvp -M. -mVpiPlugin iverilog_compiled.vvp -$(OUTPUT_TYPE) &> /dev/null &
SharedMemIface_wrap.cxx:
swig -c++ -java SharedMemIface.i
SharedMemIface_wrap.o: SharedMemIface_wrap.cxx
$(CC) -c -fPIC -I$(JAVA_HOME)include -I$(JAVA_HOME)include/linux SharedMemIface_wrap.cxx -o SharedMemIface_wrap.o
SharedMemIface.so: SharedMemIface_wrap.o SharedMemIface.o
$(CC) -shared -fPIC -o SharedMemIface.so SharedMemIface_wrap.o SharedMemIface.o $(CFLAGS) $(LDFLAGS)
clean:
rm -f *.vpi
rm -f *.o
rm -f *.out
rm -f *.so
rm -f simulation
rm -f *.lst
rm -f *.cf
rm -f *.vcd
rm -f *.cxx
rm -f *.java
.PHONY: ghdl-mcode ghdl-gcc ghdl-llvm iverilog run_ghdl-mcode run_ghdl-gcc run_ghdl-llvm iverilog