data/full_repos/permissive/176154329/src/display/display_top.v
1: b"%Error: data/full_repos/permissive/176154329/src/display/display_top.v:51: Cannot find file containing module: 'vga_sync'\n vga_sync vsync_unit (.clk(clk), .reset(hard_reset), .hsync(hsync), .vsync(vsync),\n ^~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/176154329/src/display,data/full_repos/permissive/176154329/vga_sync\n             data/full_repos/permissive/176154329/src/display,data/full_repos/permissive/176154329/vga_sync.v\n             data/full_repos/permissive/176154329/src/display,data/full_repos/permissive/176154329/vga_sync.sv\n             vga_sync\n             vga_sync.v\n             vga_sync.sv\n             obj_dir/vga_sync\n             obj_dir/vga_sync.v\n             obj_dir/vga_sync.sv\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:55: Cannot find file containing module: 'background_rom'\n background_rom background_unit (.clk(clk), .row(y[9:0]), .col(x[9:0]), .color_data(bg_rgb));\n ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:59: Cannot find file containing module: 'translate'\n translate #(210) translate1 (.clk(clk), .sw(sw), .x_out(t_x1));\n ^~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:60: Cannot find file containing module: 'translate'\n translate #(410) translate2 (.clk(clk), .sw(sw), .x_out(t_x2));\n ^~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:61: Cannot find file containing module: 'translate'\n translate #(610) translate3 (.clk(clk), .sw(sw), .x_out(t_x3));\n ^~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:62: Cannot find file containing module: 'random_height'\n random_height rh1(.clk(clk),.x(pipe1_x),.y(t_y1));\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:63: Cannot find file containing module: 'random_height'\n random_height rh2(.clk(clk),.x(pipe2_x),.y(t_y2));\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:64: Cannot find file containing module: 'random_height'\n random_height rh3(.clk(clk),.x(pipe3_x),.y(t_y3));\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:67: Cannot find file containing module: 'object1_rom'\n object1_rom object_rom_unit1 (.clk(clk), .row(object_row), .col(object_col), .color_data(color_data_object));\n ^~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:68: Cannot find file containing module: 'object_engine'\n object_engine #(.T_W(32), .T_H(23), .START_X(90)) bird_unit (.clk(clk), .reset(reset), \n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:74: Cannot find file containing module: 'object2_rom'\n object2_rom pipe_rom_unit1 (.clk(clk), .row(pipe1_row), .col(pipe1_col), .color_data(color_data_pipe1));\n ^~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:75: Cannot find file containing module: 'object_engine'\n object_engine #(.T_W(52), .T_H(450), .START_X(210)) pipe1_unit (.clk(clk), .reset(reset), \n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:80: Cannot find file containing module: 'object2_rom'\n object2_rom pipe_rom_unit2 (.clk(clk), .row(pipe2_row), .col(pipe2_col), .color_data(color_data_pipe2));\n ^~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:81: Cannot find file containing module: 'object_engine'\n object_engine #(.T_W(52), .T_H(450), .START_X(410)) pipe2_unit (.clk(clk), .reset(reset), \n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:86: Cannot find file containing module: 'object2_rom'\n object2_rom pipe_rom_unit3 (.clk(clk), .row(pipe3_row), .col(pipe3_col), .color_data(color_data_pipe3));\n ^~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:87: Cannot find file containing module: 'object_engine'\n object_engine #(.T_W(52), .T_H(450),.START_X(610)) pipe3_unit (.clk(clk), .reset(reset), \n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:94: Cannot find file containing module: 'is_collide'\n is_collide is_collideUpper(.f_x(bird_x), .f_y(bird_y), .s_x(0), .s_y(1), .f_w(32), .f_h(23), .s_h(2), .s_w(480), .collision(collisions[4]));\n ^~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:95: Cannot find file containing module: 'is_collide'\n is_collide is_collideLower(.f_x(bird_x), .f_y(bird_y), .s_x(0), .s_y(479), .f_w(32), .f_h(23), .s_h(2), .s_w(480), .collision(collisions[5]));\n ^~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:98: Cannot find file containing module: 'is_collide'\n is_collide is_collide1(.f_x(bird_x), .f_y(bird_y),.s_x(pipe1_x), .s_y(pipe1_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[1]));\n ^~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:99: Cannot find file containing module: 'is_collide'\n is_collide is_collide2(.f_x(bird_x), .f_y(bird_y),.s_x(pipe2_x), .s_y(pipe2_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[2]));\n ^~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:100: Cannot find file containing module: 'is_collide'\n is_collide is_collide3(.f_x(bird_x), .f_y(bird_y),.s_x(pipe3_x), .s_y(pipe3_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[3]));\n ^~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:106: Cannot find file containing module: 'score_generator'\n score_generator generator(.clk(clk),.score(score));\n ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:107: Cannot find file containing module: 'score_display'\n score_display score_dispaly(.clk(clk),.mode(1),.num1(score),.num2(),.enable(1),.seg(seg),.an(an));\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:109: Cannot find file containing module: 'key_detect'\n    key_detect key_detecter (.out(keys), .clk(clk), .PS2Clk(PS2Clk), .PS2Data(PS2Data));\n    ^~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:112: Cannot find file containing module: 'game_state_machine'\n game_state_machine game_FSM (.clk(clk), .hard_reset(hard_reset), .start(start), .collision(collision),\n ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176154329/src/display/display_top.v:116: Cannot find file containing module: 'gameover_display'\n gameover_display gameover_display_unit (.clk(clk), .x(x), .y(y), .rgb_out(gameover_rgb),\n ^~~~~~~~~~~~~~~~\n%Error: Exiting due to 26 error(s)\n"
module display_top
	(
		input wire clk, hard_reset,
		input wire PS2Data, PS2Clk,
		input wire [3:0] sw,
		output wire hsync, vsync,
		output wire [11:0] rgb,
		output wire [7:0] seg, 
		output wire [3:0] an,
	     output wire [1:0]led
	 );
	

	localparam idle = 3'b001;
	localparam gameover = 3'b100;
	wire [2:0] game_state;
	wire game_en;
	wire game_reset;
    wire reset = hard_reset || game_reset;
	wire [9:0] x, y;
	wire video_on, pixel_tick;
	reg [11:0] rgb_reg, rgb_next;
	wire [11:0] bg_rgb, object_rgb;
	wire [11:0] pipe_rgb1, pipe_rgb2, pipe_rgb3;
	wire [11:0] gameover_rgb;
	wire [9:0] bird_x, bird_y;
	wire [9:0] pipe1_x, pipe1_y;
	wire [9:0] pipe2_x, pipe2_y;
	wire [9:0] pipe3_x, pipe3_y;
	wire object_on;
	wire [3:0] pipes_on;
	wire [9:0] object_row, object_col;
	wire [9:0] pipe1_row, pipe1_col;
	wire [9:0] pipe2_row, pipe2_col;
	wire [9:0] pipe3_row, pipe3_col;							  
	wire [11:0] color_data_object;
	wire [11:0] color_data_pipe1, color_data_pipe2, color_data_pipe3;
	wire [31:0] keys;
	wire [5:0] collisions;
	wire gameover_on;
	wire up = keys[0] && game_en;
	wire start = sw[0] || sw[1] || sw[2] || sw[3];
	

	

	vga_sync vsync_unit (.clk(clk), .reset(hard_reset), .hsync(hsync), .vsync(vsync),
                             .video_on(video_on), .p_tick(pixel_tick), .x(x), .y(y));
	

	background_rom background_unit (.clk(clk), .row(y[9:0]), .col(x[9:0]), .color_data(bg_rgb));
	

	wire [9:0] t_x1, t_y1, t_x2, t_y2, t_x3, t_y3;
	translate #(210) translate1 (.clk(clk), .sw(sw), .x_out(t_x1));
	translate #(410) translate2 (.clk(clk), .sw(sw), .x_out(t_x2));
	translate #(610) translate3 (.clk(clk), .sw(sw), .x_out(t_x3));
	random_height rh1(.clk(clk),.x(pipe1_x),.y(t_y1));
	random_height rh2(.clk(clk),.x(pipe2_x),.y(t_y2));
	random_height rh3(.clk(clk),.x(pipe3_x),.y(t_y3));


	object1_rom object_rom_unit1 (.clk(clk), .row(object_row), .col(object_col), .color_data(color_data_object));
	object_engine #(.T_W(32), .T_H(23), .START_X(90)) bird_unit (.clk(clk), .reset(reset), 
				 .btnU(up), .video_on(video_on), .x(x), .y(y),
				 .grounded(0), .gravity(1), .jump_in_air(1),
				 .rgb_out(object_rgb), .object_out_on(object_on), .o_x(bird_x), .o_y(bird_y),.object_enable(1),
				 .row(object_row), .col(object_col), .color_data(color_data_object));

	object2_rom pipe_rom_unit1 (.clk(clk), .row(pipe1_row), .col(pipe1_col), .color_data(color_data_pipe1));
	object_engine #(.T_W(52), .T_H(450), .START_X(210)) pipe1_unit (.clk(clk), .reset(reset), 
				 .video_on(video_on), .x(x), .y(y), .no_boundary(1),
				 .trans_x_on(1), .t_x(t_x1),.trans_y_on(1), .t_y(t_y1),
				 .rgb_out(pipe_rgb1), .object_out_on(pipes_on[1]), .o_x(pipe1_x), .o_y(pipe1_y),.object_enable(1),
				 .row(pipe1_row), .col(pipe1_col), .color_data(color_data_pipe1));
	object2_rom pipe_rom_unit2 (.clk(clk), .row(pipe2_row), .col(pipe2_col), .color_data(color_data_pipe2));
	object_engine #(.T_W(52), .T_H(450), .START_X(410)) pipe2_unit (.clk(clk), .reset(reset), 
				 .video_on(video_on), .x(x), .y(y), .no_boundary(1),
				 .trans_x_on(1), .t_x(t_x2),.trans_y_on(1), .t_y(t_y2),
				 .rgb_out(pipe_rgb2), .object_out_on(pipes_on[2]), .o_x(pipe2_x), .o_y(pipe2_y),.object_enable(1),
				 .row(pipe2_row), .col(pipe2_col), .color_data(color_data_pipe2));
	object2_rom pipe_rom_unit3 (.clk(clk), .row(pipe3_row), .col(pipe3_col), .color_data(color_data_pipe3));
	object_engine #(.T_W(52), .T_H(450),.START_X(610)) pipe3_unit (.clk(clk), .reset(reset), 
				 .video_on(video_on), .x(x), .y(y), .no_boundary(1),
				 .trans_x_on(1), .t_x(t_x3),.trans_y_on(1), .t_y(t_y3),
				 .rgb_out(pipe_rgb3), .object_out_on(pipes_on[3]), .o_x(pipe3_x), .o_y(pipe3_y),.object_enable(1),
				 .row(pipe3_row), .col(pipe3_col), .color_data(color_data_pipe3));


	is_collide is_collideUpper(.f_x(bird_x), .f_y(bird_y), .s_x(0), .s_y(1), .f_w(32), .f_h(23), .s_h(2), .s_w(480), .collision(collisions[4]));
	is_collide is_collideLower(.f_x(bird_x), .f_y(bird_y), .s_x(0), .s_y(479), .f_w(32), .f_h(23), .s_h(2), .s_w(480), .collision(collisions[5]));
	

	is_collide is_collide1(.f_x(bird_x), .f_y(bird_y),.s_x(pipe1_x), .s_y(pipe1_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[1]));
	is_collide is_collide2(.f_x(bird_x), .f_y(bird_y),.s_x(pipe2_x), .s_y(pipe2_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[2]));
	is_collide is_collide3(.f_x(bird_x), .f_y(bird_y),.s_x(pipe3_x), .s_y(pipe3_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[3]));

	wire collision = collisions[1] || collisions[2] || collisions[3] || collisions[4] || collisions[5];
    assign led[0]=collision;

	wire [13:0]score;
	score_generator generator(.clk(clk),.score(score));
	score_display score_dispaly(.clk(clk),.mode(1),.num1(score),.num2(),.enable(1),.seg(seg),.an(an));

    key_detect key_detecter (.out(keys), .clk(clk), .PS2Clk(PS2Clk), .PS2Data(PS2Data));


	game_state_machine game_FSM (.clk(clk), .hard_reset(hard_reset), .start(start), .collision(collision),
				     			 .game_state(game_state), .game_en(game_en), .game_reset(game_reset));
	

	gameover_display gameover_display_unit (.clk(clk), .x(x), .y(y), .rgb_out(gameover_rgb),
	                                        .gameover_on(gameover_on));



    always @*
		begin
        	if (~video_on)
				rgb_next = 12'b0;


			else if(gameover_on && game_state == gameover)
				rgb_next = gameover_rgb;
			else if (object_on)
				rgb_next = object_rgb;
			else if (pipes_on[1])
				rgb_next = pipe_rgb1;
			else if (pipes_on[2])
				rgb_next = pipe_rgb2;
			else if (pipes_on[3])
				rgb_next = pipe_rgb3;
            else
                rgb_next = bg_rgb;			
		end
	

	always @(posedge clk)
		if (pixel_tick)
			rgb_reg <= rgb_next;		
			

	assign rgb = rgb_reg;

endmodule
module display_top
	(
		input wire clk, hard_reset,
		input wire PS2Data, PS2Clk,
		input wire [3:0] sw,
		output wire hsync, vsync,
		output wire [11:0] rgb,
		output wire [7:0] seg, 
		output wire [3:0] an,
	     output wire [1:0]led
	 );

	

	localparam idle = 3'b001;
	localparam gameover = 3'b100;
	wire [2:0] game_state;
	wire game_en;
	wire game_reset;
    wire reset = hard_reset || game_reset;
	wire [9:0] x, y;
	wire video_on, pixel_tick;
	reg [11:0] rgb_reg, rgb_next;
	wire [11:0] bg_rgb, object_rgb;
	wire [11:0] pipe_rgb1, pipe_rgb2, pipe_rgb3;
	wire [11:0] gameover_rgb;
	wire [9:0] bird_x, bird_y;
	wire [9:0] pipe1_x, pipe1_y;
	wire [9:0] pipe2_x, pipe2_y;
	wire [9:0] pipe3_x, pipe3_y;
	wire object_on;
	wire [3:0] pipes_on;
	wire [9:0] object_row, object_col;
	wire [9:0] pipe1_row, pipe1_col;
	wire [9:0] pipe2_row, pipe2_col;
	wire [9:0] pipe3_row, pipe3_col;							  
	wire [11:0] color_data_object;
	wire [11:0] color_data_pipe1, color_data_pipe2, color_data_pipe3;
	wire [31:0] keys;
	wire [5:0] collisions;
	wire gameover_on;
	wire up = keys[0] && game_en;
	wire start = sw[0] || sw[1] || sw[2] || sw[3];
	

	

	vga_sync vsync_unit (.clk(clk), .reset(hard_reset), .hsync(hsync), .vsync(vsync),
                             .video_on(video_on), .p_tick(pixel_tick), .x(x), .y(y));
	

	background_rom background_unit (.clk(clk), .row(y[9:0]), .col(x[9:0]), .color_data(bg_rgb));
	

	wire [9:0] t_x1, t_y1, t_x2, t_y2, t_x3, t_y3;
	translate #(210) translate1 (.clk(clk), .sw(sw), .x_out(t_x1));
	translate #(410) translate2 (.clk(clk), .sw(sw), .x_out(t_x2));
	translate #(610) translate3 (.clk(clk), .sw(sw), .x_out(t_x3));
	random_height rh1(.clk(clk),.x(pipe1_x),.y(t_y1));
	random_height rh2(.clk(clk),.x(pipe2_x),.y(t_y2));
	random_height rh3(.clk(clk),.x(pipe3_x),.y(t_y3));


	object1_rom object_rom_unit1 (.clk(clk), .row(object_row), .col(object_col), .color_data(color_data_object));
	object_engine #(.T_W(32), .T_H(23), .START_X(90)) bird_unit (.clk(clk), .reset(reset), 
				 .btnU(up), .video_on(video_on), .x(x), .y(y),
				 .grounded(0), .gravity(1), .jump_in_air(1),
				 .rgb_out(object_rgb), .object_out_on(object_on), .o_x(bird_x), .o_y(bird_y),.object_enable(1),
				 .row(object_row), .col(object_col), .color_data(color_data_object));

	object2_rom pipe_rom_unit1 (.clk(clk), .row(pipe1_row), .col(pipe1_col), .color_data(color_data_pipe1));
	object_engine #(.T_W(52), .T_H(450), .START_X(210)) pipe1_unit (.clk(clk), .reset(reset), 
				 .video_on(video_on), .x(x), .y(y), .no_boundary(1),
				 .trans_x_on(1), .t_x(t_x1),.trans_y_on(1), .t_y(t_y1),
				 .rgb_out(pipe_rgb1), .object_out_on(pipes_on[1]), .o_x(pipe1_x), .o_y(pipe1_y),.object_enable(1),
				 .row(pipe1_row), .col(pipe1_col), .color_data(color_data_pipe1));
	object2_rom pipe_rom_unit2 (.clk(clk), .row(pipe2_row), .col(pipe2_col), .color_data(color_data_pipe2));
	object_engine #(.T_W(52), .T_H(450), .START_X(410)) pipe2_unit (.clk(clk), .reset(reset), 
				 .video_on(video_on), .x(x), .y(y), .no_boundary(1),
				 .trans_x_on(1), .t_x(t_x2),.trans_y_on(1), .t_y(t_y2),
				 .rgb_out(pipe_rgb2), .object_out_on(pipes_on[2]), .o_x(pipe2_x), .o_y(pipe2_y),.object_enable(1),
				 .row(pipe2_row), .col(pipe2_col), .color_data(color_data_pipe2));
	object2_rom pipe_rom_unit3 (.clk(clk), .row(pipe3_row), .col(pipe3_col), .color_data(color_data_pipe3));
	object_engine #(.T_W(52), .T_H(450),.START_X(610)) pipe3_unit (.clk(clk), .reset(reset), 
				 .video_on(video_on), .x(x), .y(y), .no_boundary(1),
				 .trans_x_on(1), .t_x(t_x3),.trans_y_on(1), .t_y(t_y3),
				 .rgb_out(pipe_rgb3), .object_out_on(pipes_on[3]), .o_x(pipe3_x), .o_y(pipe3_y),.object_enable(1),
				 .row(pipe3_row), .col(pipe3_col), .color_data(color_data_pipe3));


	is_collide is_collideUpper(.f_x(bird_x), .f_y(bird_y), .s_x(0), .s_y(1), .f_w(32), .f_h(23), .s_h(2), .s_w(480), .collision(collisions[4]));
	is_collide is_collideLower(.f_x(bird_x), .f_y(bird_y), .s_x(0), .s_y(479), .f_w(32), .f_h(23), .s_h(2), .s_w(480), .collision(collisions[5]));
	

	is_collide is_collide1(.f_x(bird_x), .f_y(bird_y),.s_x(pipe1_x), .s_y(pipe1_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[1]));
	is_collide is_collide2(.f_x(bird_x), .f_y(bird_y),.s_x(pipe2_x), .s_y(pipe2_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[2]));
	is_collide is_collide3(.f_x(bird_x), .f_y(bird_y),.s_x(pipe3_x), .s_y(pipe3_y), .f_w(32),.f_h(23),.s_h(640),.s_w(52), .collision(collisions[3]));

	wire collision = collisions[1] || collisions[2] || collisions[3] || collisions[4] || collisions[5];
    assign led[0]=collision;

	wire [13:0]score;
	score_generator generator(.clk(clk),.score(score));
	score_display score_dispaly(.clk(clk),.mode(1),.num1(score),.num2(),.enable(1),.seg(seg),.an(an));

    key_detect key_detecter (.out(keys), .clk(clk), .PS2Clk(PS2Clk), .PS2Data(PS2Data));


	game_state_machine game_FSM (.clk(clk), .hard_reset(hard_reset), .start(start), .collision(collision),
				     			 .game_state(game_state), .game_en(game_en), .game_reset(game_reset));
	

	gameover_display gameover_display_unit (.clk(clk), .x(x), .y(y), .rgb_out(gameover_rgb),
	                                        .gameover_on(gameover_on));



    always @*
		begin
        	if (~video_on)
				rgb_next = 12'b0;


			else if(gameover_on && game_state == gameover)
				rgb_next = gameover_rgb;
			else if (object_on)
				rgb_next = object_rgb;
			else if (pipes_on[1])
				rgb_next = pipe_rgb1;
			else if (pipes_on[2])
				rgb_next = pipe_rgb2;
			else if (pipes_on[3])
				rgb_next = pipe_rgb3;
            else
                rgb_next = bg_rgb;			
		end
	

	always @(posedge clk)
		if (pixel_tick)
			rgb_reg <= rgb_next;		
			

	assign rgb = rgb_reg;

endmodule