diff --git a/boot_code/brainfuck_compiler_v1.asm b/boot_code/brainfuck_compiler_v1.asm index 1296c07..250beca 100644 --- a/boot_code/brainfuck_compiler_v1.asm +++ b/boot_code/brainfuck_compiler_v1.asm @@ -242,4 +242,3 @@ bootup_msg: .ASCII 'Native brainfuck compiler v1\n' DATA: .BLKB 560 .BLKB 200 STACK: -output_program: .BLKB 600 diff --git a/boot_code/brainfuck_mandelbrot.asm b/boot_code/brainfuck_mandelbrot.asm index 7b82c94..d4238ac 100644 --- a/boot_code/brainfuck_mandelbrot.asm +++ b/boot_code/brainfuck_mandelbrot.asm @@ -1,4 +1,4 @@ -INCLUDE brainfuck_interpreter_v0.asm +INCLUDE brainfuck_compiler_v1.asm prog: .ASCII '+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[' @@ -145,3 +145,5 @@ prog: .ASCII '>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++' .ASCII '+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<' .ASCII '<<<<<]]>>>]' + +output_program: diff --git a/boot_code/brainfuck_mandelbrot.stage b/boot_code/brainfuck_mandelbrot.stage deleted file mode 100644 index 2cb91ac..0000000 Binary files a/boot_code/brainfuck_mandelbrot.stage and /dev/null differ diff --git a/common.mk b/common.mk index 02606a3..80da53d 100644 --- a/common.mk +++ b/common.mk @@ -22,7 +22,7 @@ disas: $(subst .txt,.disas,${BOOT_CODE}) # Assembling code %.txt:%.bin - ${Q}dd if=/dev/zero bs=1 count=16384 of="$(subst .bin,.stage,$<)" status=none + ${Q}dd if=/dev/zero bs=1 count=32768 of="$(subst .bin,.stage,$<)" status=none ${Q}dd if="$<" of="$(subst .bin,.stage,$<)" conv=notrunc,nocreat status=none ${Q}xxd -ps -c 2 "$(subst .bin,.stage,$<)" > "$@" ${Q}rm "$(subst .bin,.stage,$<)" diff --git a/system/decoder.v b/system/decoder.v index bf2c3dc..bdf951a 100644 --- a/system/decoder.v +++ b/system/decoder.v @@ -520,7 +520,7 @@ always @( CIR or SIMPLE_MICRO or seq_addr_input ) begin end 11'b1111_1111_100:begin /* JMP - Unconditional indirect within segment jump */ - /* 1 1 1 1 1 1 1 1 | MOD 1 0 1 R/M | < DISP-LO > | < DISP-HI > */ + /* 1 1 1 1 1 1 1 1 | MOD 1 0 0 R/M | < DISP-LO > | < DISP-HI > */ `start_aligning_instruction opcode_size=1; has_operands=0; diff --git a/system/memory.v b/system/memory.v index 5ab1c0b..1cee02a 100644 --- a/system/memory.v +++ b/system/memory.v @@ -18,20 +18,20 @@ along with this program. If not, see . */ module mem(input [19:0] address,inout wire [15:0] data ,input rd,input wr,input cs); -reg [15:0] memory [0:8191]; +reg [15:0] memory [0:32768]; initial begin string boot_code; if(!$value$plusargs("BOOT_CODE=%s",boot_code))begin $display("No boot code specified. Please add +BOOT_CODE= to your vvp args"); $finish; end - $readmemh(boot_code, memory); + $readmemh(boot_code, memory,0,16383); end -assign data = !rd & !cs ? memory[address[12:0]]: 16'hz; +assign data = !rd & !cs ? memory[address[15:0]]: 16'hz; always @(negedge wr) begin - memory[address[12:0]]=data; + memory[address[15:0]]=data; end endmodule diff --git a/system/testbench.v b/system/testbench.v index 383912c..6483d1d 100644 --- a/system/testbench.v +++ b/system/testbench.v @@ -56,7 +56,7 @@ end always @(posedge HALT) begin $display("Processor halted.\nCycles run for: %d",cycles); if($value$plusargs("MEMDUMP=%s",memdump_name))begin - $writememh(memdump_name, sysmem.memory); + $writememh(memdump_name, sysmem.memory,0,32767); end #(`CPU_SPEED) //Just for the waveform $finish; @@ -66,7 +66,7 @@ always @(posedge ERROR) begin clk_enable <= 0; $display("PROCESSOR RUN INTO AN ERROR.\nCycles run for: %d",cycles); if($value$plusargs("MEMDUMP=%s",memdump_name))begin - $writememh(memdump_name, sysmem.memory); + $writememh(memdump_name, sysmem.memory,0,32767); end #(`CPU_SPEED) //Just for the waveform $finish;