data/full_repos/permissive/446625160/vgacontroller.v
1: b"%Error: data/full_repos/permissive/446625160/vgacontroller.v:65: Cannot find file containing module: 'RAMB16_S1'\n   RAMB16_S1 #(\n   ^~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/446625160,data/full_repos/permissive/446625160/RAMB16_S1\n             data/full_repos/permissive/446625160,data/full_repos/permissive/446625160/RAMB16_S1.v\n             data/full_repos/permissive/446625160,data/full_repos/permissive/446625160/RAMB16_S1.sv\n             RAMB16_S1\n             RAMB16_S1.v\n             RAMB16_S1.sv\n             obj_dir/RAMB16_S1\n             obj_dir/RAMB16_S1.v\n             obj_dir/RAMB16_S1.sv\n%Error: data/full_repos/permissive/446625160/vgacontroller.v:165: Cannot find file containing module: 'RAMB16_S1'\n   RAMB16_S1 #(\n   ^~~~~~~~~\n%Error: data/full_repos/permissive/446625160/vgacontroller.v:266: Cannot find file containing module: 'RAMB16_S1'\n   RAMB16_S1 #(\n   ^~~~~~~~~\n%Error: Exiting due to 3 error(s)\n"
module vgacontroller(
    input resetbutton,
    input clk,
    output VGA_RED,
    output VGA_GREEN,
    output VGA_BLUE,
    output VGA_HSYNC,
    output VGA_VSYNC
    );


	reg mod2_reg;
	wire mod2_next;
	wire p_tick;

	reg[9:0] h_count_reg, h_count_next;
	reg[9:0] v_count_reg, v_count_next;

	reg v_sync_reg,h_sync_reg;
	wire v_sync_next,h_sync_next;

	wire h_end,v_end,pixel_tick;
	wire h_video_on,v_video_on,video_on;

	wire [9:0] pixel_x , pixel_y;

	reg [13:0] address=14'b00000000000000;

	wire [2:0] address_counter_next;
	reg [2:0] address_counter=3'b000;














   RAMB16_S1 #(
      .INIT(1'b0),
      .SRVAL(1'b0),
      .WRITE_MODE("WRITE_FIRST"),




      .INIT_00(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_01(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_02(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_03(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_04(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_05(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_06(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_07(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_08(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_09(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0A(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0B(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0C(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0D(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0E(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),

      .INIT_10(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_11(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_12(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_13(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_14(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_15(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_16(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_17(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_18(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_19(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_20(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_21(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_22(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_23(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_24(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_25(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_26(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_27(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_28(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_29(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_30(256'h44444444444444444444444444444444FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),
      .INIT_31(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_32(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_33(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_34(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_35(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_36(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_37(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_38(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_39(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3A(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3B(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3C(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3D(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3E(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF44444444444444444444444444444444)
   ) RAMB16_S1_inst (
      .DO(VGA_RED),
      .ADDR(address),
      .CLK(p_tick),
      .DI(1'b0),
      .EN(1'b1),
      .SSR(1'b0),
      .WE(1'b0)
   );
















   RAMB16_S1 #(
      .INIT(1'b0),
      .SRVAL(1'b0),
      .WRITE_MODE("WRITE_FIRST"),





      .INIT_00(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_01(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_02(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_03(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_04(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_05(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_06(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_07(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_08(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_09(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_10(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_11(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_12(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_13(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_14(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_15(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_16(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_17(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_18(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_19(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1A(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1B(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1C(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1D(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1E(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),

      .INIT_20(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_21(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_22(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_23(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_24(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_25(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_26(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_27(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_28(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_29(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_30(256'h22222222222222222222222222222222FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),
      .INIT_31(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_32(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_33(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_34(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_35(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_36(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_37(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_38(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_39(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3A(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3B(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3C(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3D(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3E(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF22222222222222222222222222222222)	
   ) RAMB16_S3_inst (
      .DO(VGA_GREEN),
      .ADDR(address),
      .CLK(p_tick),
      .DI(1'b0),
      .EN(1'b1),
      .SSR(1'b0),
      .WE(1'b0)
   );
















   RAMB16_S1 #(
      .INIT(1'b0),
      .SRVAL(1'b0),
      .WRITE_MODE("WRITE_FIRST"),




      .INIT_00(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_01(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_02(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_03(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_04(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_05(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_06(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_07(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_08(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_09(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_10(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_11(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_12(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_13(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_14(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_15(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_16(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_17(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_18(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_19(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_20(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_21(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_22(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_23(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_24(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_25(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_26(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_27(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_28(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_29(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2A(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2B(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2C(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2D(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2E(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),

      .INIT_30(256'h11111111111111111111111111111111FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),
      .INIT_31(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_32(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_33(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_34(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_35(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_36(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_37(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_38(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_39(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3A(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3B(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3C(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3D(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3E(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11111111111111111111111111111111)
   ) RAMB16_BLUE_inst (
      .DO(VGA_BLUE),
      .ADDR(address),
      .CLK(p_tick),
      .DI(1'b0),
      .EN(1'b1),
      .SSR(1'b0),
      .WE(1'b0)
   );




	localparam HD =640;
	localparam HF =48;
	localparam HB =16;
	localparam HR =96;
	localparam VD =480;
	localparam VF =10;
	localparam VB =33;
	localparam VR =2;


	always @(posedge clk,posedge resetbutton)
		if(resetbutton)
			begin
				mod2_reg <= 1'b0;
				v_count_reg <= 0;
				h_count_reg <= 0;
				v_sync_reg <= 1'b0;
				h_sync_reg <= 1'b0;

			end
		else
			begin
				mod2_reg <= mod2_next;
				v_count_reg <= v_count_next;
				h_count_reg <= h_count_next;
				v_sync_reg <= v_sync_next;
				h_sync_reg <= h_sync_next;

			end
	
	

	assign mod2_next = ~mod2_reg;
	assign pixel_tick = mod2_reg;

	assign h_end = ( h_count_reg == ( HD + HF + HB + HR -2));
	

	assign v_end =( v_count_reg == ( VD + VF + VB + VR -1));



	always @(clk)
		if(pixel_tick)
			if( h_end)
				h_count_next = 0;
			else
				h_count_next = h_count_reg + 1;
		else
			h_count_next = h_count_reg;
			

	always @(clk)
		if(pixel_tick & h_end)
			if(v_end)
				v_count_next <= 0;
			else 
				v_count_next <= v_count_reg + 1;
		else
			v_count_next <= v_count_reg;
	

	always@(pixel_tick)
		if( address_counter == 5)
			begin
			address <= address +1;
			address_counter <= 0;
			end
		else 
			address_counter <= address_counter + 1;
	
	
	


	
	assign h_sync_next = (h_count_reg >= (HD+HB-1) && h_count_reg <= (HD+HB+HR-2));
	

	
	assign v_sync_next = (v_count_reg >= ((VD+VF-1)) && v_count_reg <= (VD+VF ));
	

	



	assign h_video_on = ((h_count_reg < HD )) ; 
	assign v_video_on = (v_count_reg < VD ) ;


	assign VGA_HSYNC = h_sync_reg;
	assign VGA_VSYNC = v_sync_reg;
	assign pixel_x = h_count_reg;
	assign pixel_y = v_count_reg;
	assign p_tick = pixel_tick;

endmodule
module vgacontroller(
    input resetbutton,
    input clk,
    output VGA_RED,
    output VGA_GREEN,
    output VGA_BLUE,
    output VGA_HSYNC,
    output VGA_VSYNC
    );



	reg mod2_reg;
	wire mod2_next;
	wire p_tick;

	reg[9:0] h_count_reg, h_count_next;
	reg[9:0] v_count_reg, v_count_next;

	reg v_sync_reg,h_sync_reg;
	wire v_sync_next,h_sync_next;

	wire h_end,v_end,pixel_tick;
	wire h_video_on,v_video_on,video_on;

	wire [9:0] pixel_x , pixel_y;

	reg [13:0] address=14'b00000000000000;

	wire [2:0] address_counter_next;
	reg [2:0] address_counter=3'b000;














   RAMB16_S1 #(
      .INIT(1'b0),
      .SRVAL(1'b0),
      .WRITE_MODE("WRITE_FIRST"),




      .INIT_00(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_01(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_02(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_03(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_04(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_05(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_06(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_07(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_08(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_09(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0A(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0B(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0C(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0D(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0E(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_0F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),

      .INIT_10(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_11(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_12(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_13(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_14(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_15(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_16(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_17(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_18(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_19(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_20(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_21(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_22(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_23(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_24(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_25(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_26(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_27(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_28(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_29(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_30(256'h44444444444444444444444444444444FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),
      .INIT_31(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_32(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_33(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_34(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_35(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_36(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_37(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_38(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_39(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3A(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3B(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3C(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3D(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3E(256'h4444444444444444444444444444444444444444444444444444444444444444),
      .INIT_3F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF44444444444444444444444444444444)
   ) RAMB16_S1_inst (
      .DO(VGA_RED),
      .ADDR(address),
      .CLK(p_tick),
      .DI(1'b0),
      .EN(1'b1),
      .SSR(1'b0),
      .WE(1'b0)
   );
















   RAMB16_S1 #(
      .INIT(1'b0),
      .SRVAL(1'b0),
      .WRITE_MODE("WRITE_FIRST"),





      .INIT_00(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_01(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_02(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_03(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_04(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_05(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_06(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_07(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_08(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_09(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_10(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_11(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_12(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_13(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_14(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_15(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_16(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_17(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_18(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_19(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1A(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1B(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1C(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1D(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1E(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_1F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),

      .INIT_20(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_21(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_22(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_23(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_24(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_25(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_26(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_27(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_28(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_29(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_2F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_30(256'h22222222222222222222222222222222FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),
      .INIT_31(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_32(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_33(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_34(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_35(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_36(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_37(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_38(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_39(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3A(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3B(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3C(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3D(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3E(256'h2222222222222222222222222222222222222222222222222222222222222222),
      .INIT_3F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF22222222222222222222222222222222)	
   ) RAMB16_S3_inst (
      .DO(VGA_GREEN),
      .ADDR(address),
      .CLK(p_tick),
      .DI(1'b0),
      .EN(1'b1),
      .SSR(1'b0),
      .WE(1'b0)
   );
















   RAMB16_S1 #(
      .INIT(1'b0),
      .SRVAL(1'b0),
      .WRITE_MODE("WRITE_FIRST"),




      .INIT_00(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_01(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_02(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_03(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_04(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_05(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_06(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_07(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_08(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_09(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_0F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_10(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_11(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_12(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_13(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_14(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_15(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_16(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_17(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_18(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_19(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1A(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1B(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1C(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1D(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1E(256'h0000000000000000000000000000000000000000000000000000000000000000),
      .INIT_1F(256'h0000000000000000000000000000000000000000000000000000000000000000),

      .INIT_20(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_21(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_22(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_23(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_24(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_25(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_26(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_27(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_28(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_29(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2A(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2B(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2C(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2D(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2E(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),
      .INIT_2F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000),

      .INIT_30(256'h11111111111111111111111111111111FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF),
      .INIT_31(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_32(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_33(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_34(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_35(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_36(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_37(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_38(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_39(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3A(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3B(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3C(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3D(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3E(256'h1111111111111111111111111111111111111111111111111111111111111111),
      .INIT_3F(256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11111111111111111111111111111111)
   ) RAMB16_BLUE_inst (
      .DO(VGA_BLUE),
      .ADDR(address),
      .CLK(p_tick),
      .DI(1'b0),
      .EN(1'b1),
      .SSR(1'b0),
      .WE(1'b0)
   );




	localparam HD =640;
	localparam HF =48;
	localparam HB =16;
	localparam HR =96;
	localparam VD =480;
	localparam VF =10;
	localparam VB =33;
	localparam VR =2;


	always @(posedge clk,posedge resetbutton)
		if(resetbutton)
			begin
				mod2_reg <= 1'b0;
				v_count_reg <= 0;
				h_count_reg <= 0;
				v_sync_reg <= 1'b0;
				h_sync_reg <= 1'b0;

			end
		else
			begin
				mod2_reg <= mod2_next;
				v_count_reg <= v_count_next;
				h_count_reg <= h_count_next;
				v_sync_reg <= v_sync_next;
				h_sync_reg <= h_sync_next;

			end
	
	

	assign mod2_next = ~mod2_reg;
	assign pixel_tick = mod2_reg;

	assign h_end = ( h_count_reg == ( HD + HF + HB + HR -2));
	

	assign v_end =( v_count_reg == ( VD + VF + VB + VR -1));



	always @(clk)
		if(pixel_tick)
			if( h_end)
				h_count_next = 0;
			else
				h_count_next = h_count_reg + 1;
		else
			h_count_next = h_count_reg;
			

	always @(clk)
		if(pixel_tick & h_end)
			if(v_end)
				v_count_next <= 0;
			else 
				v_count_next <= v_count_reg + 1;
		else
			v_count_next <= v_count_reg;
	

	always@(pixel_tick)
		if( address_counter == 5)
			begin
			address <= address +1;
			address_counter <= 0;
			end
		else 
			address_counter <= address_counter + 1;
	
	
	


	
	assign h_sync_next = (h_count_reg >= (HD+HB-1) && h_count_reg <= (HD+HB+HR-2));
	

	
	assign v_sync_next = (v_count_reg >= ((VD+VF-1)) && v_count_reg <= (VD+VF ));
	

	



	assign h_video_on = ((h_count_reg < HD )) ; 
	assign v_video_on = (v_count_reg < VD ) ;


	assign VGA_HSYNC = h_sync_reg;
	assign VGA_VSYNC = v_sync_reg;
	assign pixel_x = h_count_reg;
	assign pixel_y = v_count_reg;
	assign p_tick = pixel_tick;

endmodule