From: Ryan <> Date: Fri, 3 Oct 2025 00:58:14 +0000 (-0500) Subject: Fix color-during-blank bug in vga tiler X-Git-Url: https://git.the-white-hart.net/?a=commitdiff_plain;h=69ffaf5501f71660e7dfb416a8cda93473278e11;p=vhdl Fix color-during-blank bug in vga tiler --- diff --git a/libraries/vga/vga_tiler.vhd b/libraries/vga/vga_tiler.vhd index 6fb6bf5..5c8be75 100644 --- a/libraries/vga/vga_tiler.vhd +++ b/libraries/vga/vga_tiler.vhd @@ -757,12 +757,24 @@ begin s4_bit <= s34_tile_line_reg(to_integer(unsigned(not s34_pix_x_reg(3 downto 1)))); s4_visible <= not (s34_h_blank_reg or s34_v_blank_reg); - -- s4_vga_red <= "111" when (s4_visible and s4_bit) = '1' else "000"; - -- s4_vga_green <= "111" when (s4_visible and s4_bit) = '1' else "000"; - -- s4_vga_blue <= "11" when (s4_visible and s4_bit) = '1' else "00"; - s4_vga_red <= s34_fg_color_reg(7 downto 5) when (s4_visible and s4_bit) = '1' else s34_bg_color_reg(7 downto 5); - s4_vga_green <= s34_fg_color_reg(4 downto 2) when (s4_visible and s4_bit) = '1' else s34_bg_color_reg(4 downto 2); - s4_vga_blue <= s34_fg_color_reg(1 downto 0) when (s4_visible and s4_bit) = '1' else s34_bg_color_reg(1 downto 0); + process (s4_bit, s4_visible, s34_fg_color_reg, s34_bg_color_reg) + begin + if s4_visible = '0' then + s4_vga_red <= (others => '0'); + s4_vga_green <= (others => '0'); + s4_vga_blue <= (others => '0'); + else + if s4_bit = '1' then + s4_vga_red <= s34_fg_color_reg(7 downto 5); + s4_vga_green <= s34_fg_color_reg(4 downto 2); + s4_vga_blue <= s34_fg_color_reg(1 downto 0); + else + s4_vga_red <= s34_bg_color_reg(7 downto 5); + s4_vga_green <= s34_bg_color_reg(4 downto 2); + s4_vga_blue <= s34_bg_color_reg(1 downto 0); + end if; + end if; + end process; -- Register 4-output diff --git a/libraries/vga/vga_tiler_opt.vhd b/libraries/vga/vga_tiler_opt.vhd index 0a36fe4..f227afe 100644 --- a/libraries/vga/vga_tiler_opt.vhd +++ b/libraries/vga/vga_tiler_opt.vhd @@ -757,12 +757,24 @@ begin s4_bit <= s34_tile_line_reg(to_integer(unsigned(not s34_pix_x_reg(3 downto 1)))); s4_visible <= not (s34_h_blank_reg or s34_v_blank_reg); - -- s4_vga_red <= "111" when (s4_visible and s4_bit) = '1' else "000"; - -- s4_vga_green <= "111" when (s4_visible and s4_bit) = '1' else "000"; - -- s4_vga_blue <= "11" when (s4_visible and s4_bit) = '1' else "00"; - s4_vga_red <= s34_fg_color_reg(7 downto 5) when (s4_visible and s4_bit) = '1' else s34_bg_color_reg(7 downto 5); - s4_vga_green <= s34_fg_color_reg(4 downto 2) when (s4_visible and s4_bit) = '1' else s34_bg_color_reg(4 downto 2); - s4_vga_blue <= s34_fg_color_reg(1 downto 0) when (s4_visible and s4_bit) = '1' else s34_bg_color_reg(1 downto 0); + process (s4_bit, s4_visible, s34_fg_color_reg, s34_bg_color_reg) + begin + if s4_visible = '0' then + s4_vga_red <= (others => '0'); + s4_vga_green <= (others => '0'); + s4_vga_blue <= (others => '0'); + else + if s4_bit = '1' then + s4_vga_red <= s34_fg_color_reg(7 downto 5); + s4_vga_green <= s34_fg_color_reg(4 downto 2); + s4_vga_blue <= s34_fg_color_reg(1 downto 0); + else + s4_vga_red <= s34_bg_color_reg(7 downto 5); + s4_vga_green <= s34_bg_color_reg(4 downto 2); + s4_vga_blue <= s34_bg_color_reg(1 downto 0); + end if; + end if; + end process; -- Register 4-output