Increased the accessible memory and got the Mandelbrot renderer working under the brainfuck compiler!

This commit is contained in:
(Tim) Efthimis Kritikos 2023-02-24 17:36:41 +00:00
parent 6ea34a3525
commit 6e8d951360
7 changed files with 11 additions and 10 deletions

View File

@ -242,4 +242,3 @@ bootup_msg: .ASCII 'Native brainfuck compiler v1\n'
DATA: .BLKB 560 DATA: .BLKB 560
.BLKB 200 .BLKB 200
STACK: STACK:
output_program: .BLKB 600

View File

@ -1,4 +1,4 @@
INCLUDE brainfuck_interpreter_v0.asm INCLUDE brainfuck_compiler_v1.asm
prog: prog:
.ASCII '+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[' .ASCII '+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[['
@ -145,3 +145,5 @@ prog:
.ASCII '>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++' .ASCII '>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++'
.ASCII '+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<' .ASCII '+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<'
.ASCII '<<<<<]]>>>]' .ASCII '<<<<<]]>>>]'
output_program:

Binary file not shown.

View File

@ -22,7 +22,7 @@ disas: $(subst .txt,.disas,${BOOT_CODE})
# Assembling code # Assembling code
%.txt:%.bin %.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}dd if="$<" of="$(subst .bin,.stage,$<)" conv=notrunc,nocreat status=none
${Q}xxd -ps -c 2 "$(subst .bin,.stage,$<)" > "$@" ${Q}xxd -ps -c 2 "$(subst .bin,.stage,$<)" > "$@"
${Q}rm "$(subst .bin,.stage,$<)" ${Q}rm "$(subst .bin,.stage,$<)"

View File

@ -520,7 +520,7 @@ always @( CIR or SIMPLE_MICRO or seq_addr_input ) begin
end end
11'b1111_1111_100:begin 11'b1111_1111_100:begin
/* JMP - Unconditional indirect within segment jump */ /* 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 `start_aligning_instruction
opcode_size=1; opcode_size=1;
has_operands=0; has_operands=0;

View File

@ -18,20 +18,20 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
module mem(input [19:0] address,inout wire [15:0] data ,input rd,input wr,input cs); 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 initial begin
string boot_code; string boot_code;
if(!$value$plusargs("BOOT_CODE=%s",boot_code))begin if(!$value$plusargs("BOOT_CODE=%s",boot_code))begin
$display("No boot code specified. Please add +BOOT_CODE=<path> to your vvp args"); $display("No boot code specified. Please add +BOOT_CODE=<path> to your vvp args");
$finish; $finish;
end end
$readmemh(boot_code, memory); $readmemh(boot_code, memory,0,16383);
end 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 always @(negedge wr) begin
memory[address[12:0]]=data; memory[address[15:0]]=data;
end end
endmodule endmodule

View File

@ -56,7 +56,7 @@ end
always @(posedge HALT) begin always @(posedge HALT) begin
$display("Processor halted.\nCycles run for: %d",cycles); $display("Processor halted.\nCycles run for: %d",cycles);
if($value$plusargs("MEMDUMP=%s",memdump_name))begin if($value$plusargs("MEMDUMP=%s",memdump_name))begin
$writememh(memdump_name, sysmem.memory); $writememh(memdump_name, sysmem.memory,0,32767);
end end
#(`CPU_SPEED) //Just for the waveform #(`CPU_SPEED) //Just for the waveform
$finish; $finish;
@ -66,7 +66,7 @@ always @(posedge ERROR) begin
clk_enable <= 0; clk_enable <= 0;
$display("PROCESSOR RUN INTO AN ERROR.\nCycles run for: %d",cycles); $display("PROCESSOR RUN INTO AN ERROR.\nCycles run for: %d",cycles);
if($value$plusargs("MEMDUMP=%s",memdump_name))begin if($value$plusargs("MEMDUMP=%s",memdump_name))begin
$writememh(memdump_name, sysmem.memory); $writememh(memdump_name, sysmem.memory,0,32767);
end end
#(`CPU_SPEED) //Just for the waveform #(`CPU_SPEED) //Just for the waveform
$finish; $finish;