OpenCores
URL https://opencores.org/ocsvn/wbuart32/wbuart32/trunk

Subversion Repositories wbuart32

[/] [wbuart32/] [trunk/] [bench/] [cpp/] [Makefile] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dgisselq
################################################################################
2
##
3
## Filename:    Makefile
4
##
5
## Project:     wbuart32, a full featured UART with simulator
6
##
7 5 dgisselq
## Purpose:     To test a group of Verilator modules: txuart (UART transmitter),
8
##              rxuart (UART receiver/sink) and wbuart (UART module, containing
9
##      both receiver and transmitter, with FIFOs, controlled via wishbone).
10 2 dgisselq
##
11 5 dgisselq
##
12
## Targets:
13
##      test
14
##              Perform both tests.  The end result should be either a PASS
15
##              or a FAIL.
16
##
17
##      helloworld
18
##              A non-automated, and less interactive test than the others.  In
19
##              this test, the UART simply produces a Hello World message to the
20
##              screen over and over again.
21
##
22
##      linetest
23
##              An automated test of both txuart and rxuart.  The test works
24
##              by sending a message through the rxuart, and receiving the
25
##              message via the txuart.  This depends upon a Verilog test
26
##              infrastructure, linetest.v.
27
##
28
##              This test may be ran in an interactive mode.  In this mode,
29
##              characters written to the UART will be reflected back upon
30
##              the entrance of a return character.
31
##
32
##      speechtest
33
##              An automated test of the wbuart, txuart, and fifo.  In this
34
##              case, the test RTL produces a copy of the Gettysburg address,
35
##              filling the FIFO at 12/16 at a time.  In automated mode, the
36
##              speechtest will compare the output against against a text copy
37
##              of the speech, and report upon any success or failure.
38
##
39
##              In interactive mode, the test will repeatedly print out the
40
##              Gettysburg address until stopped.  (It may take a significant
41
##              amount of time between copies of the Gettysburg address ...)
42
##
43
##
44 2 dgisselq
## Creator:     Dan Gisselquist, Ph.D.
45
##              Gisselquist Technology, LLC
46
##
47
################################################################################
48
##
49
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
50
##
51
## This program is free software (firmware): you can redistribute it and/or
52
## modify it under the terms of  the GNU General Public License as published
53
## by the Free Software Foundation, either version 3 of the License, or (at
54
## your option) any later version.
55
##
56
## This program is distributed in the hope that it will be useful, but WITHOUT
57
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
58
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
59
## for more details.
60
##
61
## You should have received a copy of the GNU General Public License along
62
## with this program.  (It's in the $(ROOT)/doc directory, run make with no
63
## target there if the PDF file isn't present.)  If not, see
64
##  for a copy.
65
##
66
## License:     GPL, v3, as defined and found on www.gnu.org,
67
##              http://www.gnu.org/licenses/gpl.html
68
##
69
##
70
################################################################################
71
##
72
##
73
CXX     := g++
74
FLAGS   := -Wall -Og -g
75
OBJDIR  := obj-pc
76
RTLD    := ../verilog
77 5 dgisselq
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
78
VROOT   := $(VERILATOR_ROOT)
79 2 dgisselq
INCS    := -I$(RTLD)/obj_dir/ -I/usr/share/verilator/include
80 5 dgisselq
SOURCES := helloworld.cpp linetest.cpp uartsim.cpp uartsim.h
81 2 dgisselq
VOBJDR  := $(RTLD)/obj_dir
82 5 dgisselq
SYSVDR  := /usr/share/verilator/include
83
VLIB    := $(SYSVDR)/verilated.cpp $(SYSVDR)/verilated_vcd_c.cpp
84
# Sources necessary to build the linetest program (rxuart-txuart test)
85
LINSRCS := linetest.cpp uartsim.cpp
86
LINOBJ := $(subst .cpp,.o,$(LINSRCS))
87
LINOBJS:= $(addprefix $(OBJDIR)/,$(LINOBJ))
88
# Sources necessary to build the helloworld test (txuart test)
89
HLOSRCS := helloworld.cpp uartsim.cpp
90
HLOOBJ := $(subst .cpp,.o,$(HLOSRCS))
91
HLOOBJS:= $(addprefix $(OBJDIR)/,$(HLOOBJ))
92
# Sources necessary to build the speech test (wbuart test)
93
SPCHSRCS:= speechtest.cpp uartsim.cpp
94
SPCHOBJ := $(subst .cpp,.o,$(SPCHSRCS))
95
SPCHOBJS:= $(addprefix $(OBJDIR)/,$(SPCHOBJ))
96
all:    $(OBJDIR)/ linetest helloworld speechtest test
97 2 dgisselq
 
98
$(OBJDIR)/:
99
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
100
 
101
$(OBJDIR)/uartsim.o: uartsim.cpp uartsim.h
102
 
103
$(OBJDIR)/%.o: %.cpp
104
        $(CXX) $(FLAGS) $(INCS) -c $< -o $@
105
 
106 5 dgisselq
linetest: $(LINOBJS) $(VOBJDR)/Vlinetest__ALL.a
107 2 dgisselq
        $(CXX) $(FLAGS) $(INCS) $^ $(VLIB) -o $@
108
 
109 5 dgisselq
helloworld: $(HLOOBJS) $(VOBJDR)/Vhelloworld__ALL.a
110
        $(CXX) $(FLAGS) $(INCS) $^ $(VLIB) -o $@
111
 
112
#
113
# The speech test program depends upon a copy of the Gettysburg Address,
114
# turned into a hex file format which will be read by the Verilog/RTL
115
# $readmemh function.  However, we need to create that hex file that will
116
# written.  That's the purpose of mkspeech--to make a file that can be read
117
# by $readmemh.
118
#
119
mkspeech: mkspeech.cpp
120
        $(CXX) mkspeech.cpp -o $@
121
 
122
# Now that mkspeech is available, use it to produce a speech.hex file from
123
# the speech.txt file.  Be careful if you adjust this speech: the speechfifo.v
124
# verilog file depends upon the exact number of characters--its not a portable
125
# dependency, but ... it is what it is.
126
speech.hex: mkspeech speech.txt
127
        ./mkspeech speech.txt
128 11 dgisselq
        bash -c "if [ -d ../verilog/ ]; then cp speech.hex ../verilog/; fi"
129 5 dgisselq
 
130
# Now, if the speech.hex file is available, then we can perform our final build.
131
# Actually, we could've done this without the speech file being available, but
132
# this works.
133
speechtest: speech.hex $(SPCHOBJS) $(VOBJDR)/Vspeechfifo__ALL.a
134
        $(CXX) $(FLAGS) $(INCS) $(SPCHOBJS) $(VOBJDR)/Vspeechfifo__ALL.a $(VLIB) -o $@
135
 
136
test: linetest speechtest
137
        ./linetest
138
        ./speechtest
139
 
140 2 dgisselq
.PHONY: clean
141
clean:
142 5 dgisselq
        rm -f  ./linetest ./helloworld ./speechtest
143
        rm -f ./mkspeech ./speech.hex
144 4 dgisselq
        rm -rf $(OBJDIR)/
145 2 dgisselq
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.