Starting work on PPU -> display -> VGA

This commit is contained in:
2023-10-13 20:46:05 +01:00
parent bfcdec1d83
commit 3c3dbd2175
10 changed files with 600 additions and 20 deletions

View File

@@ -4,10 +4,16 @@ module ppu (
input logic clk,
input logic nreset,
output logic display_enable_o,
input logic [15:0] cpu_addr_i,
output logic [ 7:0] cpu_rdata_o,
input logic cpu_we_i,
input logic [ 7:0] cpu_wdata_i
input logic [ 7:0] cpu_wdata_i,
output logic [ 1:0] pixel_o,
output logic vsync_o,
output logic hsync_o
);
`define IOREG_DECL(name) \
@@ -24,7 +30,7 @@ module ppu (
name``_r <= name``_next; \
end \
assign name``_sel = (cpu_addr_i == addr); \
assign name``_we = name``_we & cpu_we_i;
assign name``_we = name``_sel & cpu_we_i;
typedef struct packed {
logic lcd_en;
@@ -93,6 +99,14 @@ assign cpu_rdata_o =
`endif
{8{ sy_sel}} & sy_r;
assign pixel_o = ((lx_r < 8'd160) & (ly_r < 8'd144)) ? ly_r[1:0] : // should create a nice line-pattern for now
2'h00;
assign vsync_o = ly_r >= 8'd144;
assign hsync_o = lx_r >= 8'd160;
assign display_enable_o = lcdc_r[7];
`undef IOREG_DEF
`undef IOREG_DECL