-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (73 loc) · 1.25 KB
/
Copy pathMakefile
File metadata and controls
91 lines (73 loc) · 1.25 KB
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
VERILATOR ?= verilator
TARGET ?= core
RTL_DIR := rtl
TB_DIR := sim/cpp
OBJ_DIR := build/$(TARGET)
SIM := $(OBJ_DIR)/V$(TARGET)
RTL_SRCS := $(shell find $(RTL_DIR) -name "*.svh") $(shell find $(RTL_DIR) -name "*.sv")
TB_SRC := $(TB_DIR)/t_$(TARGET).cpp
VERILATOR_FLAGS := \
--cc \
--exe \
--build \
--trace-fst \
--timing \
-Wall \
--Mdir $(OBJ_DIR)
.PHONY: all
all: test
# Build
$(SIM): $(RTL_SRCS) $(TB_SRC)
@mkdir -p build
$(VERILATOR) \
$(VERILATOR_FLAGS) \
-CFLAGS "-Ibuild" \
--top-module $(TARGET) \
$(RTL_SRCS) \
$(TB_SRC)
.PHONY: build
build: $(SIM)
# Run
.PHONY: run
run: $(SIM)
./$(SIM)
# Test
.PHONY: test
test: run
# Lint
.PHONY: lint
lint:
$(VERILATOR) \
--lint-only \
-Wall \
--top-module $(TARGET) \
$(RTL_SRCS)
# Waveforms
.PHONY: waves
waves:
gtkwave *.fst
# Convenience Targets
.PHONY: alu
alu:
$(MAKE) test TARGET=alu
.PHONY: reg_file
reg_file:
$(MAKE) test TARGET=reg_file
.PHONY: booth_mul
booth_mul:
$(MAKE) test TARGET=booth_mul
.PHONY: core
core:
$(MAKE) test TARGET=core
# Regression
.PHONY: regression
regression:
$(MAKE) test TARGET=alu
$(MAKE) test TARGET=reg_file
$(MAKE) test TARGET=booth_mul
$(MAKE) test TARGET=core
# Cleanup
.PHONY: clean
clean:
rm -rf build
rm -f *.fst *.vcd