From 6e8d951360d65cd01126dfafdde70534c01e029d Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Fri, 24 Feb 2023 17:36:41 +0000 Subject: [PATCH] Increased the accessible memory and got the Mandelbrot renderer working under the brainfuck compiler! --- boot_code/brainfuck_compiler_v1.asm | 1 - boot_code/brainfuck_mandelbrot.asm | 4 +++- boot_code/brainfuck_mandelbrot.stage | Bin 32768 -> 0 bytes common.mk | 2 +- system/decoder.v | 2 +- system/memory.v | 8 ++++---- system/testbench.v | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 boot_code/brainfuck_mandelbrot.stage 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 2cb91ac241f577cf23c961d535f084fe1385f589..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeHNON$g&6fVVyU>+_FNQj1jiA_tga?^AmLS_-j)$@k@D+eaiJBKIpw`SLh*|){? z%HGMeS4^g(mC5>aZE$g8&*j%vS1-=@OtyD1}`lF-0-l*Ff zjNa)DM?dzCjlNs|>(a{2BP-L}$G7gzJ}x$Yo&PaAS#173|84emv3YC$%j}I}^UnOn z?EPZ)Y6^Fr!<}4RMVR^3@%>`-`uP5?(JSNoTciEc@!rX$+iUZerki^w^B1O@`zQ0_ zTCp*HP>ha_AM6?(96#6^9h`o%F}XBbyLW3mT3O#(o9|yQ*5>=xPpr*X)<0aE7vC2f zMO?u^F!1a%@X@K!*$Zb5eRA&9*)KmmfBLgSr@#8*>$9JqId|y7yZfH~^drMyAQ%V+ zf&nnl$*)1T-|6)G^g$PHJ3YRJG^V4Sez)7@$85}f360+dEfNAe)=Io3yOEpp=SY3CJBij*w^b&w^Qx2Gdf<#J#Ed3vbYSF_Kn_6Wzm~F~L@(}DoiZvEIAz`wh*LaeHS+1TU}W`^JtQmSluH18OIwG%Zs0(@tp!o6{=ic6s>mX0qGGG7bsHLaOS zSIygmTXQ$&r#daA-y<^g2GA1rMW{<~2}v`V(p}9P>C(Y*Dpc@pk6}t+>Fu!5z#aO{ z3XhUFFW%IOumzYrV3a1|LAfFXc+y$oVf#KRV1)>Ji#-+ybSDQmcyaBqLwuC;p;$^_ zwvVEv@G!?l=$Vi{*4I)g9}vy?m2b9 zLgMUJF(Pkz*>!DUA}(eK9xEB|fGL3|46Il3)tmxIk%SjwGr44Q$7mV*?nwtHy4nj4 z3tY*|(@|PE>QQofLn+X5$RG2RP(r?#5l&bZPXjq*yKvuY>B~@+;A{D*$hIwiM#(MP zS5j6apOt6CYo<9R5k20MNAd-kJ{Jc!p~NX`xN(}9`GyarySWmmG+iyK@bIZ4ls6R# z&864ni^67mNYk2j&$y}h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g?Dnd7e=|TTDZ}i`MctKwIF1q!jB=Z$Y%_ocD3iVomA$eS zmTGeP|1Pp(Ww)Z+yz8*`;y-W)1HnKr5DWwZ!9Xw&3 "$@" ${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;