data/full_repos/permissive/20951436/Code/fpga code/advanced code/Advanced code.v
1: b'%Error: Cannot find file containing module: code/advanced\n        ... Looked in:\n             data/full_repos/permissive/20951436/Code/fpga/code/advanced\n             data/full_repos/permissive/20951436/Code/fpga/code/advanced.v\n             data/full_repos/permissive/20951436/Code/fpga/code/advanced.sv\n             code/advanced\n             code/advanced.v\n             code/advanced.sv\n             obj_dir/code/advanced\n             obj_dir/code/advanced.v\n             obj_dir/code/advanced.sv\n%Error: Cannot find file containing module: code,data/full_repos/permissive/20951436\n%Error: Cannot find file containing module: data/full_repos/permissive/20951436/Code/fpga\n%Error: Cannot find file containing module: code/Advanced\n%Error: Cannot find file containing module: code.v\n%Error: Exiting due to 5 error(s)\n'
module len_calc(input clk, input en, input [31:0] coor_mot_x, coor_mot_y, coor_mot_z, input [31:0] coor_obj_x, coor_obj_y, coor_obj_z, output [31:0] len, output reg comp_sig);
	
	reg count;

	wire comp_x, comp_y, comp_z, sq_comp; reg en_mult, en_sq;
	initial begin
		en_mult<=0;
		en_sq<=0;
	end
	
	wire comp_mult = comp_x & comp_y & comp_z;
	reg en_hist;
	reg [2:0] clk_factor; initial clk_factor <= 0;
	reg clk_div; initial clk_div<=0;
	always @(negedge clk) begin
		clk_factor<=clk_factor+1;
		if (clk_factor==0) clk_div<=~clk_div;
	end
	
	always @(negedge clk_div) begin
		en_hist<=en;
		if (en && (~en_hist)) begin

			en_mult<=1;
			count<=0;
			comp_sig<=0;
		end else begin
			case (count)
				0: begin

					if (comp_mult) begin
						count<=count+1;
						en_sq<=1;
						en_mult<=0;
					end
				end
				1: begin

					if (sq_comp) begin
						comp_sig<=1;
						en_sq<=0;
					end
				end
			endcase
		end
	end


	wire [63:0] len_squared;
	wire [31:0] coor_diff_x; assign coor_diff_x = coor_obj_x - coor_mot_x;
	wire [31:0] coor_diff_y; assign coor_diff_y = coor_obj_y - coor_mot_y;
	wire [31:0] coor_diff_z; assign coor_diff_z = coor_obj_z - coor_mot_z;
	wire [63:0] coor_diff_x_squared; multiplier multx(clk,1,coor_diff_x,coor_diff_x,en_mult,coor_diff_x_squared,comp_x);
	wire [63:0] coor_diff_y_squared; multiplier multy(clk,1,coor_diff_y,coor_diff_y,en_mult,coor_diff_y_squared,comp_y);
	wire [63:0] coor_diff_z_squared; multiplier multz(clk,1,coor_diff_z,coor_diff_z,en_mult,coor_diff_z_squared,comp_z);
	
	assign len_squared = coor_diff_x_squared + coor_diff_y_squared + coor_diff_z_squared;

	squareroot sqlen(clk,len_squared,len,en_sq,sq_comp);

endmodule
module len_calc(input clk, input en, input [31:0] coor_mot_x, coor_mot_y, coor_mot_z, input [31:0] coor_obj_x, coor_obj_y, coor_obj_z, output [31:0] len, output reg comp_sig);

	
	reg count;

	wire comp_x, comp_y, comp_z, sq_comp; reg en_mult, en_sq;
	initial begin
		en_mult<=0;
		en_sq<=0;
	end
	
	wire comp_mult = comp_x & comp_y & comp_z;
	reg en_hist;
	reg [2:0] clk_factor; initial clk_factor <= 0;
	reg clk_div; initial clk_div<=0;
	always @(negedge clk) begin
		clk_factor<=clk_factor+1;
		if (clk_factor==0) clk_div<=~clk_div;
	end
	
	always @(negedge clk_div) begin
		en_hist<=en;
		if (en && (~en_hist)) begin

			en_mult<=1;
			count<=0;
			comp_sig<=0;
		end else begin
			case (count)
				0: begin

					if (comp_mult) begin
						count<=count+1;
						en_sq<=1;
						en_mult<=0;
					end
				end
				1: begin

					if (sq_comp) begin
						comp_sig<=1;
						en_sq<=0;
					end
				end
			endcase
		end
	end


	wire [63:0] len_squared;
	wire [31:0] coor_diff_x; assign coor_diff_x = coor_obj_x - coor_mot_x;
	wire [31:0] coor_diff_y; assign coor_diff_y = coor_obj_y - coor_mot_y;
	wire [31:0] coor_diff_z; assign coor_diff_z = coor_obj_z - coor_mot_z;
	wire [63:0] coor_diff_x_squared; multiplier multx(clk,1,coor_diff_x,coor_diff_x,en_mult,coor_diff_x_squared,comp_x);
	wire [63:0] coor_diff_y_squared; multiplier multy(clk,1,coor_diff_y,coor_diff_y,en_mult,coor_diff_y_squared,comp_y);
	wire [63:0] coor_diff_z_squared; multiplier multz(clk,1,coor_diff_z,coor_diff_z,en_mult,coor_diff_z_squared,comp_z);
	
	assign len_squared = coor_diff_x_squared + coor_diff_y_squared + coor_diff_z_squared;

	squareroot sqlen(clk,len_squared,len,en_sq,sq_comp);

endmodule