-
Notifications
You must be signed in to change notification settings - Fork 16
/
makefile
73 lines (62 loc) · 2.04 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
# author: Furkan Cayci, 2018
# description:
# add ghdl to your PATH for simulation
# add gtkwave to your PATH for displayin the waveform
CC = ghdl
SIM = gtkwave
ARCHNAME = tb_hdmi_out
STOPTIME = 4us
# update Xilinx Vivado installation path
XILINX_VIVADO ?= /opt/apps/Xilinx/Vivado/2019.1
UNISIM_PATH = $(XILINX_VIVADO)/data/vhdl/src/unisims
# use VHDL 2002 standard
VHDLSTD = --std=02
# order is important
SRCS += rtl/clock_gen.vhd
SRCS += rtl/serializer.vhd
SRCS += rtl/tmds_encoder.vhd
SRCS += rtl/timing_generator.vhd
SRCS += rtl/rgb2tmds.vhd
SRCS += rtl/pattern_generator.vhd
SRCS += rtl/objectbuffer.vhd
SRCS += rtl/hdmi_out.vhd
TBS = $(wildcard sim/tb_*.vhd)
TB = sim/$(ARCHNAME).vhd
WORKDIR = debug
# all the used primitives are added individually
#UNISRCS += $(UNISIM_PATH)/*.vhd
#UNISRCS += $(UNISIM_PATH)/primitive/*.vhd
UNISRCS += $(UNISIM_PATH)/unisim_VCOMP.vhd
UNISRCS += $(UNISIM_PATH)/unisim_VPKG.vhd
UNISRCS += $(UNISIM_PATH)/primitive/BUFG.vhd
UNISRCS += $(UNISIM_PATH)/primitive/OBUFDS.vhd
UNISRCS += $(UNISIM_PATH)/primitive/PLLE2_ADV.vhd
UNISRCS += $(UNISIM_PATH)/primitive/PLLE2_BASE.vhd
# OSERDESE2 is encrypted IP core, and it cannot
# be simulated using GHDL. Thus, we will downgrade
# it to OSERDESE1 (from 6-series)
UNISRCS += $(UNISIM_PATH)/primitive/OSERDESE1.vhd
OBJS = $(patsubst sim/%.vhd, %.bin, $(TBS))
.PHONY: all
all: clean analyze
@echo "completed..."
.PHONY: analyze
analyze:
@echo "analyzing designs..."
@mkdir -p $(WORKDIR)
$(CC) -a --work=unisim --workdir=$(WORKDIR) -fexplicit $(VHDLSTD) \
--ieee=synopsys $(UNISRCS)
$(CC) -a --workdir=$(WORKDIR) -P$(WORKDIR) $(VHDLSTD) $(SRCS) $(TBS)
.PHONY: simulate
simulate: clean analyze
@echo "simulating design:" $(TB)
$(CC) --elab-run --workdir=$(WORKDIR) -P$(WORKDIR) $(VHDLSTD) -fexplicit \
--ieee=synopsys -o $(WORKDIR)/$(ARCHNAME).bin $(ARCHNAME) \
--vcd=$(WORKDIR)/$(ARCHNAME).vcd --stop-time=$(STOPTIME)
$(SIM) $(WORKDIR)/$(ARCHNAME).vcd
.PHONY: clean
clean:
@echo "cleaning design..."
ghdl --remove --workdir=$(WORKDIR)
rm -f $(WORKDIR)/*
rm -rf $(WORKDIR)