-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (63 loc) · 1.84 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
# Verilog Files
SRC_MASTER = $(shell pwd)/src/I2C_Master.v
TB_MASTER = $(shell pwd)/tb/I2C_Master_tb.v
VVP_MASTER = $(shell pwd)/temp/I2C_Master_tb.vvp
VCD_MASTER = $(shell pwd)/temp/I2C_Master_tb.vcd
SRC_SLAVE = $(shell pwd)/src/I2C_Slave.v
TB_SLAVE = $(shell pwd)/tb/I2C_Slave_tb.v
VVP_SLAVE = $(shell pwd)/temp/I2C_Slave_tb.vvp
VCD_SLAVE = $(shell pwd)/temp/I2C_Slave_tb.vcd
SRC_I2C = $(shell pwd)/src/I2C.v
TB_I2C = $(shell pwd)/tb/I2C_tb.v
VVP_I2C = $(shell pwd)/temp/I2C_tb.vvp
VCD_I2C = $(shell pwd)/temp/I2C_tb.vcd
SRC_WRAPPER = $(shell pwd)/src/wrapper.v
TB_WRAPPER = $(shell pwd)/tb/wrapper_tb.v
VVP_WRAPPER = $(shell pwd)/temp/wrapper_tb.vvp
VCD_WARPPER = $(shell pwd)/temp/wrapper_tb.vcd
# Compilation Settings
COMPILER = iverilog
COMPILER_FLAG = -o
# Simulation Settings
SIMULATION_FLAG = vvp
# Target: MAIN
all: i2c
everything: i2c master slave wrapper
clean:
rm -rf temp
# Target: Master Adaptor
master: compile_master
$(SIMULATION_FLAG) $(VVP_MASTER)
compile_master:
mkdir -p temp
$(COMPILER) $(COMPILER_FLAG) $(VVP_MASTER) $(TB_MASTER) $(SRC_MASTER)
clean_master:
rm -rf $(VCD_MASTER)
rm -rf $(VVP_MASTER)
# Target: Slave Adaptor
slave: compile_slave
$(SIMULATION_FLAG) $(VVP_SLAVE)
compile_slave:
mkdir -p temp
$(COMPILER) $(COMPILER_FLAG) $(VVP_SLAVE) $(TB_SLAVE) $(SRC_SLAVE)
clean_slave:
rm -rf $(VCD_SLAVE)
rm -rf $(VVP_SLAVE)
# Target: I2C
i2c: compile_i2c
$(SIMULATION_FLAG) $(VVP_I2C)
compile_i2c:
mkdir -p temp
$(COMPILER) $(COMPILER_FLAG) $(VVP_I2C) $(TB_I2C) $(SRC_I2C) $(SRC_MASTER) $(SRC_SLAVE)
clean_i2c:
rm -rf $(VCD_I2C)
rm -rf $(VVP_I2C)
# Target: Wrapper
wrapper: compile_wrapper
$(SIMULATION_FLAG) $(VVP_WRAPPER)
compile_wrapper:
mkdir -p temp
$(COMPILER) $(COMPILER_FLAG) $(VVP_WRAPPER) $(TB_WRAPPER) $(SRC_WRAPPER) $(SRC_MASTER)
clean_wrapper:
rm -rf $(VCD_WARPPER)
rm -rf $(VVP_WRAPPER)