2023-02-13 16:49:17 +00:00
|
|
|
# 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/>.
|
|
|
|
#
|
2023-02-09 17:02:21 +00:00
|
|
|
SOURCES=processor.v testbench.v memory.v registers.v alu.v
|
2023-02-13 15:24:21 +00:00
|
|
|
INCLUDES=proc_state_def.v alu_header.v config.v
|
2023-02-08 09:18:00 +00:00
|
|
|
VVP=processor.vvp
|
|
|
|
|
2023-02-11 01:11:37 +00:00
|
|
|
.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-11 01:11:37 +00:00
|
|
|
|
2023-02-08 09:18:00 +00:00
|
|
|
.PHONY: run
|
2023-02-11 01:11:37 +00:00
|
|
|
run: ${VVP} boot_code.txt
|
2023-02-08 09:18:00 +00:00
|
|
|
vvp ${VVP}
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: ${VVP}
|
|
|
|
|
|
|
|
.PHONY: wave
|
2023-02-11 01:11:37 +00:00
|
|
|
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
|
|
|
|
2023-02-11 01:11:37 +00:00
|
|
|
${VVP} : ${SOURCES} ${INCLUDES}
|
2023-02-09 17:02:21 +00:00
|
|
|
iverilog -g2012 ${SOURCES} -o $@
|
2023-02-08 09:18:00 +00:00
|
|
|
|
2023-02-11 01:11:37 +00:00
|
|
|
%.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,$^)
|
2023-02-10 13:26:23 +00:00
|
|
|
|
2023-02-11 01:11:37 +00:00
|
|
|
%.bin:%.asm
|
2023-02-10 13:26:23 +00:00
|
|
|
as86 -0 $< -b $@
|
|
|
|
|
2023-02-10 15:35:43 +00:00
|
|
|
.PHONY: disas
|
2023-02-11 01:11:37 +00:00
|
|
|
disas: brainfuck.bin
|
2023-02-13 10:36:37 +00:00
|
|
|
objdump -D -b binary -m i8086 $^ | less
|
2023-02-11 01:11:37 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2023-02-13 16:49:17 +00:00
|
|
|
rm -f ${VVP} test.lx2 boot_code.txt boot_code.bin brainfuck.txt brainfuck.bin memdump.txt
|