I am not really sure what is wrong with my code bellow for a vga. All I want the program to do is display a solid color on the monitor. I want to use the switches on my card to change the color displayed. I ran the simulation and all the hsync and vsync signals seem to be as expected. When I flick the switches I get a short pulse of color on the display and then it goes black. Anyone know what is wrong with this code?
module vga(output reg [3:0] red, green, blue, input [15:0] sw, output hsync, vsync, input clk); wire vga_clk; //25.203 Mhz vga_clk_gen gen(.clk_in1(clk), .clk_out1(vga_clk)); reg [9:0] hpx = 0, vpx = 0; reg [9:0] next_hpx, next_vpx; reg [3:0] next_red, next_green, next_blue; assign hsync = !(hpx >= 660 && hpx <= 756); assign vsync = !(vpx >= 494 && vpx <= 495); always @(posedge vga_clk) begin hpx <= next_hpx; vpx <= next_vpx; red <= next_red; green <= next_green; blue <= next_blue; end always @* begin next_red = sw[3:0]; next_blue = sw[7:4]; next_green = sw[11:8]; next_vpx = vpx; if(hpx == 800) begin next_hpx = 0; if(vpx == 525) next_vpx = 0; else next_vpx = vpx + 1; end else begin next_hpx = hpx + 1; end end endmodule