data/full_repos/permissive/173003307/src/vga_control.v
1: b"%Error: data/full_repos/permissive/173003307/src/vga_control.v:64: Cannot find file containing module: 'Generic_counter'\n    Generic_counter # (.COUNTER_WIDTH(2),\n    ^~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/173003307/src,data/full_repos/permissive/173003307/Generic_counter\n             data/full_repos/permissive/173003307/src,data/full_repos/permissive/173003307/Generic_counter.v\n             data/full_repos/permissive/173003307/src,data/full_repos/permissive/173003307/Generic_counter.sv\n             Generic_counter\n             Generic_counter.v\n             Generic_counter.sv\n             obj_dir/Generic_counter\n             obj_dir/Generic_counter.v\n             obj_dir/Generic_counter.sv\n%Error: data/full_repos/permissive/173003307/src/vga_control.v:160: Cannot find file containing module: 'Generic_counter'\n    Generic_counter # (.COUNTER_WIDTH(10),\n    ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/173003307/src/vga_control.v:173: Cannot find file containing module: 'Generic_counter'\n     Generic_counter # (.COUNTER_WIDTH(9),\n     ^~~~~~~~~~~~~~~\n%Error: Exiting due to 3 error(s)\n"
module VGA_Sig_Gen(
            input CLK,
            input RESET,
            input RE,

            input [15:0] CONFIG_COLOURS,

            output DPR_CLK,
            output [14:0] VGA_ADDR,
            input VGA_DATA,

            output reg VGA_HS,
            output reg VGA_VS,
            output reg [7:0] VGA_COLOUR
            );
	

    Generic_counter # (.COUNTER_WIDTH(2),
                       .COUNTER_MAX(3)
                       )
                       MHz_25_CLK (
                       .CLK(CLK),
                       .ENABLE_IN(1'b1),
                       .RESET(1'b0),
                       .TRIG_OUT(VGA_CLK)
                       );

    reg VGA_CLK_2;
    reg [1:0] counter;
    
    always @ (posedge CLK)
    begin
        if (RESET)
            counter <= 2'b00;
        else
            counter <= counter + 1'b1;
            
        if (counter == 2'b00 || counter == 2'b01) 
            VGA_CLK_2 <= 1'b0;
        else 
            VGA_CLK_2 <= 1'b1;
    end
    







        










	parameter HTs = 800;
	parameter HTpw = 96;
	parameter HTDisp = 640;
	parameter Hbp = 48;
	parameter Hfp = 16;

	parameter HorTimeToBackPorchEnd = HTpw + Hbp;
	parameter HorTimeToDispEnd = HTs - Hfp;
	
	parameter VTs = 521;
	parameter VTpw = 2;
	parameter VTDisp = 480;
	parameter Vbp = 29;
	parameter Vfp = 10;

	parameter VertTimeToBackPorchEnd = VTpw + Vbp;
	parameter VertTimeToDispEnd = 511;
	

	wire [9:0] HCounter; 
	wire [8:0] VCounter; 
	

	wire HorTriggOut;
	

	reg [9:0] H_ADDR;
	reg [8:0] V_ADDR;






















    

    Generic_counter # (.COUNTER_WIDTH(10),
                       .COUNTER_MAX(HTs-1)
                       )
                       HorizCounter (
                       .CLK(VGA_CLK),
                       .ENABLE_IN(1'b1),
                       .RESET(1'b0),
                       .TRIG_OUT(HorTriggOut),
                       .COUNT(HCounter)
                       );
                       

                       
     Generic_counter # (.COUNTER_WIDTH(9),
                        .COUNTER_MAX(VTs-1)
                       )
                       VerticalCounter (
                       .CLK(VGA_CLK_2),
                       .ENABLE_IN(HorTriggOut),
                       .RESET(1'b0),
                       .COUNT(VCounter)
                       );


     assign DPR_CLK = VGA_CLK_2;
     assign VGA_ADDR = {V_ADDR[8:2], H_ADDR[9:2]};


     always@( posedge CLK) begin
          if (HCounter < HTpw)
          VGA_HS <= 0;
          else 
          VGA_HS <= 1;
     end
     

     always@(posedge CLK) begin
          if (VCounter < VTpw)
          VGA_VS <= 0;
          else 
          VGA_VS <= 1;
     end
     

     always@(posedge CLK) begin
          if (HCounter < HorTimeToDispEnd && HCounter > HorTimeToBackPorchEnd)
                H_ADDR <= HCounter - HorTimeToBackPorchEnd;
          else 
                H_ADDR <= 0;      
     end           
     

     always@(posedge CLK) begin           
          if ( VCounter < VertTimeToDispEnd && VCounter > VertTimeToBackPorchEnd)
                 V_ADDR <= VCounter - VertTimeToBackPorchEnd;
          else 
                 V_ADDR <= 0;
     end
     

    always@( posedge CLK) 
	begin
		if (HCounter < HorTimeToDispEnd && HCounter > HorTimeToBackPorchEnd 
            && VCounter < VertTimeToDispEnd && VCounter > VertTimeToBackPorchEnd)
        begin
			if(~VGA_DATA)
		          VGA_COLOUR <= CONFIG_COLOURS[15:8];
			else if(VGA_DATA)
				  VGA_COLOUR <= CONFIG_COLOURS[7:0];
		end
		else
			VGA_COLOUR <= 8'h00;
    end      

endmodule
module VGA_Sig_Gen(
            input CLK,
            input RESET,
            input RE,

            input [15:0] CONFIG_COLOURS,

            output DPR_CLK,
            output [14:0] VGA_ADDR,
            input VGA_DATA,

            output reg VGA_HS,
            output reg VGA_VS,
            output reg [7:0] VGA_COLOUR
            );

	

    Generic_counter # (.COUNTER_WIDTH(2),
                       .COUNTER_MAX(3)
                       )
                       MHz_25_CLK (
                       .CLK(CLK),
                       .ENABLE_IN(1'b1),
                       .RESET(1'b0),
                       .TRIG_OUT(VGA_CLK)
                       );

    reg VGA_CLK_2;
    reg [1:0] counter;
    
    always @ (posedge CLK)
    begin
        if (RESET)
            counter <= 2'b00;
        else
            counter <= counter + 1'b1;
            
        if (counter == 2'b00 || counter == 2'b01) 
            VGA_CLK_2 <= 1'b0;
        else 
            VGA_CLK_2 <= 1'b1;
    end
    







        










	parameter HTs = 800;
	parameter HTpw = 96;
	parameter HTDisp = 640;
	parameter Hbp = 48;
	parameter Hfp = 16;

	parameter HorTimeToBackPorchEnd = HTpw + Hbp;
	parameter HorTimeToDispEnd = HTs - Hfp;
	
	parameter VTs = 521;
	parameter VTpw = 2;
	parameter VTDisp = 480;
	parameter Vbp = 29;
	parameter Vfp = 10;

	parameter VertTimeToBackPorchEnd = VTpw + Vbp;
	parameter VertTimeToDispEnd = 511;
	

	wire [9:0] HCounter; 
	wire [8:0] VCounter; 
	

	wire HorTriggOut;
	

	reg [9:0] H_ADDR;
	reg [8:0] V_ADDR;






















    

    Generic_counter # (.COUNTER_WIDTH(10),
                       .COUNTER_MAX(HTs-1)
                       )
                       HorizCounter (
                       .CLK(VGA_CLK),
                       .ENABLE_IN(1'b1),
                       .RESET(1'b0),
                       .TRIG_OUT(HorTriggOut),
                       .COUNT(HCounter)
                       );
                       

                       
     Generic_counter # (.COUNTER_WIDTH(9),
                        .COUNTER_MAX(VTs-1)
                       )
                       VerticalCounter (
                       .CLK(VGA_CLK_2),
                       .ENABLE_IN(HorTriggOut),
                       .RESET(1'b0),
                       .COUNT(VCounter)
                       );


     assign DPR_CLK = VGA_CLK_2;
     assign VGA_ADDR = {V_ADDR[8:2], H_ADDR[9:2]};


     always@( posedge CLK) begin
          if (HCounter < HTpw)
          VGA_HS <= 0;
          else 
          VGA_HS <= 1;
     end
     

     always@(posedge CLK) begin
          if (VCounter < VTpw)
          VGA_VS <= 0;
          else 
          VGA_VS <= 1;
     end
     

     always@(posedge CLK) begin
          if (HCounter < HorTimeToDispEnd && HCounter > HorTimeToBackPorchEnd)
                H_ADDR <= HCounter - HorTimeToBackPorchEnd;
          else 
                H_ADDR <= 0;      
     end           
     

     always@(posedge CLK) begin           
          if ( VCounter < VertTimeToDispEnd && VCounter > VertTimeToBackPorchEnd)
                 V_ADDR <= VCounter - VertTimeToBackPorchEnd;
          else 
                 V_ADDR <= 0;
     end
     

    always@( posedge CLK) 
	begin
		if (HCounter < HorTimeToDispEnd && HCounter > HorTimeToBackPorchEnd 
            && VCounter < VertTimeToDispEnd && VCounter > VertTimeToBackPorchEnd)
        begin
			if(~VGA_DATA)
		          VGA_COLOUR <= CONFIG_COLOURS[15:8];
			else if(VGA_DATA)
				  VGA_COLOUR <= CONFIG_COLOURS[7:0];
		end
		else
			VGA_COLOUR <= 8'h00;
    end      

endmodule