40 lines
892 B
Makefile
40 lines
892 B
Makefile
SOURCES=processor.v testbench.v memory.v registers.v alu.v
|
|
INCLUDES=proc_state_def.v
|
|
VVP=processor.vvp
|
|
|
|
.PHONY: brainf
|
|
brainf: ${VVP} brainfuck.txt
|
|
vvp ${VVP} +BOOT_CODE=brainfuck.txt
|
|
|
|
.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
|
|
|
|
${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
|