9086/cpu/Makefile

60 lines
1.8 KiB
Makefile
Raw Normal View History

# This file is part of the 9086 project.
#
# Copyright (c) 2023 Efthymios Kritikos
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
SOURCES=processor.v testbench.v memory.v registers.v alu.v
INCLUDES=proc_state_def.v alu_header.v config.v
2023-02-08 09:18:00 +00:00
VVP=processor.vvp
.PHONY: brainf
brainf: ${VVP} brainfuck.txt
vvp ${VVP} +BOOT_CODE=brainfuck.txt
2023-02-14 13:13:40 +00:00
grep -v '^//' memdump.txt | xxd -ps -c 2 -r > memdump.bin
2023-02-08 09:18:00 +00:00
.PHONY: run
run: ${VVP} boot_code.txt
2023-02-08 09:18:00 +00:00
vvp ${VVP}
grep -v '^//' memdump.txt | xxd -ps -c 2 -r > memdump.bin
2023-02-08 09:18:00 +00:00
.PHONY: build
build: ${VVP}
.PHONY: wave
wave: ${VVP} brainfuck.txt
vvp ${VVP} -lxt2 #+BOOT_CODE=brainfuck.txt
2023-02-08 09:18:00 +00:00
gtkwave test.lx2 gtkwave_savefile.gtkw
2023-02-14 13:13:40 +00:00
grep -v '^//' memdump.txt | xxd -ps -c 2 -r > memdump.bin
2023-02-08 09:18:00 +00:00
${VVP} : ${SOURCES} ${INCLUDES}
iverilog -g2012 ${SOURCES} -o $@
2023-02-08 09:18:00 +00:00
%.txt:%.bin
dd if=/dev/zero bs=1 count=16384 of=$(subst .bin,.stage,$^) status=none
dd if=$^ of=$(subst .bin,.stage,$^) conv=notrunc,nocreat status=none
xxd -ps -c 2 $(subst .bin,.stage,$^) > $@
rm $(subst .bin,.stage,$^)
%.bin:%.asm
as86 -0 $< -b $@
.PHONY: disas
disas: brainfuck.bin
2023-02-13 10:36:37 +00:00
objdump -D -b binary -m i8086 $^ | less
.PHONY: clean
clean:
rm -f ${VVP} test.lx2 boot_code.txt boot_code.bin brainfuck.txt brainfuck.bin memdump.txt