1 |
8 |
dgisselq |
################################################################################
|
2 |
|
|
#
|
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 |
|
|
################################################################################
|
14 |
|
|
#
|
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 |
|
|
#
|
36 |
|
|
################################################################################
|
37 |
|
|
#
|
38 |
|
|
#
|
39 |
|
|
.PHONY: all
|
40 |
|
|
all: busmaster altbusmaster
|
41 |
|
|
|
42 |
|
|
CPUD := cpu
|
43 |
|
|
RAWZIP := zipbones.v zipcpu.v cpudefs.v \
|
44 |
|
|
prefetch.v idecode.v cpuops.v memops.v \
|
45 |
|
|
wbdblpriarb.v
|
46 |
|
|
ZIPSRC := $(addprefix $(CPUD)/,$(RAWZIP))
|
47 |
|
|
BUSSRC := builddate.v llqspi.v wbicape6.v wbicapesimple.v wbscope.v \
|
48 |
|
|
memdev.v rtclight.v spio.v wbgpio.v wbpwmaudio.v
|
49 |
|
|
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 |
|
|
$(BUSSRC) wbdeppsimple.v
|
54 |
|
|
# alttop.v rxuart.v txuart.v
|
55 |
|
|
# rtcdate.v wbubus.v
|
56 |
|
|
|
57 |
|
|
VOBJ := obj_dir
|
58 |
|
|
|
59 |
|
|
$(VOBJ)/Vbusmaster.cpp: $(MAINSRC)
|
60 |
|
|
verilator -cc -y $(CPUD) busmaster.v
|
61 |
|
|
$(VOBJ)/Vbusmaster.h: $(VOBJ)/Vbusmaster.cpp
|
62 |
|
|
|
63 |
|
|
$(VOBJ)/Valtbusmaster.cpp: $(ALTSRC)
|
64 |
|
|
verilator -cc -y $(CPUD) altbusmaster.v
|
65 |
|
|
$(VOBJ)/Valtbusmaster.h: $(VOBJ)/Valtbusmaster.cpp
|
66 |
|
|
|
67 |
|
|
$(VOBJ)/Vbusmaster__ALL.a: $(VOBJ)/Vbusmaster.cpp $(VOBJ)/Vbusmaster.h
|
68 |
|
|
cd $(VOBJ); make --no-print-directory -f Vbusmaster.mk
|
69 |
|
|
|
70 |
|
|
$(VOBJ)/Valtbusmaster__ALL.a: $(VOBJ)/Valtbusmaster.cpp $(VOBJ)/Valtbusmaster.h
|
71 |
|
|
cd $(VOBJ); make --no-print-directory -f Valtbusmaster.mk
|
72 |
|
|
|
73 |
|
|
cpudefs.h: cpudefs.v
|
74 |
|
|
@echo "Building cpudefs.h"
|
75 |
|
|
@echo "// " > $@
|
76 |
|
|
@echo "// Do not edit this file, it is automatically generated!" >> $@
|
77 |
|
|
@echo "// To generate this file, \"make cpudefs.h\" in the rtl directory." >> $@
|
78 |
|
|
@echo "// " >> $@
|
79 |
|
|
@grep "^\`" $^ | sed -e '{ s/^`/#/ }' >> $@
|
80 |
|
|
|
81 |
|
|
.PHONY: busmaster
|
82 |
|
|
busmaster: $(VOBJ)/Vbusmaster__ALL.a
|
83 |
|
|
|
84 |
|
|
.PHONY: altbusmaster
|
85 |
|
|
altbusmaster: $(VOBJ)/Valtbusmaster__ALL.a
|
86 |
|
|
|
87 |
|
|
.PHONY: clean
|
88 |
|
|
clean:
|
89 |
|
|
rm -rf $(VOBJ) cpudefs.h
|