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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [cpp/] [Makefile] - Blame information for rev 197

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:      Zip CPU -- a small, lightweight, RISC CPU soft core
6
#
7
# Purpose:      This makefile builds the final verilator simulation of the
8
#               zipsystem.  Specifically, it builds the final C++ portion
9 149 dgisselq
#       of the simulator, and thus the final simulator executable.
10 2 dgisselq
#
11 149 dgisselq
#       This simulator depends upon the ncurses library.
12 2 dgisselq
#
13 149 dgisselq
#       Useful targets of this makefile include:
14 2 dgisselq
#
15 149 dgisselq
#       zippy_tb (default)
16
#               This is the test bench program / simulator that is built by
17
#               this directory.
18
#
19
#       test
20
#               Runs the simulator on a test program found in the trunk/sw/zasm
21
#               directory.  That program needs to be built via 'make test' in
22
#               that directory before this make test will work.  Changes to the
23
#               test itself will require a 'make test' in trunk/sw/zasm as well
24
#               as 'make test' in this directory.
25
#
26
#               The test itself consists of two tests.  The first, the "step"
27
#               test, tests whether the test works via "step"ing the CPU.
28
#               This would be the interface to the CPU were the CPU placed in
29
#               a device.
30
#
31
#               The second test is an internal test which works by just running
32
#               the CPU without step instructions.
33
#
34
#               In either case the test is over upon reaching either a HALT
35
#               or a BUSY instruction.  A HALT instruction indicates success,
36
#               BUSY a failure.
37
#
38
#       stest
39
#               Runs the test in "step" mode as described above.
40
#
41
#       itest
42
#               Runs the test file in interactive mode.  The CPU will not
43
#               execute any instructions without user interaction.  This is
44
#               useful for actually debugging the test.  The other two modes
45
#               are useful for quickly determining that the CPU does (or
46
#               doesn't) work.
47
#
48
#       dhrystone
49
#               Runs a hand-optimized version of the dhrystone benchmark.
50
#               Using the instructions at the top of the dhrystone assembly
51
#               file, you should be able to convert the result to DMIPS or even
52
#               DMIPS/MHz.
53
#
54
#       div_tb
55
#               A raw test bench to test the divide unit separate from the
56
#               rest of the CPU.  This test will fail with a failed assert()
57
#               if unsuccessful, or complete with no error (but lots of
58
#               debugging output) if successful.  To actually run this test,
59
#               you'll need to run ./div_tb (no arguments necessary).
60
#
61 197 dgisselq
#       mpy_tb
62
#               A raw test bench to test the multiply instructions within the
63
#               cpuops (ALU) unit separate from the rest of the CPU.  For more
64
#               details, look at the usage statement wtihin mpy_tb.
65
#
66
#       zipmmu_tb
67
#               Like div_tb, this is another raw component test bench.  In this
68
#               case, zipmmu_tb tests whether or not the MMU works when
69
#               separated from the rest of the CPU.
70
#
71 149 dgisselq
#       pdump
72
#               zippy_tb can be configured to produce a profile output that is
73
#               very useful when debugging the Dhrystone benchmark.  (It is
74
#               so configured by default.)  This file will be name pfile.bin.
75
#               pdump is a very simple program designed to read this file and
76
#               produce some (very raw) information from it.  To use this,
77
#               type pdump and the name of the executable file, such as
78
#               ../asm/zipdhry.z, and examine how many times each instruction
79
#               was executed, and how many stalls took place between each
80
#               instruction and the next.
81
#
82
#       clean
83
#               Removes all products of compilation--specifically zippy_tb,
84
#               pdump and div_tb.
85
#
86
#
87 2 dgisselq
# Creator:      Dan Gisselquist, Ph.D.
88 69 dgisselq
#               Gisselquist Technology, LLC
89 2 dgisselq
#
90
################################################################################
91
#
92 159 dgisselq
# Copyright (C) 2015-2016, Gisselquist Technology, LLC
93 2 dgisselq
#
94
# This program is free software (firmware): you can redistribute it and/or
95
# modify it under the terms of  the GNU General Public License as published
96
# by the Free Software Foundation, either version 3 of the License, or (at
97
# your option) any later version.
98
#
99
# This program is distributed in the hope that it will be useful, but WITHOUT
100
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
101
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
102
# for more details.
103
#
104
# License:      GPL, v3, as defined and found on www.gnu.org,
105
#               http://www.gnu.org/licenses/gpl.html
106
#
107
#
108
################################################################################
109
#
110 197 dgisselq
all: zippy_tb pdump div_tb mpy_tb
111 2 dgisselq
 
112 69 dgisselq
CXX     := g++
113
FLAGS   := -Wall -Og -g
114 76 dgisselq
ZASM    := ../../sw/zasm
115 69 dgisselq
RTLD    := ../../rtl
116 197 dgisselq
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
117
VROOT   := $(VERILATOR_ROOT)
118
INCS    := -I$(RTLD)/obj_dir/ -I$(RTLD) -I$(VROOT)/include -I$(ZASM)
119 2 dgisselq
SOURCES := zippy_tb.cpp memsim.cpp twoc.cpp $(ZASM)/zopcodes.cpp $(ZASM)/zparser.cpp
120 197 dgisselq
VLIB    := $(VROOT)/include/verilated.cpp
121 69 dgisselq
RAWLIB  := $(VLIB) $(RTLD)/obj_dir/Vzipsystem__ALL.a
122 159 dgisselq
LIBS    := $(RAWLIB) -lncurses -lelf
123 69 dgisselq
TESTF   := $(ZASM)/z.out
124 43 dgisselq
DHRYSTONEF := ../asm/zipdhry.z
125 2 dgisselq
 
126 36 dgisselq
zippy_tb: $(SOURCES) $(RAWLIB) $(ZASM)/zopcodes.h $(ZASM)/zparser.h testb.h
127 39 dgisselq
zippy_tb: $(RTLD)/cpudefs.h
128 2 dgisselq
        $(CXX) $(FLAGS) $(INCS) $(SOURCES) $(LIBS) -o $@
129
 
130 69 dgisselq
div_tb: div_tb.cpp twoc.cpp $(VLIB) $(RTLD)/obj_dir/Vdiv__ALL.a testb.h
131
        $(CXX) $(FLAGS) $(INCS) div_tb.cpp twoc.cpp $(VLIB) $(RTLD)/obj_dir/Vdiv__ALL.a -o $@
132
 
133 197 dgisselq
mpy_tb: mpy_tb.cpp twoc.cpp $(VLIB) $(RTLD)/obj_dir/Vcpuops__ALL.a testb.h
134
        $(CXX) $(FLAGS) $(INCS) mpy_tb.cpp twoc.cpp $(VLIB) $(RTLD)/obj_dir/Vcpuops__ALL.a -o $@
135
 
136
zipmmu_tb: zipmmu_tb.cpp $(VLIB) ../rtl/obj_dir/Vzipmmu_tb__ALL.a
137
        $(CXX) $(FLAGS) $(INCS) -I ../rtl/obj_dir zipmmu_tb.cpp $(VLIB) ../rtl/obj_dir/Vzipmmu_tb__ALL.a -o $@
138
 
139 58 dgisselq
pdump: pdump.cpp $(ZASM)/zopcodes.cpp $(ZASM)/zparser.cpp
140
pdump: $(ZASM)/zopcodes.h $(ZASM)/zparser.h testb.h twoc.cpp
141 185 dgisselq
        $(CXX) $(FLAGS) $(INCS) pdump.cpp $(ZASM)/zopcodes.cpp $(ZASM)/zparser.cpp twoc.cpp -lelf -o $@
142 58 dgisselq
 
143 36 dgisselq
.PHONY: stest
144
stest: zippy_tb
145
        ./zippy_tb -s $(TESTF)
146
 
147
.PHONY: itest
148 27 dgisselq
itest: zippy_tb
149
        ./zippy_tb $(TESTF)
150
 
151 36 dgisselq
.PHONY: test
152
test: zippy_tb stest
153 27 dgisselq
        ./zippy_tb -a $(TESTF)
154 36 dgisselq
 
155 43 dgisselq
.PHONY: dhrystone
156
dhrystone: zippy_tb
157
        ./zippy_tb -a $(DHRYSTONEF)
158
 
159 36 dgisselq
.PHONY: clean
160
clean:
161 197 dgisselq
        rm ./zippy_tb pdump div_tb mpy_tb

powered by: WebSVN 2.1.0

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