data/full_repos/permissive/123075301/top_module_all.v
 line:103: before: "="
1: b'%Warning-WIDTH: data/full_repos/permissive/123075301/top_module_all.v:133: Operator ASSIGN expects 32 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                         : ... In instance top_module_all\n            counter = 1\'b0;\n                    ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Error: data/full_repos/permissive/123075301/top_module_all.v:265: Cannot find file containing module: \'top_keyboard\'\ntop_keyboard KEYBOARD(.clk(clk),\n^~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/123075301,data/full_repos/permissive/123075301/top_keyboard\n             data/full_repos/permissive/123075301,data/full_repos/permissive/123075301/top_keyboard.v\n             data/full_repos/permissive/123075301,data/full_repos/permissive/123075301/top_keyboard.sv\n             top_keyboard\n             top_keyboard.v\n             top_keyboard.sv\n             obj_dir/top_keyboard\n             obj_dir/top_keyboard.v\n             obj_dir/top_keyboard.sv\n%Error: data/full_repos/permissive/123075301/top_module_all.v:278: Cannot find file containing module: \'rotary_encoder\'\nrotary_encoder ROTOR(.clk(clk),\n^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/123075301/top_module_all.v:289: Cannot find file containing module: \'top_vga\'\ntop_vga VGA(    .clk(clk),\n^~~~~~~\n%Error: data/full_repos/permissive/123075301/top_module_all.v:301: Cannot find file containing module: \'Cordic_Handler\'\nCordic_Handler CORDIC(.clk(clk),\n^~~~~~~~~~~~~~\n%Error: Exiting due to 4 error(s), 1 warning(s)\n'
module top_module_all(clk,
							reset,
							ps2d,
							ps2c,
							v_sync,
							h_sync,
							RGB,
							rotary_a,
							rotary_b, 
							rotary_press,
							top_cordic
							);

input clk, reset;
input ps2d,ps2c;
input rotary_a, rotary_b, rotary_press;
output v_sync, h_sync;
output [2:0] RGB;
output [7:0]top_cordic;

reg [8:0] input_angle;
reg ip_frm_kbd = 1'b0;
reg ip_frm_rot = 1'b0;

wire [8:0] input_angle_wire;
assign input_angle_wire = input_angle;

reg [1:0] sel;
reg enable_kbd;
reg out_enter;

wire [1:0] sel_wire;
wire enable_kbd_wire;
wire out_enter_wire;
wire [7:0] IP_Command,Nex_Command;
wire [8:0] IP_Angle;
wire [23:0] kbd_data_disp;

assign sel_wire = sel;
assign enable_kbd_wire = enable_kbd;

reg enable_rot;
reg out_pressed;

wire enable_rot_wire;
wire out_pressed_wire;
wire [8:0] op_rotor;
wire [23:0] counted_disp;

assign enable_rot_wire = enable_rot;

reg [5:0] print_line = 6'b0;
reg welcome_print;
reg [23:0] data_for_disp;

wire [5:0] print_line_wire;
wire welcome_print_wire;
wire [47:0] q_val_wire, i_val_wire;
wire [23:0] data_for_disp_wire;

assign print_line_wire = print_line;
assign welcome_print_wire = welcome_print;
assign data_for_disp_wire = data_for_disp;



always@(posedge clk)
begin	
	out_enter = out_enter_wire;
	out_pressed = out_pressed_wire;
end

parameter [3:0]	print_welcome		= 4'b0000,
						delay_loop			= 4'b0001,
						ask_ip_dev			= 4'b0010,
						wait_for_ip			= 4'b0011,
						dev_kbd				= 4'b0100,
						dev_rot				= 4'b0101,
						ip_receive			= 4'b0110,
						delay_result		= 4'b0111,
						op_print				= 4'b1000,
						display_exit		= 4'b1001;
reg [3:0] current_state, next_state = print_welcome;
integer counter = 0;

always@(posedge clk)
begin
	if(reset == 1'b1)
		current_state = print_welcome;
	else
		current_state = next_state;
end

always @(posedge clk)
begin	
	if(reset == 1'b1)
		begin	
			print_line = 6'b0;
			ip_frm_kbd = 1'b0;
			ip_frm_rot = 1'b0;
			input_angle = 9'b0;
		end
	else
		begin
			case(current_state)
				print_welcome: begin
										welcome_print = 1'b1;
										next_state    = delay_loop;
									end
				delay_loop	:	begin
										if(counter == 100000000)
											begin
												counter = 1'b0;
												welcome_print = 1'b0;
												next_state = ask_ip_dev;
											end
										else
											begin
												counter = counter +1;
												next_state = delay_loop;
											end
									end
			ask_ip_dev:			begin
										enable_kbd = 1'b1;
										sel = 2'b01;
										print_line[0] = 1'b1;
										next_state = wait_for_ip;
									end
			wait_for_ip:		begin
										data_for_disp = {16'b0,IP_Command};
										if(IP_Command == 8'h4B)
											begin	
												sel = 2'b10;
												next_state = dev_kbd;
											end
										else if(IP_Command == 8'h52)
											begin
												enable_kbd= 1'b0;
												enable_rot = 1'b1;
												next_state = dev_rot;
											end





										else
											begin
												next_state = wait_for_ip;
											end
									end
			dev_kbd	:			begin
										print_line[2] = 1'b1;
										data_for_disp = kbd_data_disp;
										
										if(out_enter == 1'b1)
											begin
												ip_frm_kbd = 1'b1;
												enable_kbd = 1'b0;
												next_state = ip_receive;
											end
										else
												next_state = dev_kbd;
									end
			dev_rot:				begin
										print_line[3]	= 1'b1;
										data_for_disp = counted_disp;
										if(out_pressed == 1'b1)
											begin
												ip_frm_rot = 1'b1;
												enable_rot = 1'b0;
												next_state = ip_receive;
											end
										else
												next_state = dev_rot;
									end
			ip_receive:			begin
										if(counter == 50)
											begin
												counter = 0;
												if(ip_frm_kbd == 1'b1 && ip_frm_rot == 1'b0)
													begin
														ip_frm_kbd = 1'b0;
														input_angle = IP_Angle;
													end
												else if(ip_frm_kbd == 1'b0 && ip_frm_rot == 1'b1)
													begin
														ip_frm_rot = 1'b0;
														input_angle = op_rotor;
													end
												else;
												
												next_state = delay_result;
											end
										else
											begin
												counter = counter +1;
												next_state = ip_receive;
											end
									end
			delay_result:		begin
										if(counter == 50)
											begin
												counter = 0;
												next_state = op_print;
											end
										else
											begin
												counter = counter + 1;
												next_state = delay_result;
											end
									end
			op_print:			begin
										print_line[4] = 1'b1;
										next_state    = display_exit;
										sel = 2'b00;
										enable_kbd = 1'b1;
									end
			display_exit:		begin
										print_line[5] = 1'b1;
										if(Nex_Command == 8'h43)
											begin
												print_line[5:0] = 6'b0;

												next_state = ask_ip_dev;
											end
										else if(Nex_Command == 8'h45)
											begin
												print_line[5:0] = 6'b0;

												next_state = display_exit;
											end
										else
												next_state = display_exit;
									end
			default:				next_state = print_welcome;
		endcase
	end
end
												




top_keyboard KEYBOARD(.clk(clk),
							.reset(reset),
							.sel(sel_wire),
							.ps2d(ps2d),
							.ps2c(ps2c),
							.rx_en(enable_kbd_wire),
							.IP_Command(IP_Command),
							.IP_Angle(IP_Angle),
							.Nex_Command(Nex_Command),
							.dout_enter(out_enter_wire),
							.data_temp_disp(kbd_data_disp)
						);

rotary_encoder	ROTOR(.clk(clk),
							.reset(reset),
							.rotory_dev_on(enable_rot_wire),
							.rotary_a(rotary_a), 
							.rotary_b(rotary_b), 
							.rotary_press(rotary_press), 
							.counted_value(op_rotor), 
							.counted_disp(counted_disp),
							.press(out_pressed_wire)
							);

top_vga	VGA( 			.clk(clk),
							.reset(reset),
							.v_sync(v_sync), 
							.h_sync(h_sync), 
							.RGB(RGB),
							.welcome_trig(welcome_print_wire),
							.print_line(print_line_wire),
							.data_temp_disp(data_for_disp_wire),
							.q_val_op(q_val_wire),
							.i_val_op(i_val_wire)
							);

Cordic_Handler CORDIC(.clk(clk),
							.angle_ip(input_angle_wire),
							.Xout(i_val_wire),
							.Yout(q_val_wire)
							);
assign top_cordic = i_val_wire[47:40];

endmodule
module top_module_all(clk,
							reset,
							ps2d,
							ps2c,
							v_sync,
							h_sync,
							RGB,
							rotary_a,
							rotary_b, 
							rotary_press,
							top_cordic
							);


input clk, reset;
input ps2d,ps2c;
input rotary_a, rotary_b, rotary_press;
output v_sync, h_sync;
output [2:0] RGB;
output [7:0]top_cordic;

reg [8:0] input_angle;
reg ip_frm_kbd = 1'b0;
reg ip_frm_rot = 1'b0;

wire [8:0] input_angle_wire;
assign input_angle_wire = input_angle;

reg [1:0] sel;
reg enable_kbd;
reg out_enter;

wire [1:0] sel_wire;
wire enable_kbd_wire;
wire out_enter_wire;
wire [7:0] IP_Command,Nex_Command;
wire [8:0] IP_Angle;
wire [23:0] kbd_data_disp;

assign sel_wire = sel;
assign enable_kbd_wire = enable_kbd;

reg enable_rot;
reg out_pressed;

wire enable_rot_wire;
wire out_pressed_wire;
wire [8:0] op_rotor;
wire [23:0] counted_disp;

assign enable_rot_wire = enable_rot;

reg [5:0] print_line = 6'b0;
reg welcome_print;
reg [23:0] data_for_disp;

wire [5:0] print_line_wire;
wire welcome_print_wire;
wire [47:0] q_val_wire, i_val_wire;
wire [23:0] data_for_disp_wire;

assign print_line_wire = print_line;
assign welcome_print_wire = welcome_print;
assign data_for_disp_wire = data_for_disp;



always@(posedge clk)
begin	
	out_enter = out_enter_wire;
	out_pressed = out_pressed_wire;
end

parameter [3:0]	print_welcome		= 4'b0000,
						delay_loop			= 4'b0001,
						ask_ip_dev			= 4'b0010,
						wait_for_ip			= 4'b0011,
						dev_kbd				= 4'b0100,
						dev_rot				= 4'b0101,
						ip_receive			= 4'b0110,
						delay_result		= 4'b0111,
						op_print				= 4'b1000,
						display_exit		= 4'b1001;
reg [3:0] current_state, next_state = print_welcome;
integer counter = 0;

always@(posedge clk)
begin
	if(reset == 1'b1)
		current_state = print_welcome;
	else
		current_state = next_state;
end

always @(posedge clk)
begin	
	if(reset == 1'b1)
		begin	
			print_line = 6'b0;
			ip_frm_kbd = 1'b0;
			ip_frm_rot = 1'b0;
			input_angle = 9'b0;
		end
	else
		begin
			case(current_state)
				print_welcome: begin
										welcome_print = 1'b1;
										next_state    = delay_loop;
									end
				delay_loop	:	begin
										if(counter == 100000000)
											begin
												counter = 1'b0;
												welcome_print = 1'b0;
												next_state = ask_ip_dev;
											end
										else
											begin
												counter = counter +1;
												next_state = delay_loop;
											end
									end
			ask_ip_dev:			begin
										enable_kbd = 1'b1;
										sel = 2'b01;
										print_line[0] = 1'b1;
										next_state = wait_for_ip;
									end
			wait_for_ip:		begin
										data_for_disp = {16'b0,IP_Command};
										if(IP_Command == 8'h4B)
											begin	
												sel = 2'b10;
												next_state = dev_kbd;
											end
										else if(IP_Command == 8'h52)
											begin
												enable_kbd= 1'b0;
												enable_rot = 1'b1;
												next_state = dev_rot;
											end





										else
											begin
												next_state = wait_for_ip;
											end
									end
			dev_kbd	:			begin
										print_line[2] = 1'b1;
										data_for_disp = kbd_data_disp;
										
										if(out_enter == 1'b1)
											begin
												ip_frm_kbd = 1'b1;
												enable_kbd = 1'b0;
												next_state = ip_receive;
											end
										else
												next_state = dev_kbd;
									end
			dev_rot:				begin
										print_line[3]	= 1'b1;
										data_for_disp = counted_disp;
										if(out_pressed == 1'b1)
											begin
												ip_frm_rot = 1'b1;
												enable_rot = 1'b0;
												next_state = ip_receive;
											end
										else
												next_state = dev_rot;
									end
			ip_receive:			begin
										if(counter == 50)
											begin
												counter = 0;
												if(ip_frm_kbd == 1'b1 && ip_frm_rot == 1'b0)
													begin
														ip_frm_kbd = 1'b0;
														input_angle = IP_Angle;
													end
												else if(ip_frm_kbd == 1'b0 && ip_frm_rot == 1'b1)
													begin
														ip_frm_rot = 1'b0;
														input_angle = op_rotor;
													end
												else;
												
												next_state = delay_result;
											end
										else
											begin
												counter = counter +1;
												next_state = ip_receive;
											end
									end
			delay_result:		begin
										if(counter == 50)
											begin
												counter = 0;
												next_state = op_print;
											end
										else
											begin
												counter = counter + 1;
												next_state = delay_result;
											end
									end
			op_print:			begin
										print_line[4] = 1'b1;
										next_state    = display_exit;
										sel = 2'b00;
										enable_kbd = 1'b1;
									end
			display_exit:		begin
										print_line[5] = 1'b1;
										if(Nex_Command == 8'h43)
											begin
												print_line[5:0] = 6'b0;

												next_state = ask_ip_dev;
											end
										else if(Nex_Command == 8'h45)
											begin
												print_line[5:0] = 6'b0;

												next_state = display_exit;
											end
										else
												next_state = display_exit;
									end
			default:				next_state = print_welcome;
		endcase
	end
end
												




top_keyboard KEYBOARD(.clk(clk),
							.reset(reset),
							.sel(sel_wire),
							.ps2d(ps2d),
							.ps2c(ps2c),
							.rx_en(enable_kbd_wire),
							.IP_Command(IP_Command),
							.IP_Angle(IP_Angle),
							.Nex_Command(Nex_Command),
							.dout_enter(out_enter_wire),
							.data_temp_disp(kbd_data_disp)
						);

rotary_encoder	ROTOR(.clk(clk),
							.reset(reset),
							.rotory_dev_on(enable_rot_wire),
							.rotary_a(rotary_a), 
							.rotary_b(rotary_b), 
							.rotary_press(rotary_press), 
							.counted_value(op_rotor), 
							.counted_disp(counted_disp),
							.press(out_pressed_wire)
							);

top_vga	VGA( 			.clk(clk),
							.reset(reset),
							.v_sync(v_sync), 
							.h_sync(h_sync), 
							.RGB(RGB),
							.welcome_trig(welcome_print_wire),
							.print_line(print_line_wire),
							.data_temp_disp(data_for_disp_wire),
							.q_val_op(q_val_wire),
							.i_val_op(i_val_wire)
							);

Cordic_Handler CORDIC(.clk(clk),
							.angle_ip(input_angle_wire),
							.Xout(i_val_wire),
							.Yout(q_val_wire)
							);
assign top_cordic = i_val_wire[47:40];

endmodule