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

Subversion Repositories zipcpu

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

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
#       pdump
62
#               zippy_tb can be configured to produce a profile output that is
63
#               very useful when debugging the Dhrystone benchmark.  (It is
64
#               so configured by default.)  This file will be name pfile.bin.
65
#               pdump is a very simple program designed to read this file and
66
#               produce some (very raw) information from it.  To use this,
67
#               type pdump and the name of the executable file, such as
68
#               ../asm/zipdhry.z, and examine how many times each instruction
69
#               was executed, and how many stalls took place between each
70
#               instruction and the next.
71
#
72
#       clean
73
#               Removes all products of compilation--specifically zippy_tb,
74
#               pdump and div_tb.
75
#
76
#
77 2 dgisselq
# Creator:      Dan Gisselquist, Ph.D.
78 69 dgisselq
#               Gisselquist Technology, LLC
79 2 dgisselq
#
80
################################################################################
81
#
82
# Copyright (C) 2015, Gisselquist Technology, LLC
83
#
84
# This program is free software (firmware): you can redistribute it and/or
85
# modify it under the terms of  the GNU General Public License as published
86
# by the Free Software Foundation, either version 3 of the License, or (at
87
# your option) any later version.
88
#
89
# This program is distributed in the hope that it will be useful, but WITHOUT
90
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
91
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
92
# for more details.
93
#
94
# License:      GPL, v3, as defined and found on www.gnu.org,
95
#               http://www.gnu.org/licenses/gpl.html
96
#
97
#
98
################################################################################
99
#
100 149 dgisselq
all: zippy_tb pdump div_tb
101 2 dgisselq
 
102 69 dgisselq
CXX     := g++
103
FLAGS   := -Wall -Og -g
104 76 dgisselq
ZASM    := ../../sw/zasm
105 69 dgisselq
RTLD    := ../../rtl
106
INCS    := -I$(RTLD)/obj_dir/ -I$(RTLD) -I/usr/share/verilator/include -I$(ZASM)
107 2 dgisselq
SOURCES := zippy_tb.cpp memsim.cpp twoc.cpp $(ZASM)/zopcodes.cpp $(ZASM)/zparser.cpp
108 69 dgisselq
VLIB    := /usr/share/verilator/include/verilated.cpp
109
RAWLIB  := $(VLIB) $(RTLD)/obj_dir/Vzipsystem__ALL.a
110
LIBS    := $(RAWLIB) -lncurses
111
TESTF   := $(ZASM)/z.out
112 43 dgisselq
DHRYSTONEF := ../asm/zipdhry.z
113 2 dgisselq
 
114 36 dgisselq
zippy_tb: $(SOURCES) $(RAWLIB) $(ZASM)/zopcodes.h $(ZASM)/zparser.h testb.h
115 39 dgisselq
zippy_tb: $(RTLD)/cpudefs.h
116 2 dgisselq
        $(CXX) $(FLAGS) $(INCS) $(SOURCES) $(LIBS) -o $@
117
 
118 69 dgisselq
div_tb: div_tb.cpp twoc.cpp $(VLIB) $(RTLD)/obj_dir/Vdiv__ALL.a testb.h
119
        $(CXX) $(FLAGS) $(INCS) div_tb.cpp twoc.cpp $(VLIB) $(RTLD)/obj_dir/Vdiv__ALL.a -o $@
120
 
121 58 dgisselq
pdump: pdump.cpp $(ZASM)/zopcodes.cpp $(ZASM)/zparser.cpp
122
pdump: $(ZASM)/zopcodes.h $(ZASM)/zparser.h testb.h twoc.cpp
123
        $(CXX) $(FLAGS) $(INCS) pdump.cpp $(ZASM)/zopcodes.cpp $(ZASM)/zparser.cpp twoc.cpp -o $@
124
 
125 36 dgisselq
.PHONY: stest
126
stest: zippy_tb
127
        ./zippy_tb -s $(TESTF)
128
 
129
.PHONY: itest
130 27 dgisselq
itest: zippy_tb
131
        ./zippy_tb $(TESTF)
132
 
133 36 dgisselq
.PHONY: test
134
test: zippy_tb stest
135 27 dgisselq
        ./zippy_tb -a $(TESTF)
136 36 dgisselq
 
137 43 dgisselq
.PHONY: dhrystone
138
dhrystone: zippy_tb
139
        ./zippy_tb -a $(DHRYSTONEF)
140
 
141 36 dgisselq
.PHONY: clean
142
clean:
143 76 dgisselq
        rm ./zippy_tb pdump div_tb

powered by: WebSVN 2.1.0

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