1 |
8 |
dgisselq |
################################################################################
|
2 |
46 |
dgisselq |
##
|
3 |
|
|
## Filename: rtl/Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: CMod S6 System on a Chip, ZipCPU demonstration project
|
6 |
|
|
##
|
7 |
|
|
## Purpose: This makefile builds a verilator simulation of the zipsystem.
|
8 |
|
|
## It does not make the system within Vivado or Quartus.
|
9 |
|
|
##
|
10 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
11 |
|
|
## Gisselquist Technology, LLC
|
12 |
|
|
##
|
13 |
8 |
dgisselq |
################################################################################
|
14 |
46 |
dgisselq |
##
|
15 |
|
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
16 |
|
|
##
|
17 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
18 |
|
|
## modify it under the terms of the GNU General Public License as published
|
19 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
20 |
|
|
## your option) any later version.
|
21 |
|
|
##
|
22 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
23 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
24 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
25 |
|
|
## for more details.
|
26 |
|
|
##
|
27 |
|
|
## You should have received a copy of the GNU General Public License along
|
28 |
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
29 |
|
|
## target there if the PDF file isn't present.) If not, see
|
30 |
|
|
## for a copy.
|
31 |
|
|
##
|
32 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
33 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
34 |
|
|
##
|
35 |
8 |
dgisselq |
#
|
36 |
|
|
################################################################################
|
37 |
46 |
dgisselq |
##
|
38 |
|
|
##
|
39 |
8 |
dgisselq |
.PHONY: all
|
40 |
51 |
dgisselq |
all: busmaster altbusmaster cpudefs.h
|
41 |
46 |
dgisselq |
YYMMDD=`date +%Y%m%d`
|
42 |
8 |
dgisselq |
CPUD := cpu
|
43 |
|
|
RAWZIP := zipbones.v zipcpu.v cpudefs.v \
|
44 |
|
|
prefetch.v idecode.v cpuops.v memops.v \
|
45 |
51 |
dgisselq |
wbdblpriarb.v dblfetch.v
|
46 |
8 |
dgisselq |
ZIPSRC := $(addprefix $(CPUD)/,$(RAWZIP))
|
47 |
51 |
dgisselq |
BUSSRC := builddate.v llqspi.v wbscope.v memdev.v spio.v wbgpio.v wbpwmaudio.v\
|
48 |
|
|
qflashxpress.v
|
49 |
8 |
dgisselq |
MAINSRC := busmaster.v builddate.v flash_config.v wbqspiflash.v \
|
50 |
|
|
$(BUSSRC) $(ZIPSRC)
|
51 |
|
|
# toplevel.v rxuart.v txuart.v
|
52 |
|
|
ALTSRC := altbusmaster.v builddate.v flash_config.v wbqspiflash.v \
|
53 |
46 |
dgisselq |
$(BUSSRC) wbubus.v
|
54 |
8 |
dgisselq |
# alttop.v rxuart.v txuart.v
|
55 |
|
|
VOBJ := obj_dir
|
56 |
|
|
|
57 |
|
|
$(VOBJ)/Vbusmaster.cpp: $(MAINSRC)
|
58 |
46 |
dgisselq |
verilator -trace -cc -y $(CPUD) busmaster.v
|
59 |
8 |
dgisselq |
$(VOBJ)/Vbusmaster.h: $(VOBJ)/Vbusmaster.cpp
|
60 |
|
|
|
61 |
51 |
dgisselq |
$(VOBJ)/Vbusmaster__ALL.a: $(VOBJ)/Vbusmaster.cpp $(VOBJ)/Vbusmaster.h
|
62 |
|
|
cd $(VOBJ); make --no-print-directory -f Vbusmaster.mk
|
63 |
|
|
|
64 |
8 |
dgisselq |
$(VOBJ)/Valtbusmaster.cpp: $(ALTSRC)
|
65 |
46 |
dgisselq |
verilator -trace -cc -y $(CPUD) altbusmaster.v
|
66 |
8 |
dgisselq |
$(VOBJ)/Valtbusmaster.h: $(VOBJ)/Valtbusmaster.cpp
|
67 |
|
|
|
68 |
51 |
dgisselq |
$(VOBJ)/Valtbusmaster__ALL.a: $(VOBJ)/Valtbusmaster.cpp $(VOBJ)/Valtbusmaster.h
|
69 |
|
|
cd $(VOBJ); make --no-print-directory -f Valtbusmaster.mk
|
70 |
8 |
dgisselq |
|
71 |
51 |
dgisselq |
$(VOBJ)/Vdblfetch.cpp: $(ALTSRC)
|
72 |
|
|
verilator -trace -cc -y $(CPUD) dblfetch.v
|
73 |
|
|
$(VOBJ)/Vdblfetch.mk: $(VOBJ)/Vdblfetch.cpp
|
74 |
|
|
$(VOBJ)/Vdblfetch.h: $(VOBJ)/Vdblfetch.cpp
|
75 |
|
|
|
76 |
46 |
dgisselq |
$(VOBJ)/V%__ALL.a: $(VOBJ)/V%.mk
|
77 |
51 |
dgisselq |
make -f V$*.mk -C obj_dir
|
78 |
46 |
dgisselq |
|
79 |
51 |
dgisselq |
cpudefs.h: cpu/cpudefs.v
|
80 |
8 |
dgisselq |
@echo "Building cpudefs.h"
|
81 |
|
|
@echo "// " > $@
|
82 |
|
|
@echo "// Do not edit this file, it is automatically generated!" >> $@
|
83 |
|
|
@echo "// To generate this file, \"make cpudefs.h\" in the rtl directory." >> $@
|
84 |
|
|
@echo "// " >> $@
|
85 |
51 |
dgisselq |
@sed -e '{ s/^`/#/ }' $< | sed -e ' s/cpudefs.v/cpudefs.h/' >> $@
|
86 |
8 |
dgisselq |
|
87 |
|
|
.PHONY: busmaster
|
88 |
|
|
busmaster: $(VOBJ)/Vbusmaster__ALL.a
|
89 |
|
|
|
90 |
|
|
.PHONY: altbusmaster
|
91 |
|
|
altbusmaster: $(VOBJ)/Valtbusmaster__ALL.a
|
92 |
|
|
|
93 |
|
|
.PHONY: clean
|
94 |
|
|
clean:
|
95 |
|
|
rm -rf $(VOBJ) cpudefs.h
|