data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v
1: b'%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:19: Cannot find include file: Pxs.vh\n`include "Pxs.vh" \n         ^~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/109394014/blocks/Overlay,data/full_repos/permissive/109394014/Pxs.vh\n             data/full_repos/permissive/109394014/blocks/Overlay,data/full_repos/permissive/109394014/Pxs.vh.v\n             data/full_repos/permissive/109394014/blocks/Overlay,data/full_repos/permissive/109394014/Pxs.vh.sv\n             Pxs.vh\n             Pxs.vh.v\n             Pxs.vh.sv\n             obj_dir/Pxs.vh\n             obj_dir/Pxs.vh.v\n             obj_dir/Pxs.vh.sv\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:59: Define or directive not defined: \'`XC\'\n assign endframe = (RGBStr_i[`XC]==VISIBLECOLS-1 && RGBStr_i[`YC]==VISIBLEROWS-1)? 1\'b1 : 1\'b0 ;\n                             ^~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:59: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\n assign endframe = (RGBStr_i[`XC]==VISIBLECOLS-1 && RGBStr_i[`YC]==VISIBLEROWS-1)? 1\'b1 : 1\'b0 ;\n                                ^\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:59: Define or directive not defined: \'`YC\'\n assign endframe = (RGBStr_i[`XC]==VISIBLECOLS-1 && RGBStr_i[`YC]==VISIBLEROWS-1)? 1\'b1 : 1\'b0 ;\n                                                             ^~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:65: Define or directive not defined: \'`VGA\'\n  RGBStr_o[`VGA] <= RGBStr_i[`VGA];\n           ^~~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:65: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\n  RGBStr_o[`VGA] <= RGBStr_i[`VGA];\n               ^\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:65: Define or directive not defined: \'`VGA\'\n  RGBStr_o[`VGA] <= RGBStr_i[`VGA];\n                             ^~~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:67: Define or directive not defined: \'`RGB\'\n  RGBStr_o[`RGB] <= (\n           ^~~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:67: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\n  RGBStr_o[`RGB] <= (\n               ^\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:68: Define or directive not defined: \'`YC\'\n               (RGBStr_i[`YC] > y_ball) && (RGBStr_i[`YC] < y_ball+SIZE_BALL) &&\n                         ^~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:68: Define or directive not defined: \'`YC\'\n               (RGBStr_i[`YC] > y_ball) && (RGBStr_i[`YC] < y_ball+SIZE_BALL) &&\n                                                     ^~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:69: Define or directive not defined: \'`XC\'\n               (RGBStr_i[`XC] > x_ball) && (RGBStr_i[`XC] < x_ball+SIZE_BALL)\n                         ^~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:69: Define or directive not defined: \'`XC\'\n               (RGBStr_i[`XC] > x_ball) && (RGBStr_i[`XC] < x_ball+SIZE_BALL)\n                                                     ^~~\n%Error: data/full_repos/permissive/109394014/blocks/Overlay/PxsBouncingBall.v:70: Define or directive not defined: \'`RGB\'\n             ) ? 3\'b101 : RGBStr_i[`RGB];\n                                   ^~~~\n%Error: Exiting due to 14 error(s)\n'
module PxsBouncingBall #(
        parameter SIZE_BALL = 16)
			(
                input wire        px_clk,
                input wire [25:0] RGBStr_i,
                output reg [25:0] RGBStr_o
               );
    

    parameter border = 0;
    parameter [9:0] x_ball_min = border;
    parameter [9:0] x_ball_max = 640 - SIZE_BALL - border;
    parameter [9:0] y_ball_min = border;
    parameter [9:0] y_ball_max = 480 - SIZE_BALL - border;


	parameter [9:0] VISIBLECOLS = 640;
	parameter [9:0] VISIBLEROWS = 480;


	reg [4:0] speed;
	reg dx,dy;
	wire endframe;
	reg [9:0] x_ball, y_ball;
	reg [9:0] BX, BY;
	reg [25:0] AuxStr1, AuxStr2;
	reg Ball;
	

	initial
    begin
		x_ball <= (640 - SIZE_BALL)/4;
		y_ball <= (480 - SIZE_BALL)/2;
		dx <=0;
		dy <=0;
		speed <= 1;
    end
	
	assign endframe = (RGBStr_i[`XC]==VISIBLECOLS-1 && RGBStr_i[`YC]==VISIBLEROWS-1)? 1'b1 : 1'b0 ;
	

	always @(posedge px_clk)
    begin

		RGBStr_o[`VGA] <= RGBStr_i[`VGA];

		RGBStr_o[`RGB] <= (
               (RGBStr_i[`YC] > y_ball) && (RGBStr_i[`YC] < y_ball+SIZE_BALL) &&
               (RGBStr_i[`XC] > x_ball) && (RGBStr_i[`XC] < x_ball+SIZE_BALL)
             ) ? 3'b101 : RGBStr_i[`RGB];
		
	end
		

	always @(posedge px_clk)
    begin
		if (endframe)
		begin

				if (x_ball>=x_ball_max  || x_ball>=(VISIBLECOLS-speed-border) || x_ball<border || x_ball<speed) 
				begin	
					dx = ~ dx;


				end

				if (y_ball>=y_ball_max  || y_ball>=(VISIBLEROWS-speed-border) || y_ball<border || y_ball<speed) 
				begin
					dy = ~ dy;


				end

				if (dx==0)
					x_ball = x_ball+speed;
				else 
					x_ball = x_ball-speed;

				if (dy==0)
					y_ball = y_ball+speed;
				else 
					y_ball = y_ball-speed;







		end		
    end
	
endmodule
module PxsBouncingBall #(
        parameter SIZE_BALL = 16)
			(
                input wire        px_clk,
                input wire [25:0] RGBStr_i,
                output reg [25:0] RGBStr_o
               );

    

    parameter border = 0;
    parameter [9:0] x_ball_min = border;
    parameter [9:0] x_ball_max = 640 - SIZE_BALL - border;
    parameter [9:0] y_ball_min = border;
    parameter [9:0] y_ball_max = 480 - SIZE_BALL - border;


	parameter [9:0] VISIBLECOLS = 640;
	parameter [9:0] VISIBLEROWS = 480;


	reg [4:0] speed;
	reg dx,dy;
	wire endframe;
	reg [9:0] x_ball, y_ball;
	reg [9:0] BX, BY;
	reg [25:0] AuxStr1, AuxStr2;
	reg Ball;
	

	initial
    begin
		x_ball <= (640 - SIZE_BALL)/4;
		y_ball <= (480 - SIZE_BALL)/2;
		dx <=0;
		dy <=0;
		speed <= 1;
    end
	
	assign endframe = (RGBStr_i[`XC]==VISIBLECOLS-1 && RGBStr_i[`YC]==VISIBLEROWS-1)? 1'b1 : 1'b0 ;
	

	always @(posedge px_clk)
    begin

		RGBStr_o[`VGA] <= RGBStr_i[`VGA];

		RGBStr_o[`RGB] <= (
               (RGBStr_i[`YC] > y_ball) && (RGBStr_i[`YC] < y_ball+SIZE_BALL) &&
               (RGBStr_i[`XC] > x_ball) && (RGBStr_i[`XC] < x_ball+SIZE_BALL)
             ) ? 3'b101 : RGBStr_i[`RGB];
		
	end
		

	always @(posedge px_clk)
    begin
		if (endframe)
		begin

				if (x_ball>=x_ball_max  || x_ball>=(VISIBLECOLS-speed-border) || x_ball<border || x_ball<speed) 
				begin	
					dx = ~ dx;


				end

				if (y_ball>=y_ball_max  || y_ball>=(VISIBLEROWS-speed-border) || y_ball<border || y_ball<speed) 
				begin
					dy = ~ dy;


				end

				if (dx==0)
					x_ball = x_ball+speed;
				else 
					x_ball = x_ball-speed;

				if (dy==0)
					y_ball = y_ball+speed;
				else 
					y_ball = y_ball-speed;







		end		
    end
	
endmodule