diff --git a/cpu/Makefile b/cpu/Makefile index 63e786f..6a2f36f 100644 --- a/cpu/Makefile +++ b/cpu/Makefile @@ -14,9 +14,22 @@ wave: ${VVP} vvp ${VVP} -lxt2 gtkwave test.lx2 gtkwave_savefile.gtkw -${VVP} : ${SOURCES} ${INCLUDES} +${VVP} : ${SOURCES} ${INCLUDES} boot_code.txt iverilog -g2012 ${SOURCES} -o $@ .PHONY: clean clean: - rm -f ${VVP} test.lx2 + rm -f ${VVP} test.lx2 boot_code.txt boot_code.bin + +boot_code.txt:boot_code.bin + dd if=/dev/zero bs=1 count=256 of=boot_code.stage status=none + dd if=boot_code.bin of=boot_code.stage conv=notrunc,nocreat status=none + xxd -ps -c 2 boot_code.stage > boot_code.txt + rm boot_code.stage + +boot_code.bin:boot_code.asm + as86 -0 $< -b $@ + +.PHONY: dumpas +dumpas: boot_code.bin + objdump -D -b binary -m i8086 boot_code.bin diff --git a/cpu/memory.v b/cpu/memory.v index b33d009..2761a47 100644 --- a/cpu/memory.v +++ b/cpu/memory.v @@ -1,5 +1,5 @@ module rom(input [19:0] address,output wire [15:0] data ,input rd,input cs); -reg [15:0] memory [0:15]; +reg [15:0] memory [0:127]; initial begin $readmemh("boot_code.txt", memory); end