59 lines
1.7 KiB
Makefile
59 lines
1.7 KiB
Makefile
# 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
|
|
VVP=processor.vvp
|
|
|
|
.PHONY: brainf
|
|
brainf: ${VVP} brainfuck.txt
|
|
vvp ${VVP} +BOOT_CODE=brainfuck.txt
|
|
grep -v '^//' memdump.txt | xxd -ps -c 2 -r > memdump.bin
|
|
|
|
.PHONY: run
|
|
run: ${VVP} boot_code.txt
|
|
vvp ${VVP}
|
|
|
|
.PHONY: build
|
|
build: ${VVP}
|
|
|
|
.PHONY: wave
|
|
wave: ${VVP} brainfuck.txt
|
|
vvp ${VVP} -lxt2 +BOOT_CODE=brainfuck.txt
|
|
gtkwave test.lx2 gtkwave_savefile.gtkw
|
|
grep -v '^//' memdump.txt | xxd -ps -c 2 -r > memdump.bin
|
|
|
|
${VVP} : ${SOURCES} ${INCLUDES}
|
|
iverilog -g2012 ${SOURCES} -o $@
|
|
|
|
%.txt:%.bin
|
|
dd if=/dev/zero bs=1 count=1200 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
|
|
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
|