From e7193272ff90a62f58b13725eee10b0796192949 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sun, 19 Nov 2023 00:16:34 -0600 Subject: rtl/gfx: fix mem_address units to bytes instead of words --- rtl/gfx/gfx_scanout_dac.sv | 48 +++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'rtl/gfx/gfx_scanout_dac.sv') diff --git a/rtl/gfx/gfx_scanout_dac.sv b/rtl/gfx/gfx_scanout_dac.sv index ba8b0b7..c199d78 100644 --- a/rtl/gfx/gfx_scanout_dac.sv +++ b/rtl/gfx/gfx_scanout_dac.sv @@ -2,30 +2,30 @@ module gfx_scanout_dac ( - input logic clk, - rst_n, + input logic clk, + rst_n, - input logic enable_clear, - input rgb24 clear_color, + input logic enable_clear, + input rgb24 clear_color, - input logic mask_fifo_out, - input mem_word fb_fifo_out, - input logic in_valid, - output logic in_ready, + input logic mask_fifo_out, + input vram_word fb_fifo_out, + input logic in_valid, + output logic in_ready, - input logic scan_ready, - output logic scan_valid, - scan_endofpacket, - scan_startofpacket, - output rgb30 scan_data, + input logic scan_ready, + output logic scan_valid, + scan_endofpacket, + scan_startofpacket, + output rgb30 scan_data, - output logic vsync + output logic vsync ); logic dac_valid, half, half_mask, stall, endofpacket, startofpacket; rgb24 pixel; rgb32 fifo_pixel; - mem_word msw, lsw; + vram_word msw, lsw; half_coord next_addr; linear_coord max_addr, pixel_addr; @@ -42,17 +42,14 @@ module gfx_scanout_dac assign max_addr = `GFX_X_RES * `GFX_Y_RES - 1; - function color10 dac_color(color8 in); - dac_color = {in, {2{in[0]}}}; - endfunction - assign fifo_pixel = {msw, lsw}; - assign skid_in.pixel.r = dac_color(pixel.r); - assign skid_in.pixel.g = dac_color(pixel.g); - assign skid_in.pixel.b = dac_color(pixel.b); assign skid_in.endofpacket = endofpacket; assign skid_in.startofpacket = startofpacket; + function color10 dac_color(color8 in); + dac_color = {in, {2{in[0]}}}; + endfunction + always_comb begin // Descarta fifo_pixel.a pixel.r = fifo_pixel.r; @@ -61,6 +58,13 @@ module gfx_scanout_dac if (!half_mask) pixel = clear_color; + + /* Esto no puede ir en assigns. Funciona en Verilator pero causa ub en + * la netlist de Quartus. Eso no está documentado y perdí muchas horas. + */ + skid_in.pixel.r = dac_color(pixel.r); + skid_in.pixel.g = dac_color(pixel.g); + skid_in.pixel.b = dac_color(pixel.b); end gfx_skid_flow flow -- cgit v1.2.3