data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v
1: b'%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:54: Operator SHIFTL expects 12 bits on the LHS, but LHS\'s CONST \'11\'h4\' generates 11 bits.\n                                                                                   : ... In instance display_matrix\n   ObjectW = 11\'d4 << ObjectScale;\n                   ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:55: Operator SHIFTL expects 11 bits on the LHS, but LHS\'s CONST \'10\'h9\' generates 10 bits.\n                                                                                   : ... In instance display_matrix\n   ObjectH = 10\'d9 << ObjectScale;\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:63: Operator ASSIGN expects 10 bits on the Assign RHS, but Assign RHS\'s SUB generates 11 bits.\n                                                                                   : ... In instance display_matrix\n     TransformedPollX = PollX - ObjectX;\n                      ^\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:64: Operator ASSIGN expects 9 bits on the Assign RHS, but Assign RHS\'s SUB generates 10 bits.\n                                                                                   : ... In instance display_matrix\n     TransformedPollY = PollY - ObjectY;\n                      ^\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:65: Operator ASSIGN expects 2 bits on the Assign RHS, but Assign RHS\'s SHIFTR generates 10 bits.\n                                                                                   : ... In instance display_matrix\n     ScaledPollX = TransformedPollX >> ObjectScale;\n                 ^\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:66: Operator ASSIGN expects 4 bits on the Assign RHS, but Assign RHS\'s SHIFTR generates 9 bits.\n                                                                                   : ... In instance display_matrix\n     ScaledPollY = TransformedPollY >> ObjectScale;\n                 ^\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:58: Operator LTE expects 11 bits on the RHS, but RHS\'s VARREF \'PollX\' generates 10 bits.\n                                                                                   : ... In instance display_matrix\n   if((ObjectX <= PollX & PollX < ObjectX+ObjectW)&(ObjectY <= PollY & PollY < ObjectY+ObjectH))\n               ^~\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:58: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'PollX\' generates 10 bits.\n                                                                                   : ... In instance display_matrix\n   if((ObjectX <= PollX & PollX < ObjectX+ObjectW)&(ObjectY <= PollY & PollY < ObjectY+ObjectH))\n                                ^\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:58: Operator LTE expects 10 bits on the RHS, but RHS\'s VARREF \'PollY\' generates 9 bits.\n                                                                                   : ... In instance display_matrix\n   if((ObjectX <= PollX & PollX < ObjectX+ObjectW)&(ObjectY <= PollY & PollY < ObjectY+ObjectH))\n                                                            ^~\n%Warning-WIDTH: data/full_repos/permissive/180199545/DigitalSSD/display_matrix.v:58: Operator LT expects 11 bits on the LHS, but LHS\'s VARREF \'PollY\' generates 9 bits.\n                                                                                   : ... In instance display_matrix\n   if((ObjectX <= PollX & PollX < ObjectX+ObjectW)&(ObjectY <= PollY & PollY < ObjectY+ObjectH))\n                                                                             ^\n%Error: Exiting due to 10 warning(s)\n'
module display_matrix (
	input clk,
	input reset,

	input [10:0] ObjectX,
	input [9:0] ObjectY,
	input [3:0] ObjectScale,
	
	input [8:0] Matrix0,
	input [8:0] Matrix1,
	input [8:0] Matrix2,
	input [8:0] Matrix3,
	
	input [9:0] PollX,
	input [8:0] PollY,
	
	output Hit,
	output Hit2
	);
	
	reg [11:0] ObjectW;
	reg [10:0] ObjectH;
	reg [9:0] TransformedPollX;
	reg [8:0] TransformedPollY;
	reg [1:0] ScaledPollX;
	reg [3:0] ScaledPollY;
	reg hit_out;
	reg hit2_out;
	

	always @ (posedge clk)
	begin
		if(reset)
		begin
			hit_out <= 1'b0;
		end
		else
		begin

			ObjectW = 11'd4 << ObjectScale;
			ObjectH = 10'd9 << ObjectScale;
			

			if((ObjectX <= PollX & PollX < ObjectX+ObjectW)&(ObjectY <= PollY & PollY < ObjectY+ObjectH))
				begin
					hit_out <= 1'b0;
					hit2_out <= 1'b1;

					TransformedPollX = PollX - ObjectX;
					TransformedPollY = PollY - ObjectY;
					ScaledPollX = TransformedPollX >> ObjectScale;
					ScaledPollY = TransformedPollY >> ObjectScale;
					
					case(ScaledPollX)
						2'b00:	hit_out <= Matrix0[ScaledPollY];
						2'b01:	hit_out <= Matrix1[ScaledPollY];
						2'b10:	hit_out <= Matrix2[ScaledPollY];
						2'b11:	hit_out <= Matrix3[ScaledPollY];
					endcase
				end
			else
				begin
				hit_out <= 1'b0;
				hit2_out <= 1'b0;

				end
		end
	end
	
	assign Hit = hit_out;
	assign Hit2 = hit2_out;

endmodule
module display_matrix (
	input clk,
	input reset,

	input [10:0] ObjectX,
	input [9:0] ObjectY,
	input [3:0] ObjectScale,
	
	input [8:0] Matrix0,
	input [8:0] Matrix1,
	input [8:0] Matrix2,
	input [8:0] Matrix3,
	
	input [9:0] PollX,
	input [8:0] PollY,
	
	output Hit,
	output Hit2
	);

	
	reg [11:0] ObjectW;
	reg [10:0] ObjectH;
	reg [9:0] TransformedPollX;
	reg [8:0] TransformedPollY;
	reg [1:0] ScaledPollX;
	reg [3:0] ScaledPollY;
	reg hit_out;
	reg hit2_out;
	

	always @ (posedge clk)
	begin
		if(reset)
		begin
			hit_out <= 1'b0;
		end
		else
		begin

			ObjectW = 11'd4 << ObjectScale;
			ObjectH = 10'd9 << ObjectScale;
			

			if((ObjectX <= PollX & PollX < ObjectX+ObjectW)&(ObjectY <= PollY & PollY < ObjectY+ObjectH))
				begin
					hit_out <= 1'b0;
					hit2_out <= 1'b1;

					TransformedPollX = PollX - ObjectX;
					TransformedPollY = PollY - ObjectY;
					ScaledPollX = TransformedPollX >> ObjectScale;
					ScaledPollY = TransformedPollY >> ObjectScale;
					
					case(ScaledPollX)
						2'b00:	hit_out <= Matrix0[ScaledPollY];
						2'b01:	hit_out <= Matrix1[ScaledPollY];
						2'b10:	hit_out <= Matrix2[ScaledPollY];
						2'b11:	hit_out <= Matrix3[ScaledPollY];
					endcase
				end
			else
				begin
				hit_out <= 1'b0;
				hit2_out <= 1'b0;

				end
		end
	end
	
	assign Hit = hit_out;
	assign Hit2 = hit2_out;

endmodule