]> git.the-white-hart.net Git - vhdl/commitdiff
Fix color-during-blank bug in vga tiler
authorRyan <>
Fri, 3 Oct 2025 00:58:14 +0000 (19:58 -0500)
committerRyan <>
Fri, 3 Oct 2025 00:58:14 +0000 (19:58 -0500)
libraries/vga/vga_tiler.vhd
libraries/vga/vga_tiler_opt.vhd

index 6fb6bf5a76b7432938186127692df8757ce77dac..5c8be75671232448433975c543341454ed6bf8c3 100644 (file)
@@ -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
index 0a36fe46e6de0fc18caf911da35921ae2a3a09fc..f227afe88a8bf23a8feca7856c2685bc94a78dc3 100644 (file)
@@ -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