1 |
2 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: wbuart32, a full featured UART with simulator
|
6 |
|
|
##
|
7 |
|
|
## Purpose: To direct the Verilator build of the Verilog portion of the
|
8 |
|
|
## bench test. The result is C++ code (built by Verilator), that
|
9 |
|
|
## is then built (herein) into a library.
|
10 |
|
|
##
|
11 |
5 |
dgisselq |
## ALTERNATE_PURPOSE:
|
12 |
|
|
## All of the Verilog files within this directory may be made top level
|
13 |
|
|
## files in their own right for the purpose of testing the UART capability
|
14 |
|
|
## of your board. Should you wish to test these as toplevel files, you
|
15 |
|
|
## will need to remove the i_setup from the input, and set it to something
|
16 |
|
|
## like:
|
17 |
|
|
## wire [29:0] i_setup;
|
18 |
2 |
dgisselq |
##
|
19 |
5 |
dgisselq |
## // If we have a 100MHz clock, then we can set up for a 115,200
|
20 |
|
|
## // baud clock by setting i_setup to (100MHz / 115200) ~= 868.
|
21 |
|
|
## // The upper bits of this number also set the protocol to
|
22 |
|
|
## // one stop bit, no parity, and 8 data bits.
|
23 |
|
|
## assign i_setup = 30'd868; // 115,200 Baud 8N1
|
24 |
|
|
##
|
25 |
|
|
## Using this purpose, the UART ports of a new piece of hardware may be
|
26 |
|
|
## proven. To do this,
|
27 |
|
|
## 1. get BLINKY working first--to prove that the clock works like
|
28 |
|
|
## you think it does. Then, once BLINKY is running,
|
29 |
|
|
## 2. get helloworld working. This requires only the clock and
|
30 |
|
|
## the output UART pin to work.
|
31 |
|
|
## (Aside) 3. Once helloworld works, you should be able to get
|
32 |
|
|
## speechfifo to work with no further hassles.
|
33 |
|
|
## 4. After helloworld works, switch to getting linetest running on
|
34 |
|
|
## your hardware. This will prove that you have not only
|
35 |
|
|
## the clock and output UART pin working, but that you also
|
36 |
|
|
## have the input UART pin working as well.
|
37 |
|
|
##
|
38 |
|
|
## Targets: The default target of this makefile, all, builds the target
|
39 |
|
|
## test, which includes the linetest Verilator library, the
|
40 |
|
|
## helloworld Verilator library, and the speechfifo Verilator library--all
|
41 |
|
|
## necessary for bench testing using the C++ files in bench/cpp.
|
42 |
|
|
##
|
43 |
2 |
dgisselq |
## Creator: Dan Gisselquist, Ph.D.
|
44 |
|
|
## Gisselquist Technology, LLC
|
45 |
|
|
##
|
46 |
|
|
################################################################################
|
47 |
|
|
##
|
48 |
|
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
49 |
|
|
##
|
50 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
51 |
|
|
## modify it under the terms of the GNU General Public License as published
|
52 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
53 |
|
|
## your option) any later version.
|
54 |
|
|
##
|
55 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
56 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
57 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
58 |
|
|
## for more details.
|
59 |
|
|
##
|
60 |
|
|
## You should have received a copy of the GNU General Public License along
|
61 |
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
62 |
|
|
## target there if the PDF file isn't present.) If not, see
|
63 |
|
|
## for a copy.
|
64 |
|
|
##
|
65 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
66 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
67 |
|
|
##
|
68 |
|
|
################################################################################
|
69 |
|
|
##
|
70 |
|
|
##
|
71 |
|
|
all: test
|
72 |
|
|
YYMMDD=`date +%Y%m%d`
|
73 |
|
|
CXX := g++
|
74 |
|
|
FBDIR := .
|
75 |
|
|
VDIRFB:= $(FBDIR)/obj_dir
|
76 |
|
|
RTLDR := ../../rtl
|
77 |
|
|
|
78 |
5 |
dgisselq |
.PHONY: test testline testhello speechfifo
|
79 |
|
|
test: testline testhello speechfifo
|
80 |
|
|
testline: $(VDIRFB)/Vlinetest__ALL.a
|
81 |
|
|
testhello: $(VDIRFB)/Vhelloworld__ALL.a
|
82 |
|
|
speechfifo: $(VDIRFB)/Vspeechfifo__ALL.a
|
83 |
2 |
dgisselq |
|
84 |
|
|
$(VDIRFB)/Vlinetest__ALL.a: $(VDIRFB)/Vlinetest.h $(VDIRFB)/Vlinetest.cpp
|
85 |
|
|
$(VDIRFB)/Vlinetest__ALL.a: $(VDIRFB)/Vlinetest.mk
|
86 |
|
|
$(VDIRFB)/Vlinetest.h $(VDIRFB)/Vlinetest.cpp $(VDIRFB)/Vlinetest.mk: linetest.v
|
87 |
|
|
$(VDIRFB)/Vlinetest.h $(VDIRFB)/Vlinetest.cpp $(VDIRFB)/Vlinetest.mk: $(RTLDR)/rxuart.v $(RTLDR)/txuart.v
|
88 |
15 |
dgisselq |
$(VDIRFB)/Vlinetest.h $(VDIRFB)/Vlinetest.cpp $(VDIRFB)/Vlinetest.mk: $(RTLDR)/rxuartlite.v $(RTLDR)/txuartlite.v
|
89 |
2 |
dgisselq |
|
90 |
5 |
dgisselq |
$(VDIRFB)/Vhelloworld__ALL.a: $(VDIRFB)/Vhelloworld.h $(VDIRFB)/Vhelloworld.cpp
|
91 |
|
|
$(VDIRFB)/Vhelloworld__ALL.a: $(VDIRFB)/Vhelloworld.mk
|
92 |
|
|
$(VDIRFB)/Vhelloworld.h $(VDIRFB)/Vhelloworld.cpp $(VDIRFB)/Vhelloworld.mk: helloworld.v
|
93 |
15 |
dgisselq |
$(VDIRFB)/Vhelloworld.h $(VDIRFB)/Vhelloworld.cpp $(VDIRFB)/Vhelloworld.mk: $(RTLDR)/txuartlite.v $(RTLDR)/txuart.v
|
94 |
5 |
dgisselq |
|
95 |
15 |
dgisselq |
SPEECHSRCS := $(addprefix $(RTLDR)/,rxuart.v txuart.v rxuartlite.v txuartlite.v ufifo.v wbuart.v)
|
96 |
5 |
dgisselq |
SPEECHVFILES:= $(addprefix $(VDIRFB)/,Vspeechfifo.h Vspeechfifo.cpp Vspeechfifo.mk)
|
97 |
|
|
$(VDIRFB)/Vspeechfifo__ALL.a: $(VDIRFB)/Vspeechfifo.h $(VDIRFB)/Vspeechfifo.cpp
|
98 |
|
|
$(VDIRFB)/Vspeechfifo__ALL.a: $(VDIRFB)/Vspeechfifo.mk
|
99 |
|
|
$(SPEECHVFILES): speechfifo.v $(SPEECHSRCS)
|
100 |
|
|
|
101 |
2 |
dgisselq |
$(VDIRFB)/V%.cpp $(VDIRFB)/V%.h $(VDIRFB)/V%.mk: $(FBDIR)/%.v
|
102 |
5 |
dgisselq |
verilator --trace -cc -y ../../rtl $*.v
|
103 |
2 |
dgisselq |
|
104 |
|
|
$(VDIRFB)/V%__ALL.a: $(VDIRFB)/V%.mk
|
105 |
|
|
cd $(VDIRFB); make -f V$*.mk
|
106 |
|
|
|
107 |
|
|
.PHONY: clean
|
108 |
|
|
clean:
|
109 |
|
|
rm -rf $(VDIRFB)/*.mk
|
110 |
|
|
rm -rf $(VDIRFB)/*.cpp
|
111 |
|
|
rm -rf $(VDIRFB)/*.h
|
112 |
|
|
rm -rf $(VDIRFB)/
|
113 |
|
|
|