data/full_repos/permissive/124982712/src/MapDisplayController.v
 line:9: before: "["
1: b'%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:169: Operator ASSIGN expects 7 bits on the Assign RHS, but Assign RHS\'s VARREF \'row0\' generates 5 bits.\n                                                                                   : ... In instance MapDisplayController\n   4\'d0: selected_row = row0;\n                      ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:170: Operator ASSIGN expects 7 bits on the Assign RHS, but Assign RHS\'s VARREF \'row1\' generates 5 bits.\n                                                                                   : ... In instance MapDisplayController\n   4\'d1: selected_row = row1;\n                      ^\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:171: Operator ASSIGN expects 7 bits on the Assign RHS, but Assign RHS\'s VARREF \'row2\' generates 5 bits.\n                                                                                   : ... In instance MapDisplayController\n   4\'d2: selected_row = row2;\n                      ^\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:172: Operator ASSIGN expects 7 bits on the Assign RHS, but Assign RHS\'s VARREF \'row3\' generates 5 bits.\n                                                                                   : ... In instance MapDisplayController\n   4\'d3: selected_row = row3;\n                      ^\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:173: Operator ASSIGN expects 7 bits on the Assign RHS, but Assign RHS\'s VARREF \'row4\' generates 5 bits.\n                                                                                   : ... In instance MapDisplayController\n   4\'d4: selected_row = row4;\n                      ^\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:175: Operator ASSIGN expects 7 bits on the Assign RHS, but Assign RHS\'s VARREF \'row0\' generates 5 bits.\n                                                                                   : ... In instance MapDisplayController\n   default: selected_row = row0;\n                         ^\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:168: Operator CASE expects 4 bits on the Case expression, but Case expression\'s VARREF \'cur_sprite_y\' generates 3 bits.\n                                                                                   : ... In instance MapDisplayController\n  case (cur_sprite_y)\n  ^~~~\n%Warning-WIDTH: data/full_repos/permissive/124982712/src/MapDisplayController.v:182: Operator CASE expects 4 bits on the Case expression, but Case expression\'s VARREF \'cur_sprite_x\' generates 3 bits.\n                                                                                   : ... In instance MapDisplayController\n  case (cur_sprite_x)\n  ^~~~\n%Error: Exiting due to 8 warning(s)\n'
module MapDisplayController(
	input en, 
	output reg unsigned [4:0] map_x, 
	output reg unsigned [4:0] map_y, 
	input [2:0] sprite_type, 
	output reg vga_plot, 
	output unsigned [7:0] vga_x,
	output unsigned [7:0] vga_y,
	output reg [2:0] vga_color,
	input reset, 
	input clock_50,
	output [7:0] debug_leds);
	
	reg unsigned [2:0] cur_sprite_x;
	reg unsigned [2:0] cur_sprite_y;
	


	initial 
	begin
		map_x = 5'd0;
		map_y = 5'd0;
		cur_sprite_x = 3'd0;
		cur_sprite_y = 3'd0;
		vga_plot = 1'b0;
		vga_color = 3'd0;
	end 

	always @(posedge clock_50) 
	begin
		if (reset == 1'b1) 
		begin
			map_x <= 5'd0;
			map_y <= 5'd0;
			cur_sprite_x <= 3'd0;
			cur_sprite_y <= 3'd0;	
			vga_plot <= 1'b1;
		end
		
		else
		begin

			if (cur_sprite_y != 3'd4 || cur_sprite_x != 3'd4)
			begin			
				if(cur_sprite_x < 3'd4)
					cur_sprite_x <= cur_sprite_x + 3'd1;
					
				else
				begin
					cur_sprite_x <= 3'd0;
					cur_sprite_y <= cur_sprite_y + 3'd1;
				end
			end
			

			else 
			begin
				cur_sprite_x <= 3'd0;
				cur_sprite_y <= 3'd0;
				

				if (map_x == 5'd20)
				begin
					map_x <= 5'd0;											
					
					if (map_y == 5'd20)
					begin
						map_y <= 5'd0;
					end
					else
					begin
						map_y <= map_y + 5'd1;
					end
				end
				else 
				begin
					map_x <= map_x + 5'd1;					
				end	
			end		
		end
	end	


	assign vga_x = ({3'b000, map_x} * 8'd5) + {5'd0, cur_sprite_x} + 8'd26;
	assign vga_y = ({3'b000, map_y} * 8'd5) + {5'd0, cur_sprite_y} + 8'd1;


	reg [4:0] row0;
	reg [4:0] row1;
	reg [4:0] row2;
	reg [4:0] row3;
	reg [4:0] row4;

	reg [2:0] sprite_color;

	always @(*)
	begin
		if (sprite_type == 3'b000)
		begin
			row0 = 5'b00000;
			row1 = 5'b00000;
			row2 = 5'b00000;
			row3 = 5'b00000;
			row4 = 5'b00000;

			sprite_color = 3'b000;
		end
		else if (sprite_type == 3'b001)
		begin
			row0 = 5'b00000;
			row1 = 5'b00100;
			row2 = 5'b01110;
			row3 = 5'b00100;
			row4 = 5'b00000;

			sprite_color = 3'b111;
		end
		else if (sprite_type == 3'b010)
		begin
			row0 = 5'b00000;
			row1 = 5'b00000;
			row2 = 5'b00100;
			row3 = 5'b00000;
			row4 = 5'b00000;
			sprite_color = 3'b111;
		end
		else if (sprite_type == 3'b011)
		begin
			row0 = 5'b11111;
			row1 = 5'b11111;
			row2 = 5'b11111;
			row3 = 5'b11111;
			row4 = 5'b11111;

			sprite_color = 3'b001;
		end
		else if (sprite_type == 3'b100)
		begin
			row0 = 5'b11111;
			row1 = 5'b11111;
			row2 = 5'b11111;
			row3 = 5'b11111;
			row4 = 5'b11111;

			sprite_color = 3'b010;
		end
		else
		begin
			row0 = 5'b11111;
			row1 = 5'b11111;
			row2 = 5'b11111;
			row3 = 5'b11111;
			row4 = 5'b11111;

			sprite_color = 3'b010;
		end
	end
	
	reg [6:0] selected_row;
	always @(*)
	begin
		case (cur_sprite_y)
			4'd0: selected_row = row0;
			4'd1: selected_row = row1;
			4'd2: selected_row = row2;
			4'd3: selected_row = row3;
			4'd4: selected_row = row4;

			default: selected_row = row0;
		endcase
	end
	
	reg selected_col;
	always @(*)
	begin
		case (cur_sprite_x)
			4'd0: selected_col = selected_row[0];
			4'd1: selected_col = selected_row[1];
			4'd2: selected_col = selected_row[2];
			4'd3: selected_col = selected_row[3];
			4'd4: selected_col = selected_row[4];

			default: selected_col = selected_row[0];
		endcase
	end
	
	always @(*)
	begin
		case (selected_col)
			1'b1: vga_color = sprite_color;
			1'b0: vga_color = 3'b000;
		endcase
	end
endmodule
module MapDisplayController(
	input en, 
	output reg unsigned [4:0] map_x, 
	output reg unsigned [4:0] map_y, 
	input [2:0] sprite_type, 
	output reg vga_plot, 
	output unsigned [7:0] vga_x,
	output unsigned [7:0] vga_y,
	output reg [2:0] vga_color,
	input reset, 
	input clock_50,
	output [7:0] debug_leds);

	
	reg unsigned [2:0] cur_sprite_x;
	reg unsigned [2:0] cur_sprite_y;
	


	initial 
	begin
		map_x = 5'd0;
		map_y = 5'd0;
		cur_sprite_x = 3'd0;
		cur_sprite_y = 3'd0;
		vga_plot = 1'b0;
		vga_color = 3'd0;
	end 

	always @(posedge clock_50) 
	begin
		if (reset == 1'b1) 
		begin
			map_x <= 5'd0;
			map_y <= 5'd0;
			cur_sprite_x <= 3'd0;
			cur_sprite_y <= 3'd0;	
			vga_plot <= 1'b1;
		end
		
		else
		begin

			if (cur_sprite_y != 3'd4 || cur_sprite_x != 3'd4)
			begin			
				if(cur_sprite_x < 3'd4)
					cur_sprite_x <= cur_sprite_x + 3'd1;
					
				else
				begin
					cur_sprite_x <= 3'd0;
					cur_sprite_y <= cur_sprite_y + 3'd1;
				end
			end
			

			else 
			begin
				cur_sprite_x <= 3'd0;
				cur_sprite_y <= 3'd0;
				

				if (map_x == 5'd20)
				begin
					map_x <= 5'd0;											
					
					if (map_y == 5'd20)
					begin
						map_y <= 5'd0;
					end
					else
					begin
						map_y <= map_y + 5'd1;
					end
				end
				else 
				begin
					map_x <= map_x + 5'd1;					
				end	
			end		
		end
	end	


	assign vga_x = ({3'b000, map_x} * 8'd5) + {5'd0, cur_sprite_x} + 8'd26;
	assign vga_y = ({3'b000, map_y} * 8'd5) + {5'd0, cur_sprite_y} + 8'd1;


	reg [4:0] row0;
	reg [4:0] row1;
	reg [4:0] row2;
	reg [4:0] row3;
	reg [4:0] row4;

	reg [2:0] sprite_color;

	always @(*)
	begin
		if (sprite_type == 3'b000)
		begin
			row0 = 5'b00000;
			row1 = 5'b00000;
			row2 = 5'b00000;
			row3 = 5'b00000;
			row4 = 5'b00000;

			sprite_color = 3'b000;
		end
		else if (sprite_type == 3'b001)
		begin
			row0 = 5'b00000;
			row1 = 5'b00100;
			row2 = 5'b01110;
			row3 = 5'b00100;
			row4 = 5'b00000;

			sprite_color = 3'b111;
		end
		else if (sprite_type == 3'b010)
		begin
			row0 = 5'b00000;
			row1 = 5'b00000;
			row2 = 5'b00100;
			row3 = 5'b00000;
			row4 = 5'b00000;
			sprite_color = 3'b111;
		end
		else if (sprite_type == 3'b011)
		begin
			row0 = 5'b11111;
			row1 = 5'b11111;
			row2 = 5'b11111;
			row3 = 5'b11111;
			row4 = 5'b11111;

			sprite_color = 3'b001;
		end
		else if (sprite_type == 3'b100)
		begin
			row0 = 5'b11111;
			row1 = 5'b11111;
			row2 = 5'b11111;
			row3 = 5'b11111;
			row4 = 5'b11111;

			sprite_color = 3'b010;
		end
		else
		begin
			row0 = 5'b11111;
			row1 = 5'b11111;
			row2 = 5'b11111;
			row3 = 5'b11111;
			row4 = 5'b11111;

			sprite_color = 3'b010;
		end
	end
	
	reg [6:0] selected_row;
	always @(*)
	begin
		case (cur_sprite_y)
			4'd0: selected_row = row0;
			4'd1: selected_row = row1;
			4'd2: selected_row = row2;
			4'd3: selected_row = row3;
			4'd4: selected_row = row4;

			default: selected_row = row0;
		endcase
	end
	
	reg selected_col;
	always @(*)
	begin
		case (cur_sprite_x)
			4'd0: selected_col = selected_row[0];
			4'd1: selected_col = selected_row[1];
			4'd2: selected_col = selected_row[2];
			4'd3: selected_col = selected_row[3];
			4'd4: selected_col = selected_row[4];

			default: selected_col = selected_row[0];
		endcase
	end
	
	always @(*)
	begin
		case (selected_col)
			1'b1: vga_color = sprite_color;
			1'b0: vga_color = 3'b000;
		endcase
	end
endmodule