-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmakefile
More file actions
43 lines (32 loc) · 1.25 KB
/
makefile
File metadata and controls
43 lines (32 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
# vhdl files
FILES = source/*.vhd
VHDLEX = .vhd
# testbench
TESTBENCHPATH = simulation/${TESTBENCH}$(VHDLEX)
#GHDL CONFIG
GHDL_CMD = ghdl
GHDL_FLAGS = --ieee=synopsys --warn-no-vital-generic
SIMDIR = simulation/libs
# Simulation break condition
#GHDL_SIM_OPT = --assert-level=error
GHDL_SIM_OPT = --stop-time=1ms
WAVEFORM_VIEWER = gtkwave
all: compile run view
new :
echo "Setting up project ${PROJECT}"
mkdir source simulation synthesis $(SIMDIR)
compile :
ifeq ($(strip $(TESTBENCH)),)
@echo "TESTBENCH not set. Use TESTBENCH=value to set it."
@exit 2
endif
mkdir -p $(SIMDIR)
$(GHDL_CMD) -i $(GHDL_FLAGS) --workdir=$(SIMDIR) --work=work $(TESTBENCHPATH) $(FILES)
$(GHDL_CMD) -m $(GHDL_FLAGS) --workdir=$(SIMDIR) --work=work $(TESTBENCH)
@mv $(TESTBENCH) $(SIMDIR)/$(TESTBENCH)
run :
@$(SIMDIR)/$(TESTBENCH) $(GHDL_SIM_OPT) --vcdgz=$(SIMDIR)/$(TESTBENCH).vcdgz
view :
gunzip --stdout $(SIMDIR)/$(TESTBENCH).vcdgz | $(WAVEFORM_VIEWER) --vcd
clean :
$(GHDL_CMD) --clean --workdir=$(SIMDIR)