data/full_repos/permissive/114714167/Source-Code/PreviousTeamPorted/reciever_offset_generators.v
1: b'%Warning-MULTITOP: data/full_repos/permissive/114714167/Source-Code/PreviousTeamPorted/reciever_offset_generators.v:124: Multiple top level modules\n                                                                                                                       : ... Suggest see manual; fix the duplicates, or use --top-module to select top.\n                   ... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.\n                                                                                                                       : ... Top module \'throttle_offset_generator\'\nmodule throttle_offset_generator(motor_1_offset, motor_2_offset, motor_3_offset, motor_4_offset, led, throttle_offset, switch_state, clk);\n       ^~~~~~~~~~~~~~~~~~~~~~~~~\n                                                                                                                       : ... Top module \'pitch_offset_generator\'\nmodule pitch_offset_generator(motor_1_offset, motor_2_offset, motor_3_offset, motor_4_offset, pitch_offset, throttle_offset, clk);\n       ^~~~~~~~~~~~~~~~~~~~~~\n                                                                                                                       : ... Top module \'roll_offset_generator\'\nmodule roll_offset_generator(motor_1_offset, motor_2_offset, motor_3_offset, motor_4_offset, roll_offset, throttle_offset, clk);\n       ^~~~~~~~~~~~~~~~~~~~~\n                                                                                                                       : ... Top module \'yaw_offset_generator\'\nmodule yaw_offset_generator(motor_1_offset, motor_2_offset, motor_3_offset, motor_4_offset, yaw_offset, throttle_offset, clk);\n       ^~~~~~~~~~~~~~~~~~~~\n%Warning-WIDTH: data/full_repos/permissive/114714167/Source-Code/PreviousTeamPorted/reciever_offset_generators.v:37: Operator ASSIGNDLY expects 11 bits on the Assign RHS, but Assign RHS\'s VARREF \'throttle_offset\' generates 10 bits.\n                                                                                                                   : ... In instance throttle_offset_generator\n          motor_1_offset <= throttle_offset;\n                         ^~\n%Warning-WIDTH: data/full_repos/permissive/114714167/Source-Code/PreviousTeamPorted/reciever_offset_generators.v:38: Operator ASSIGNDLY expects 11 bits on the Assign RHS, but Assign RHS\'s VARREF \'throttle_offset\' generates 10 bits.\n                                                                                                                   : ... In instance throttle_offset_generator\n          motor_2_offset <= throttle_offset;\n                         ^~\n%Warning-WIDTH: data/full_repos/permissive/114714167/Source-Code/PreviousTeamPorted/reciever_offset_generators.v:39: Operator ASSIGNDLY expects 11 bits on the Assign RHS, but Assign RHS\'s VARREF \'throttle_offset\' generates 10 bits.\n                                                                                                                   : ... In instance throttle_offset_generator\n          motor_3_offset <= throttle_offset;\n                         ^~\n%Warning-WIDTH: data/full_repos/permissive/114714167/Source-Code/PreviousTeamPorted/reciever_offset_generators.v:40: Operator ASSIGNDLY expects 11 bits on the Assign RHS, but Assign RHS\'s VARREF \'throttle_offset\' generates 10 bits.\n                                                                                                                   : ... In instance throttle_offset_generator\n          motor_4_offset <= throttle_offset;\n                         ^~\n%Error: Exiting due to 5 warning(s)\n'
module throttle_offset_generator(motor_1_offset, motor_2_offset, motor_3_offset, motor_4_offset, led, throttle_offset, switch_state, clk);
	output reg [10:0] motor_1_offset;
 	output reg [10:0] motor_2_offset;
 	output reg [10:0] motor_3_offset;
 	output reg [10:0] motor_4_offset;
 	output reg  [7:0]led;
	reg             [7:0] int_led;
	
 	input [9:0] 	  throttle_offset;
	input [9:0]     switch_state;
 	input             clk;
 
 	parameter OFFSET1 = 86;
	parameter OFFSET2 = 82;
	parameter OFFSET3 = 90;
	parameter OFFSET4 = 70;
	parameter STEP1 = 5;
	parameter STEP2 = 8;
	parameter STEP3 = 8;
	parameter STEP4 = 0;
	parameter INVERT_LED_CMD = 1;


	always@ (posedge clk) 
 	  begin
		if (switch_state < 250) 
	      begin
 		    if (throttle_offset <= 20) 
 		      begin
				  int_led <= 8'b1111_1111;
 			      motor_1_offset <= throttle_offset;
 			      motor_2_offset <= throttle_offset;
 			      motor_3_offset <= throttle_offset;
 			      motor_4_offset <= throttle_offset;
 		      end
		    else if (throttle_offset > 20 && throttle_offset <= 50) 
 		      begin
				  int_led <= 8'b0111_1111;
 			      motor_1_offset <= throttle_offset+OFFSET1+0*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+0*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+0*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+0*STEP4;
 		      end
 		    else if (throttle_offset > 50 && throttle_offset <= 100)
		      begin
				  int_led <= 8'b0011_1111;
		    	  motor_1_offset <= throttle_offset+OFFSET1+0*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+0*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+0*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+0*STEP4;
		      end
		    else if (throttle_offset > 100 && throttle_offset <= 150)
		      begin
				  int_led <= 8'b0001_1111;
		    	  motor_1_offset <= throttle_offset+OFFSET1+1*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+1*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+1*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+1*STEP4;
		      end
		    else if (throttle_offset > 150 && throttle_offset <= 200) 
 		      begin
				  int_led <= 8'b0000_1111;
 		    	  motor_1_offset <= throttle_offset+OFFSET1+1*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+1*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+1*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+1*STEP4;
 		      end
 		    else if (throttle_offset > 200 && throttle_offset <= 250)
		      begin
				  int_led <= 8'b0000_0111;
		    	  motor_1_offset <= throttle_offset+OFFSET1+2*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+2*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+2*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+2*STEP4;
		      end
		    else if (throttle_offset > 250 && throttle_offset <= 300)
		      begin
				  int_led <= 8'b0000_0011;
		    	  motor_1_offset <= throttle_offset+OFFSET1+2*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+2*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+2*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+2*STEP4;
		      end
		    else if (throttle_offset > 300 && throttle_offset <= 350)
		      begin
				  int_led <= 8'b0000_0001;
		    	  motor_1_offset <= throttle_offset+OFFSET1+3*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+3*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+3*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+3*STEP4;
		      end
		    else if (throttle_offset > 350)
		      begin
				  int_led <= 8'b00000000;
		    	  motor_1_offset <= throttle_offset+OFFSET1+3*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+3*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+3*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+3*STEP4;
		      end
		  end
		else if (switch_state >= 250)
		  begin
			int_led <= 8'b10101010;
			motor_1_offset <= -50;
			motor_2_offset <= -50;
			motor_3_offset <= -50;
			motor_4_offset <= -50;
		  end
		  

        if (INVERT_LED_CMD == 1)
			led = ~int_led;
		else 
			led = int_led;
	  end
endmodule
module throttle_offset_generator(motor_1_offset, motor_2_offset, motor_3_offset, motor_4_offset, led, throttle_offset, switch_state, clk);

	output reg [10:0] motor_1_offset;
 	output reg [10:0] motor_2_offset;
 	output reg [10:0] motor_3_offset;
 	output reg [10:0] motor_4_offset;
 	output reg  [7:0]led;
	reg             [7:0] int_led;
	
 	input [9:0] 	  throttle_offset;
	input [9:0]     switch_state;
 	input             clk;
 
 	parameter OFFSET1 = 86;
	parameter OFFSET2 = 82;
	parameter OFFSET3 = 90;
	parameter OFFSET4 = 70;
	parameter STEP1 = 5;
	parameter STEP2 = 8;
	parameter STEP3 = 8;
	parameter STEP4 = 0;
	parameter INVERT_LED_CMD = 1;


	always@ (posedge clk) 
 	  begin
		if (switch_state < 250) 
	      begin
 		    if (throttle_offset <= 20) 
 		      begin
				  int_led <= 8'b1111_1111;
 			      motor_1_offset <= throttle_offset;
 			      motor_2_offset <= throttle_offset;
 			      motor_3_offset <= throttle_offset;
 			      motor_4_offset <= throttle_offset;
 		      end
		    else if (throttle_offset > 20 && throttle_offset <= 50) 
 		      begin
				  int_led <= 8'b0111_1111;
 			      motor_1_offset <= throttle_offset+OFFSET1+0*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+0*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+0*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+0*STEP4;
 		      end
 		    else if (throttle_offset > 50 && throttle_offset <= 100)
		      begin
				  int_led <= 8'b0011_1111;
		    	  motor_1_offset <= throttle_offset+OFFSET1+0*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+0*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+0*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+0*STEP4;
		      end
		    else if (throttle_offset > 100 && throttle_offset <= 150)
		      begin
				  int_led <= 8'b0001_1111;
		    	  motor_1_offset <= throttle_offset+OFFSET1+1*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+1*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+1*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+1*STEP4;
		      end
		    else if (throttle_offset > 150 && throttle_offset <= 200) 
 		      begin
				  int_led <= 8'b0000_1111;
 		    	  motor_1_offset <= throttle_offset+OFFSET1+1*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+1*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+1*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+1*STEP4;
 		      end
 		    else if (throttle_offset > 200 && throttle_offset <= 250)
		      begin
				  int_led <= 8'b0000_0111;
		    	  motor_1_offset <= throttle_offset+OFFSET1+2*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+2*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+2*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+2*STEP4;
		      end
		    else if (throttle_offset > 250 && throttle_offset <= 300)
		      begin
				  int_led <= 8'b0000_0011;
		    	  motor_1_offset <= throttle_offset+OFFSET1+2*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+2*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+2*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+2*STEP4;
		      end
		    else if (throttle_offset > 300 && throttle_offset <= 350)
		      begin
				  int_led <= 8'b0000_0001;
		    	  motor_1_offset <= throttle_offset+OFFSET1+3*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+3*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+3*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+3*STEP4;
		      end
		    else if (throttle_offset > 350)
		      begin
				  int_led <= 8'b00000000;
		    	  motor_1_offset <= throttle_offset+OFFSET1+3*STEP1;
 			      motor_2_offset <= throttle_offset+OFFSET2+3*STEP2;
 			      motor_3_offset <= throttle_offset+OFFSET3+3*STEP3;
 			      motor_4_offset <= throttle_offset+OFFSET4+3*STEP4;
		      end
		  end
		else if (switch_state >= 250)
		  begin
			int_led <= 8'b10101010;
			motor_1_offset <= -50;
			motor_2_offset <= -50;
			motor_3_offset <= -50;
			motor_4_offset <= -50;
		  end
		  

        if (INVERT_LED_CMD == 1)
			led = ~int_led;
		else 
			led = int_led;
	  end
endmodule