data/full_repos/permissive/123075301/rotary_encoder.v
1: b'%Error: data/full_repos/permissive/123075301/rotary_encoder.v:50: Cannot find file containing module: \'push_button_test1\'\npush_button_test1 PRESS_ROTATE(.button(rotary_press),\n^~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/123075301,data/full_repos/permissive/123075301/push_button_test1\n             data/full_repos/permissive/123075301,data/full_repos/permissive/123075301/push_button_test1.v\n             data/full_repos/permissive/123075301,data/full_repos/permissive/123075301/push_button_test1.sv\n             push_button_test1\n             push_button_test1.v\n             push_button_test1.sv\n             obj_dir/push_button_test1\n             obj_dir/push_button_test1.v\n             obj_dir/push_button_test1.sv\n%Error: data/full_repos/permissive/123075301/rotary_encoder.v:54: Cannot find file containing module: \'hex_to_BCD\'\nhex_to_BCD  HEX_CONV_BCD( .reset(reset),\n^~~~~~~~~~\n%Warning-WIDTH: data/full_repos/permissive/123075301/rotary_encoder.v:102: Operator SUB expects 10 bits on the RHS, but RHS\'s CONST \'5\'h12\' generates 5 bits.\n                                                                         : ... In instance rotary_encoder\n        counter = counter - 5\'b10010;\n                          ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/123075301/rotary_encoder.v:105: Operator ADD expects 10 bits on the RHS, but RHS\'s CONST \'5\'h12\' generates 5 bits.\n                                                                         : ... In instance rotary_encoder\n        counter = counter + 5\'b10010;\n                          ^\n%Warning-WIDTH: data/full_repos/permissive/123075301/rotary_encoder.v:145: Operator ASSIGN expects 12 bits on the Assign RHS, but Assign RHS\'s VARREF \'counted_value\' generates 9 bits.\n                                                                         : ... In instance rotary_encoder\n    counted_disp_reg = counted_value; \n                     ^\n%Warning-WIDTH: data/full_repos/permissive/123075301/rotary_encoder.v:152: Operator ADD expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'counter\' generates 10 bits.\n                                                                         : ... In instance rotary_encoder\n      counted_disp_reg = counter + 360;  \n                                 ^\n%Warning-WIDTH: data/full_repos/permissive/123075301/rotary_encoder.v:155: Operator ASSIGN expects 12 bits on the Assign RHS, but Assign RHS\'s VARREF \'counter\' generates 10 bits.\n                                                                         : ... In instance rotary_encoder\n     counted_disp_reg = counter; \n                      ^\n%Error: Exiting due to 2 error(s), 5 warning(s)\n'
module rotary_encoder	(	clk,
									reset,
									rotory_dev_on,
									rotary_a, 
									rotary_b, 
									rotary_press, 
									counted_value, 
									counted_disp,
									press
									);

input clk,reset,rotory_dev_on;
input rotary_a, rotary_b, rotary_press;
output press;
output  [23:0] counted_disp;
output reg signed [8:0] counted_value = 9'b0;


reg [9:0] counted_reg= 10'b0;
wire    [11:0] counted_disp_wire;
reg     [11:0] counted_disp_reg = 12'b0;

assign counted_disp_wire = counted_disp_reg;

reg delay_rotary ;
reg rotary_dir, rotary_event;
reg signed [9:0] counter	= 10'b11_1110_1110;
reg [9:0]temp;

push_button_test1 PRESS_ROTATE(.button(rotary_press),
										 .clk(clk),
										 .press(press)
										 );
hex_to_BCD		HEX_CONV_BCD(	.reset(reset),
										.ip(counted_disp_wire),
										.op(counted_disp)
										);






always @ (posedge clk)
begin
	case({rotary_b,rotary_a})
	2'b00:begin	rotary_event <= 1'b0;			
					rotary_dir <= rotary_dir; 
			end
	2'b01:begin	
					rotary_event <= rotary_event;		
					rotary_dir <= 1'b0;
			end
	2'b10:begin 
					rotary_event <= rotary_event;		
					rotary_dir <= 1'b1; 
			end
	2'b11:begin 
					rotary_event <= 1'b1;			
					rotary_dir <= rotary_dir; 
			end
	default:begin
					rotary_event <= rotary_event;
					rotary_dir <= rotary_dir;
				end
	endcase
end

always @(posedge clk)
begin
	if(reset == 1'b1)
		begin
			counter = 10'b0;
			temp = 10'b0;
		end
	else
		begin
			delay_rotary <= rotary_event;
			if ((rotary_event == 1'b1) && (delay_rotary == 1'b0))
					begin
						  if(rotary_dir == 1'b1)
								counter = counter - 5'b10010;
			
						  else if(rotary_dir == 1'b0)
								counter = counter + 5'b10010;

						  else;
						  
						  temp = counter;
						  if(counter[9] == 1'b1)
							begin 
								counter = ~counter + 1'b1;
						  end
						  
						  if(counter[9:0] >= 10'b0101101000)
								counter = 10'b0;
						  else 
								counter = temp;
					end
			 else;						
		end
end

always @ (posedge clk)
begin
	if(reset == 1'b1)
		begin
			counted_reg = 10'b0;
			counted_value = 9'b0;
			counted_disp_reg = 12'b0;
		end
	
	else
		begin
			if(press == 1'b1)
				begin
				if(counter[9] == 1'b1)
					begin
						counted_reg = counter + 360;
						counted_value = counted_reg[8:0];
					end
				else
					counted_value = counter[8:0];
					
				counted_disp_reg = counted_value;	
			end
			
			else
				begin
				if(counter[9] == 1'b1)
					begin
						counted_disp_reg = counter + 360;
					end
				else
					counted_disp_reg = counter;	
			end
		end
end 
endmodule
module rotary_encoder	(	clk,
									reset,
									rotory_dev_on,
									rotary_a, 
									rotary_b, 
									rotary_press, 
									counted_value, 
									counted_disp,
									press
									);


input clk,reset,rotory_dev_on;
input rotary_a, rotary_b, rotary_press;
output press;
output  [23:0] counted_disp;
output reg signed [8:0] counted_value = 9'b0;


reg [9:0] counted_reg= 10'b0;
wire    [11:0] counted_disp_wire;
reg     [11:0] counted_disp_reg = 12'b0;

assign counted_disp_wire = counted_disp_reg;

reg delay_rotary ;
reg rotary_dir, rotary_event;
reg signed [9:0] counter	= 10'b11_1110_1110;
reg [9:0]temp;

push_button_test1 PRESS_ROTATE(.button(rotary_press),
										 .clk(clk),
										 .press(press)
										 );
hex_to_BCD		HEX_CONV_BCD(	.reset(reset),
										.ip(counted_disp_wire),
										.op(counted_disp)
										);






always @ (posedge clk)
begin
	case({rotary_b,rotary_a})
	2'b00:begin	rotary_event <= 1'b0;			
					rotary_dir <= rotary_dir; 
			end
	2'b01:begin	
					rotary_event <= rotary_event;		
					rotary_dir <= 1'b0;
			end
	2'b10:begin 
					rotary_event <= rotary_event;		
					rotary_dir <= 1'b1; 
			end
	2'b11:begin 
					rotary_event <= 1'b1;			
					rotary_dir <= rotary_dir; 
			end
	default:begin
					rotary_event <= rotary_event;
					rotary_dir <= rotary_dir;
				end
	endcase
end

always @(posedge clk)
begin
	if(reset == 1'b1)
		begin
			counter = 10'b0;
			temp = 10'b0;
		end
	else
		begin
			delay_rotary <= rotary_event;
			if ((rotary_event == 1'b1) && (delay_rotary == 1'b0))
					begin
						  if(rotary_dir == 1'b1)
								counter = counter - 5'b10010;
			
						  else if(rotary_dir == 1'b0)
								counter = counter + 5'b10010;

						  else;
						  
						  temp = counter;
						  if(counter[9] == 1'b1)
							begin 
								counter = ~counter + 1'b1;
						  end
						  
						  if(counter[9:0] >= 10'b0101101000)
								counter = 10'b0;
						  else 
								counter = temp;
					end
			 else;						
		end
end

always @ (posedge clk)
begin
	if(reset == 1'b1)
		begin
			counted_reg = 10'b0;
			counted_value = 9'b0;
			counted_disp_reg = 12'b0;
		end
	
	else
		begin
			if(press == 1'b1)
				begin
				if(counter[9] == 1'b1)
					begin
						counted_reg = counter + 360;
						counted_value = counted_reg[8:0];
					end
				else
					counted_value = counter[8:0];
					
				counted_disp_reg = counted_value;	
			end
			
			else
				begin
				if(counter[9] == 1'b1)
					begin
						counted_disp_reg = counter + 360;
					end
				else
					counted_disp_reg = counter;	
			end
		end
end 
endmodule