-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.in
223 lines (193 loc) · 9.48 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#a Copyright
#
# This file 'Makefile' copyright Gavin J Stark 2016, 2017
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# @file Makefile
# @brief Basic makefile for CDL builds with extra targets
#
# Basic CDL makefile with additional targets for test regressions, help, etc
#
#a Global variables
# Note: ./configure CYCLICITY=/Users/gstark/Git/cdl LDFLAGS='-L/Users/gstark/Git/brew/lib' CPPFLAGS='-I/Users/gstark/Git/brew/include'
# Note: make Q= EXTRA_CXXFLAGS='-I ~/Git/brew/include' EXTRA_LIBS='-L ~/Git/brew/lib'
# Note: make RISCV_ATCF_REGRESSION_DIR=../atthecodeface_riscv_tests SUITE=riscv_minimal.riscv_i32mc_pipeline3.test_c_arith test_regress
# Note: PYTHONPATH=/Users/gstark/Git/riscv_investigation/cdl:$PYTHOHPATH make CYCLICITY=../riscv_investigation/cdl LOCAL_DIR=/Users/gstark/Git/brew SUITE=riscv_minimal.riscv_i32c_pipeline3.test_c_arith test_regress
# Note: make WAVES=1 SUITE=vcu108 test_regress
CYCLICITY := @CYCLICITY@
CYCLICITY_ROOT := ${CYCLICITY}
MODEL_LIST := $(CURDIR)/model_list
MODELS_MAKE := $(CURDIR)/models.make
SRC_ROOT := $(CURDIR)/
PYTHON_DIR := ${SRC_ROOT}/python
ROM_DIR := ${SRC_ROOT}/roms
PREFIX_OBJ_DIR := $(CURDIR)/build/
DEBUG_BUILD := no
EXTRA_CDLFLAGS := --extra_cdlflags="--v_clkgate_type='banana' --v_use_always_at_star --v_clks_must_have_enables "
BBC_DATA_DIR := $(CURDIR)/../bbc_data
LOCAL_CFLAGS := @CPPFLAGS@ @CFLAGS@ ${EXTRA_CFLAGS}
LOCAL_CXXFLAGS := @CPPFLAGS@ @CFLAGS@ ${EXTRA_CXXFLAGS}
LOCAL_LINKLIBS := ${EXTRA_LIBS} @LDFLAGS@ @LIBS@
OS := $(shell uname)
#a Include standard build makefile
include ${CYCLICITY}/scripts/simulation_build_make
verilog: ${VERILOG_FILES}
${TARGET_DIR}/bbc_display_vnc.o: ${SRC_ROOT}/cmodel/src/bbc_display_vnc.cpp
$(Q)$(CXX) $(CXXFLAGS) -c -o ${TARGET_DIR}/bbc_display_vnc.o ${SRC_ROOT}/cmodel/src/bbc_display_vnc.cpp -Icmodel/inc
SHM_VNC_OBJS := ${TARGET_DIR}/fb.o ${TARGET_DIR}/vnc_rfb.o ${TARGET_DIR}/bbc_display_vnc.o ${TARGET_DIR}/bbc_shm.o
shm_vnc: ${SHM_VNC_OBJS}
@echo "Building shm_vnc"
${Q}${LINKASBIN} shm_vnc $(SHM_VNC_OBJS) ${LOCAL_LINKLIBS}
#a Test targets
ifeq ($(OS),Darwin)
SCRIPT ?= script regression.script
else
SCRIPT ?= script -efc
endif
RP ?= ${SCRIPT}
REGRESS_ALL = CYCLICITY=${CYCLICITY} ${RP} ./regress_all
.PHONY: regression
regression: non_bbc_roms
$(MAKE) clean ALL
${REGRESS_ALL}
.PHONY: regression_unclean
regression_unclean: non_bbc_roms
${REGRESS_ALL}
test_python_6502: ${TARGET_DIR}/py_engine.so
echo "Currently fails one test test_atc_test_6502_brk_rti"
./python/test6502.py
test_regress_6502: ${TARGET_DIR}/py_engine.so
${REGRESS_ALL} regression.base6502
test_6502_adc: ${TARGET_DIR}/py_engine.so
${REGRESS_ALL} regression.base6502.Regress6502_Test6502_ALU.test_atc_test_6502_adc
test_regress: ${TARGET_DIR}/py_engine.so
${REGRESS_ALL} regression.${SUITE}
test_regress_riscv: ${TARGET_DIR}/py_engine.so
${REGRESS_ALL} regression.riscv_minimal
.PHONY: regression_rv
regression_rv:
#$(MAKE) clean ALL
rm -f $(PREFIX_OBJ_DIR)/osx/*riscv*
$(MAKE) ALL
${REGRESS_ALL} regression.riscv_minimal
#a Operational targets
.PHONY: bbc_data
bbc_data:
mkdir -p roms disks
cp ${BBC_DATA_DIR}/roms/* roms
cp ${BBC_DATA_DIR}/disks/* disks
python python/rom_to_mif.py
APB_ROM_COMPILE := PYTHONPATH=${ROM_DIR}/src:$$PYTHONPATH ${PYTHON_DIR}/apb_rom.py
.PHONY: non_bbc_roms
non_bbc_roms:
python python/teletext_font.py > roms/teletext.mif
python python/ps2_bbc_kbd_map.py
python python/apb_speed_selection.py > roms/apb_rom.mif
python python/apb_vga.py > roms/apb_vga_rom.mif
${APB_ROM_COMPILE} --src apb_rom_uart_tx --define clk=300 --mif ${ROM_DIR}/apb_uart_tx_300_rom.mif --mem ${ROM_DIR}/apb_uart_tx_300_rom.mem
${APB_ROM_COMPILE} --src apb_rom_uart_tx --define clk=100 --mif ${ROM_DIR}/apb_uart_tx_100_rom.mif --mem ${ROM_DIR}/apb_uart_tx_100_rom.mem
${APB_ROM_COMPILE} --src apb_rom_riscv_start --define clk=100 --mif ${ROM_DIR}/apb_riscv_start_100_rom.mif --mem ${ROM_DIR}/apb_riscv_start_100_rom.mem
${APB_ROM_COMPILE} --src apb_rom_riscv_start --define clk=129 --mif ${ROM_DIR}/apb_riscv_start_129_rom.mif --mem ${ROM_DIR}/apb_riscv_start_129_rom.mem
.PHONY: roms
roms: bbc_data
bbc_run: bbc_data ${TARGET_DIR}/py_engine.so
BBC=1 ${REGRESS_ALL}
bbc_waves: ${TARGET_DIR}/py_engine.so
WAVES=1 BBC=1 ${REGRESS_ALL}
riscv_flows: ${TARGET_DIR}/py_engine.so
(${REGRESS_ALL} regression.riscv_minimal.riscv_i32c_pipeline3.${TEST}) || echo "test failed but keep going"
./python/rv_flow.py > min_pipe3_${TEST}.flow
(${REGRESS_ALL} regression.riscv_minimal.riscv_i32_minimal.${TEST}) || echo "test failed but keep going"
./python/rv_flow.py > min_min_${TEST}.flow
diff min_pipe3_${TEST}.flow min_min_${TEST}.flow
#a RISC-V trace targets
.PHONY: rv_trace
rv_trace:
PYTHONPATH=${PYTHON_DIR}:${CYCLICITY_ROOT}:${PYTHONPATH} ./python/rv_trace.py --logfile=itrace.log --timestamps=1
#a Help
DOLLAR := $$
.PHONY:help help_top
help: help_top
help_top:
@echo "Makefile"
@echo "========"
@echo ""
@echo "This makefile permits making, testing and running of the BBC micro"
@echo "The standard ROMs and disk images are not included in a standard distribution"
@echo "due to copyright reasons"
@echo ""
@echo "The BBC micro operation depends on an OS1.2 ROM, Basic2 ROM and a DFS ROM"
@echo "These need to be in MIF file format in roms as 'os12.rom.mif', 'basic2.rom.mif' and 'dfs.rom.mif'"
@echo "To convert roms from binary to MIF, use python/rom_to_mif or just 'make roms'"
@echo "This expects binary ROMs in ../roms/os12.rom, basic2.rom, and dfs.rom"
@echo "The DFS tested with is 0.9"
@echo "The BBC micro operation uses floppy disk images as MIF files"
@echo "Elite is included (as it is freely distributed)"
@echo "To convert other disk images to appropriate MIF format (which includes disk track descriptors,"
@echo "not just the data - the 'SSD' format is just 40 track, 10 265 byte sectors) use the python/disk_to_mif"
@echo ""
@echo "To run a regression, use 'make regression'; to do so without a build use 'make regression_unclean'"
@echo ""
@echo "The RISC-V regression requires tools and some prebuilt 'binaries'; the latter can be handled by cloning https://github.com/atthecodeface/riscv_tests_built.git in the parent. The former requires https://github.com/atthecodeface/riscv-atcf-tests.git to be cloned in the parent, plus building the tests with LLVM and GNU binutils, which is more laborious"
@echo ""
@echo "To run a specific subset of the regression, use 'make SUITE=<suite> test_regress'"
@echo "with suite any .py file from the regression directory."
@echo "Suggestions are:"
@echo " SUITE=base6502"
@echo " SUITE=riscv_coproc"
@echo " SUITE=riscv_minimal.riscv_i32_minimal"
@echo " SUITE=riscv_minimal.riscv_i32c_minimal"
@echo " SUITE=riscv_minimal.riscv_i32mc_pipeline3"
@echo " SUITE=riscv_minimal.riscv_i32c_pipeline3"
@echo ""
@echo "To run a particular RISC-V test with waves do something like:"
@echo "make WAVES=1 SUITE=riscv_minimal.riscv_i32mc_pipeline3.test_c_arith test_regress"
@echo "and to view its instruction trace do"
@echo "PYTHONPATH=`pwd`/../cdl:\${DOLLAR}PYTHONPATH ./python/rv_trace.py --logfile=itrace.log"
@echo ""
@echo "To run a RISC-V test and capture a 'perfect' instruction trace use RISCV_CAPTURE_TRACE=1; to match against a previous trace use RISCV_MATCH_TRACE=1"
@echo ""
@echo "To run a suite with valgrind use make RP='PYTHONMALLOC=malloc valgrind python' SUITE=<suite> test_regress"
@echo ""
@echo "To run the JTAG apb timer with OpenOcd (to demonstrate JTAG running remotely)"
@echo "use 'make SUITE=jtag.jtag_apb_timer.openocd test_regress'"
@echo "In another terminal run 'openocd --file scripts/bitbang.cfg'"
@echo "This works with a rocket-chip build of openocd but not the released version which does not support RISC-V"
@echo "In a third terminal telnet in to openocd using 'telnet 127.0.0.1 4444"
@echo "From the third terminal you should be able to see the JTAG chain in the simulation"
@echo "and you can read the timer in the sim with 'apb_read_timer'; try 'help', and 'scan_chain'"
@echo ""
#a Documentation
include doc/Makefile
#a Configure.ac info
configure_ac_info:
@echo "LIBS=@LIBS@"
@echo "LDFLAGS=@LDFLAGS@"
@echo "CFLAGS=@CFLAGS@"
@echo "CPPFLAGS=@CPPFLAGS@"
@echo "CXXFLAGS=@CXXFLAGS@"
@echo "DEFS=@DEFS@"
#a Editor preferences and notes
# Local Variables: ***
# mode: Makefile ***
# outline-regexp: "#[a!]\\\|#[\t ]*[b-z][\t ]" ***
# End: ***