Reduced numbers to be sorted in gnome_sort.asm to fit in lcd, fixed hlt on real hardware, slowed down cpu, increased lcd fifo and with that I almost got gnome_sort.asm working perfectly on real hardware

This commit is contained in:
(Tim) Efthimis Kritikos 2023-11-12 07:28:51 +00:00
parent e06c0eeaa0
commit 7d2cb5672f
4 changed files with 20 additions and 13 deletions

View File

@ -5,7 +5,7 @@ mov sp,#STACK
MOV SI,#DATA
GNOME_SORT:
CMP SI,#DATA+31
CMP SI,#DATA+23
JZ GNOMED
MOV AX,[SI]
INC SI
@ -29,7 +29,7 @@ PRINT_LOOP:
MOV AL,[SI]
call PRINT_0_8_HEX
INC SI
CMP SI,#DATA+32
CMP SI,#DATA+24
JNZ PRINT_LOOP
MOV AH,#0x02
@ -41,7 +41,6 @@ hlt
DATA: DB 0x51, 0x17, 0x37, 0x5d, 0x06, 0x3f, 0x51, 0x8b
DB 0xa5, 0x33, 0x54, 0xdf, 0xae, 0xee, 0x3a, 0x18
DB 0xe9, 0xdb, 0x1f, 0x21, 0x44, 0x4f, 0x99, 0x09
DB 0x2a, 0x23, 0x82, 0x4f, 0x52, 0xf1, 0xdc, 0x0b
.BLKB 200
STACK:

View File

@ -504,13 +504,21 @@ always @( posedge clock ) begin
11'b1111_0100_??? : begin
/* HLT - Halt */
/* 1 1 1 1 0 1 0 0 | */
opcode_size=0;
IN_MOD=3'b011;
HALT<=1;
ERROR<=`ERR_NO_ERROR;
MEM_OR_IO<=0;
seq_addr_entry<=`UCODE_NO_INSTRUCTION;
next_state=`EXEC_WAIT;
opcode_size=0;
Wbit=1;
in_alu_sel1=2'b10;
in_alu_sel2=2'b00;
PARAM2=16'hFFFF;
ALU_OP<=`ALU_OP_ADD_SIGNED_B;
OUT_MOD=3'b101;
MEM_OR_IO<=0;
next_state=`EXEC_WRITE_ENTRY;
DEPENDS_ON_PREVIOUS<=0;
memio_address_select=0;
end

View File

@ -40,7 +40,7 @@ wire [15:0] data_bus_read,data_bus_write;
wire rd,wr,BHE,IOMEM;
system system(
/* MISC */ clk48,reset
/* MISC */ counter[7],reset
/* MEMORY / IO */ ,address_bus,data_bus_read,data_bus_write,BHE,rd,wr,IOMEM,HALT,ERROR
);
@ -76,7 +76,7 @@ end
reg reset=0;
reg [1:0] state=0;
always @(posedge counter[3]) begin
always @(posedge counter[15]) begin
if(user_button==0)
state=2'b00;
case (state)
@ -100,7 +100,7 @@ always @(negedge wr) begin
if(IOMEM==1'b1 && address_bus[7:0]==8'hA5 )begin
//disp_write_cache[disp_cache_end]<=data_bus_write[7:0];
disp_write_cache[disp_cache_end]<=data_bus_write[15:8];
disp_cache_end<=disp_cache_end+5'd1;
disp_cache_end<=disp_cache_end+6'd1;
end else if(IOMEM==1'b1 && address_bus[7:0]==8'hB0 )begin
if(data_bus_write[0:0]==1)
rgb_led_color=3'b000;
@ -113,16 +113,16 @@ end
// Cache to allow the slow display to have a
// chance to keep up with the relentless CPU
reg [4:0] disp_cache_start=0;
reg [4:0] disp_cache_end=0;
reg [7:0] disp_write_cache [31:0];
reg [5:0] disp_cache_start=0;
reg [5:0] disp_cache_end=0;
reg [7:0] disp_write_cache [63:0];
reg ascii_state=0;
always @(posedge clk48)begin
case (ascii_state)
1'b0:begin
if(ascii_data_ready&disp_cache_start!=disp_cache_end)begin
ascii_data<=disp_write_cache[disp_cache_start];
disp_cache_start<=disp_cache_start+5'd1;
disp_cache_start<=disp_cache_start+6'd1;
ascii_data_write_req<=1;
ascii_state<=1'b1;
end

View File

@ -34,7 +34,7 @@ initial begin
$readmemh(boot_code, memory,0,`BUILTIN_RAM-1);
`else
//TODO: don't have it hard coded
$readmemh("../boot_code/colored_led.txt", memory,0,`BUILTIN_RAM-1);
$readmemh("../boot_code/gnome_sort.txt", memory,0,`BUILTIN_RAM-1);
`endif
`ifdef NOT_FULL